Skip to content

Commit 9c1b2d2

Browse files
committed
Initial commit
0 parents  commit 9c1b2d2

33 files changed

+4778
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tools/*

LICENSE.md

Lines changed: 503 additions & 0 deletions
Large diffs are not rendered by default.

boards.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
menu.UploadSpeed=Upload Speed
2+
3+
4+
###########
5+
6+
pinecone.name=PINE64 PineCone
7+
8+
pinecone.upload.tool=flasher
9+
pinecone.upload.maximum_size=1310720
10+
pinecone.upload.maximum_data_size=327680
11+
pinecone.upload.wait_for_upload_port=true
12+
13+
pinecone.serial.disableDTR=true
14+
pinecone.serial.disableRTS=true
15+
16+
pinecone.build.mcu=bl602
17+
pinecone.build.core=bl602
18+
pinecone.build.variant=pinecone
19+
pinecone.build.board=PINECONE_EVB
20+
21+
# pinecone.build.f_cpu=240000000L
22+
# pinecone.build.flash_size=4MB
23+
# pinecone.build.flash_freq=40m
24+
# pinecone.build.flash_mode=dio
25+
# pinecone.build.boot=dio
26+
# pinecone.build.partitions=default
27+
# pinecone.build.defines=
28+
29+
pinecone.menu.UploadSpeed.2000000=2000000
30+
31+
# pinecone.menu.UploadSpeed.921600=921600
32+
# pinecone.menu.UploadSpeed.921600.upload.speed=921600
33+
# pinecone.menu.UploadSpeed.115200=115200
34+
# pinecone.menu.UploadSpeed.115200.upload.speed=115200
35+
# pinecone.menu.UploadSpeed.256000.windows=256000
36+
# pinecone.menu.UploadSpeed.256000.upload.speed=256000
37+
# pinecone.menu.UploadSpeed.230400.windows.upload.speed=256000
38+
# pinecone.menu.UploadSpeed.230400=230400
39+
# pinecone.menu.UploadSpeed.230400.upload.speed=230400
40+
# pinecone.menu.UploadSpeed.460800.linux=460800
41+
# pinecone.menu.UploadSpeed.460800.macosx=460800
42+
# pinecone.menu.UploadSpeed.460800.upload.speed=460800
43+
# pinecone.menu.UploadSpeed.512000.windows=512000
44+
# pinecone.menu.UploadSpeed.512000.upload.speed=512000

cores/bl602/Arduino.h

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
This library is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
Lesser General Public License for more details.
12+
You should have received a copy of the GNU Lesser General Public
13+
License along with this library; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15+
*/
16+
17+
#ifndef Arduino_h
18+
#define Arduino_h
19+
20+
#include <FreeRTOS.h>
21+
#include <task.h>
22+
23+
#include <stdbool.h>
24+
#include <stdint.h>
25+
#include <stdarg.h>
26+
#include <stddef.h>
27+
#include <stdio.h>
28+
#include <stdlib.h>
29+
#include <string.h>
30+
#include <inttypes.h>
31+
#include <math.h>
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
extern TaskHandle_t rtosMainTask;
37+
#include "bl602-hal-misc.h"
38+
#include "bl602-hal-gpio.h"
39+
#include "bl602-hal-pwm.h"
40+
#ifdef __cplusplus
41+
}
42+
#endif
43+
44+
#include "binary.h"
45+
46+
#define PI 3.1415926535897932384626433832795
47+
#define HALF_PI 1.5707963267948966192313216916398
48+
#define TWO_PI 6.283185307179586476925286766559
49+
#define DEG_TO_RAD 0.017453292519943295769236907684886
50+
#define RAD_TO_DEG 57.295779513082320876798154814105
51+
#define EULER 2.718281828459045235360287471352
52+
53+
#define SERIAL 0x0
54+
#define DISPLAY 0x1
55+
56+
#define LSBFIRST 0
57+
#define MSBFIRST 1
58+
59+
#define bit(b) (1UL << (b))
60+
#define _BV(b) (1UL << (b))
61+
62+
typedef bool boolean;
63+
typedef uint8_t byte;
64+
typedef unsigned int word;
65+
66+
void setup(void);
67+
void loop(void);
68+
69+
#include "WString.h"
70+
#include "Stream.h"
71+
#include "Printable.h"
72+
#include "Print.h"
73+
#include "HardwareSerial.h"
74+
75+
#endif

cores/bl602/HardwareSerial.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// SPDX-License-Identifier: LGPL-2.1-only
2+
// Copyright (C) 2020 Marek Kraus <[email protected]>
3+
4+
#include "HardwareSerial.h"
5+
extern "C" {
6+
#include <bl_uart.h>
7+
};
8+
9+
HardwareSerial Serial(0);
10+
11+
void HardwareSerial::begin(unsigned long baud, uint8_t config)
12+
{
13+
//bl_uart_flush(this->_uart_num);
14+
bl_uart_init(_uart_num, 16, 7, 255, 255, baud);
15+
//bl_uart_int_enable(this->_uart_num);
16+
}
17+
18+
void HardwareSerial::end()
19+
{
20+
bl_uart_int_disable(_uart_num);
21+
// TODO: ?
22+
}
23+
24+
int HardwareSerial::available()
25+
{
26+
return UART_GetRxFifoCount((UART_ID_Type)_uart_num);
27+
}
28+
29+
int HardwareSerial::peek()
30+
{
31+
// TODO:
32+
return 0;
33+
}
34+
35+
int HardwareSerial::read()
36+
{
37+
return bl_uart_data_recv(_uart_num);
38+
}
39+
40+
int HardwareSerial::availableForWrite()
41+
{
42+
// TODO:
43+
return 0;
44+
}
45+
46+
void HardwareSerial::flush()
47+
{
48+
bl_uart_flush(_uart_num);
49+
}
50+
51+
size_t HardwareSerial::write(uint8_t c)
52+
{
53+
bl_uart_data_send(_uart_num, c);
54+
return 1;
55+
}
56+
57+
size_t HardwareSerial::write(const uint8_t *buffer, size_t size)
58+
{
59+
for (size_t i = 0; i < size; i++) {
60+
bl_uart_data_send(_uart_num, buffer[i]);
61+
}
62+
return size;
63+
}

cores/bl602/HardwareSerial.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// SPDX-License-Identifier: LGPL-2.1-only
2+
// Copyright (C) 2020 Marek Kraus <[email protected]>
3+
4+
#ifndef HardwareSerial_h
5+
#define HardwareSerial_h
6+
7+
#include <inttypes.h>
8+
9+
#include "Stream.h"
10+
11+
// TODO:
12+
#define SERIAL_8N1 0
13+
14+
class HardwareSerial : public Stream
15+
{
16+
public:
17+
HardwareSerial(uint8_t uart_num) : _uart_num(uart_num) {};
18+
void begin(unsigned long baud, uint8_t config=SERIAL_8N1);
19+
void end();
20+
int available();
21+
int peek();
22+
int read();
23+
size_t read(uint8_t *buffer, size_t size);
24+
inline size_t read(char * buffer, size_t size)
25+
{
26+
return read((uint8_t*) buffer, size);
27+
}
28+
int availableForWrite();
29+
void flush();
30+
size_t write(uint8_t c);
31+
size_t write(const uint8_t *buffer, size_t size);
32+
inline size_t write(const char * buffer, size_t size)
33+
{
34+
return write((uint8_t*) buffer, size);
35+
}
36+
37+
inline size_t write(unsigned long n)
38+
{
39+
return write((uint8_t) n);
40+
}
41+
inline size_t write(long n)
42+
{
43+
return write((uint8_t) n);
44+
}
45+
inline size_t write(unsigned int n)
46+
{
47+
return write((uint8_t) n);
48+
}
49+
inline size_t write(int n)
50+
{
51+
return write((uint8_t) n);
52+
}
53+
using Print::write; // pull in write(str) and write(buf, size) from Print
54+
operator bool() const { return true; }
55+
protected:
56+
uint8_t _uart_num;
57+
};
58+
59+
extern HardwareSerial Serial;
60+
61+
extern void serialEventRun(void) __attribute__((weak));
62+
63+
#endif

0 commit comments

Comments
 (0)