Skip to content

Commit 28191a2

Browse files
author
nulllab
committed
add w806 code base
0 parents  commit 28191a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+23740
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# w80x_duino
2+
3+
4+
## w80x_duino开发板Arduino IDE支持包安装
5+
6+
1、**文件->首选项**
7+
8+
2、在附加开发板管理器网址输入如下网址:
9+
10+
> https://cdn.jsdelivr.net/gh/Hi-LinkDuino/w80x_arduino/package_w80x_proxy_index.json
11+
12+
![](./doc/option_zh.png)
13+
14+
3、**工具->开发板->开发板管理**
15+
搜索w80x_duino,选择最新版本安装(如果搜索不到,请安装arduino IDE1.8.15以上)
16+
17+
![board_manage_zh](./doc/board_manager_zh.png)
18+
19+
4、**工具->开发板**
20+
![](./doc/board_chioce.png)
21+
22+
代表w80x_duino开发环境搭建完成
23+
24+
## w80x_duino开发计划
25+
打勾的代表已经实现并验证,没有打勾的代表正在开发中,期待更多开发者一起维护
26+
27+
- [x] [开发w80x_duino 官方SDK支持arduino ide开发]()
28+
- [ ] []()
29+
- [ ] []()
30+
- [ ] []()
31+
- [ ] []()
32+
- [ ] []()

boards.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
3+
menu.cpu_frq=CPU Frequency
4+
#menu.cpu_variant=CPU
5+
menu.upload_speed=Upload Speed
6+
menu.erase=Erase Flash
7+
#menu.os_variant=OS
8+
9+
##############################################################
10+
11+
w806.name=w806_duino
12+
w806.upload.tool=serial_upload
13+
w806.upload.protocol=xmodem
14+
w806.upload.maximum_size=1048576
15+
w806.upload.maximum_data_size=294912
16+
w806.build.mcu=ck804ef
17+
w806.build.board=HLK_W806
18+
w806.build.core=w806
19+
w806.build.variant=w806
20+
w806.build.mcpu=ck804ef
21+
22+
##############################################################
23+
# CPU Frequency
24+
w806.menu.cpu_frq.240MHZ=240MHZ
25+
w806.menu.cpu_frq.240MHZ.build.f_cpu=240
26+
w806.menu.cpu_frq.160MHZ=160MHZ
27+
w806.menu.cpu_frq.160MHZ.build.f_cpu=160
28+
w806.menu.cpu_frq.80MHZ=80MHZ
29+
w806.menu.cpu_frq.80MHZ.build.f_cpu=80
30+
w806.menu.cpu_frq.40MHZ=40MHZ
31+
w806.menu.cpu_frq.40MHZ.build.f_cpu=40
32+
w806.menu.cpu_frq.2MHZ=2MHZ
33+
w806.menu.cpu_frq.2MHZ.build.f_cpu=2
34+
35+
# Upload Speed
36+
w806.menu.upload_speed.baud115200=115200
37+
w806.menu.upload_speed.baud115200.upload.speed=115200
38+
w806.menu.upload_speed.baud460800=460800
39+
w806.menu.upload_speed.baud460800.upload.speed=460800
40+
w806.menu.upload_speed.baud921600=921600
41+
w806.menu.upload_speed.baud921600.upload.speed=921600
42+
w806.menu.upload_speed.baud1000000=1000000
43+
w806.menu.upload_speed.baud1000000.upload.speed=1000000
44+
w806.menu.upload_speed.baud2000000=2000000
45+
w806.menu.upload_speed.baud2000000.upload.speed=2000000
46+
47+
# Erase Flash
48+
w806.menu.erase.yes=erase all flash
49+
w806.menu.erase.yes.erase.flash=all
50+
w806.menu.erase.no=no erase
51+
w806.menu.erase.no.erase.flash=none
52+
##############################################################

cores/w806/Arduino.h

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
21+
#ifndef Arduino_h
22+
#define Arduino_h
23+
24+
#include <stdlib.h>
25+
#include <stdbool.h>
26+
#include <string.h>
27+
#include <math.h>
28+
#include <stdint.h>
29+
#include <stdio.h>
30+
#include "pins_arduino.h"
31+
#include "./include/driver/wm_hal.h"
32+
33+
34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
38+
//Macro-based digital IO fucntions
39+
//#include "wiring_digita.h"
40+
41+
//!!!!#include "binary.h"
42+
43+
// FIXME: workarounds for missing features or unimplemented functions
44+
// cancel out the PROGMEM attribute - used only for atmel CPUs
45+
#define PROGMEM
46+
void yield(void);
47+
48+
// we use pre-defined IRQ function the way wiring does
49+
#define WIRING
50+
51+
#define HIGH 0x1
52+
#define LOW 0x0
53+
54+
#define INPUT 0x0
55+
#define OUTPUT 0x1
56+
#define INPUT_PULLUP 0x2
57+
#define OUTPUT_OD 0x03
58+
59+
// undefine mathlib's pi if encountered
60+
#ifdef PI
61+
#undef PI
62+
#endif
63+
#ifdef HALF_PI
64+
#undef HALF_PI
65+
#endif
66+
#ifdef TWO_PI
67+
#undef TWO_PI
68+
#endif
69+
70+
#define PI 3.1415926535897932384626433832795
71+
#define HALF_PI 1.5707963267948966192313216916398
72+
#define TWO_PI 6.283185307179586476925286766559
73+
#define DEG_TO_RAD 0.017453292519943295769236907684886
74+
#define RAD_TO_DEG 57.295779513082320876798154814105
75+
#define EULER 2.718281828459045235360287471352
76+
77+
#define SERIAL 0x0
78+
#define DISPLAY 0x1
79+
80+
#define LSBFIRST 0
81+
#define MSBFIRST 1
82+
83+
#define FALLING 1
84+
85+
/*
86+
#define INTERNAL1V1 2
87+
#define INTERNAL2V56 3
88+
#define INTERNAL 3
89+
#define DEFAULT 1
90+
#define EXTERNAL 0
91+
*/
92+
93+
// undefine stdlib's abs if encountered
94+
#ifdef abs
95+
#undef abs
96+
#endif
97+
98+
#define min(a,b) ((a)<(b)?(a):(b))
99+
#define max(a,b) ((a)>(b)?(a):(b))
100+
#define abs(x) ((x)>0?(x):-(x))
101+
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
102+
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
103+
#define radians(deg) ((deg)*DEG_TO_RAD)
104+
#define degrees(rad) ((rad)*RAD_TO_DEG)
105+
#define sq(x) ((x)*(x))
106+
107+
#define interrupts() sei()
108+
#define noInterrupts() cli()
109+
110+
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
111+
#define clockCyclesPerMillisecond() ( F_CPU / 1000L )
112+
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
113+
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
114+
115+
#define byte(w) ((uint8_t)(w))
116+
#define lowByte(w) ((uint8_t) ((w) & 0xff))
117+
#define highByte(w) ((uint8_t) ((w) >> 8))
118+
119+
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
120+
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
121+
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
122+
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
123+
124+
#define maskSet(value, mask) ((value) |= (mask))
125+
#define maskClear(value, mask) ((value) &= ~(mask))
126+
127+
128+
// avr-libc defines _NOP() since 1.6.2
129+
#ifndef _NOP
130+
//#define _NOP() do { __asm__ volatile ("nop"); } while (0)
131+
#endif
132+
133+
#define BEGIN_CRITICAL __critical {
134+
#define END_CRITICAL }
135+
136+
137+
typedef unsigned int word;
138+
139+
#define bit(b) (1UL << (b))
140+
141+
typedef unsigned char boolean;
142+
typedef unsigned char byte;
143+
//typedef uint8_t byte;
144+
145+
void init(void);
146+
//void initVariant(void); // weak
147+
148+
//int atexit(void (*func)()); // __attribute__((weak));
149+
//void serialEvent(void); // weak
150+
//extern unsigned char runSerialEvent;
151+
152+
//void pinMode(uint8_t pin, __xdata uint8_t mode);
153+
//void digitalWrite(uint8_t pin, __xdata uint8_t val);
154+
uint8_t digitalRead(uint8_t pin);
155+
//void analogWrite(uint8_t pin, __xdata uint16_t val);
156+
157+
//uint32_t millis(void);
158+
//uint32_t micros(void);
159+
//void delay(uint32_t ms);
160+
//void delayMicroseconds(uint16_t us);
161+
//unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
162+
//unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
163+
164+
//void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
165+
//uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
166+
167+
//void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), __xdata uint8_t mode);
168+
//void detachInterrupt(uint8_t interruptNum);
169+
170+
void setup(void);
171+
void loop(void);
172+
173+
#ifdef __cplusplus
174+
}
175+
#endif
176+
#endif
177+
178+

cores/w806/WInterrupts.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "wm_hal.h"
2+
3+
#define readl(addr) ({unsigned int __v = (*(volatile unsigned int *) (addr)); __v;})
4+
__attribute__((isr)) void CORET_IRQHandler(void)
5+
{
6+
readl(0xE000E010);
7+
HAL_IncTick();
8+
}
9+
__attribute__((isr)) void GPIOA_IRQHandler(void)
10+
{
11+
HAL_GPIO_EXTI_IRQHandler(GPIOA, GPIO_PIN_0);
12+
}
13+
14+
__attribute__((isr)) void GPIOB_IRQHandler(void)
15+
{
16+
HAL_GPIO_EXTI_IRQHandler(GPIOB, GPIO_PIN_5);
17+
}

cores/w806/WInterrupts.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef __WM_IT_H__
2+
#define __WM_IT_H__
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
void CORET_IRQHandler(void);
7+
void GPIOA_IRQHandler(void);
8+
void GPIOB_IRQHandler(void);
9+
void UART0_IRQHandler(void);
10+
void UART1_IRQHandler(void);
11+
void UART2_4_IRQHandler(void);
12+
void WDG_IRQHandler(void);
13+
void TIM0_5_IRQHandler(void);
14+
void ADC_IRQHandler(void);
15+
void PMU_IRQHandler(void);
16+
void TOUCH_IRQHandler(void);
17+
#ifdef __cplusplus
18+
}
19+
#endif
20+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef __CSI_CONFIG_H__
2+
#define __CSI_CONFIG_H__
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#define CONFIG_CHIP_SL04 1
9+
#define CONFIG_KERNEL_NONE 1
10+
#define CONFIG_HAVE_VIC 1
11+
#define CONFIG_SEPARATE_IRQ_SP 1
12+
#define CONFIG_ARCH_INTERRUPTSTACK 4096
13+
#define CONFIG_IRQ_VECTOR_SIZE 256
14+
#define USE_UART0_PRINT 1
15+
16+
#ifdef CONFIG_KERNEL_NONE
17+
#define CONFIG_SYSTEM_SECURE 1
18+
#endif
19+
20+
#ifdef __cplusplus
21+
}
22+
#endif
23+
24+
#endif

0 commit comments

Comments
 (0)