Skip to content

Commit 0d6fe8b

Browse files
committed
[core] Refactor structure
1 parent bc8755f commit 0d6fe8b

16 files changed

+81
-13
lines changed

README.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,43 @@ A (mostly) complete* list of Tuya wireless module boards.
6464

6565
** I/O count includes GPIOs, ADCs, PWM outputs and UART, but doesn't count CEN/RST and power pins.
6666

67+
## Project structure
68+
69+
```
70+
arduino/
71+
├─ <platform name>/ Arduino Core for specific platform
72+
│ ├─ cores/ Core files
73+
│ ├─ libraries/ Supported built-in libraries
74+
boards/
75+
├─ <board name>/ Board-specific code
76+
│ ├─ variant.cpp Arduino variant initialization
77+
│ ├─ variant.h Arduino variant pin configs
78+
├─ <board name>.json PlatformIO board description
79+
builder/
80+
├─ frameworks/ Framework builders for PlatformIO
81+
│ ├─ <platform name>-sdk.py Vanilla SDK build system
82+
│ ├─ <platform name>-arduino.py Arduino Core build system
83+
├─ main.py Main PlatformIO builder
84+
fixups/
85+
├─ <platform name>/ Code fix-ups to replace SDK parts
86+
platform/
87+
├─ <platform name>/ Other platform-specific files
88+
│ ├─ bin/ Binary blobs (bootloaders, etc.)
89+
│ ├─ ld/ Linker scripts
90+
tools/
91+
├─ <tool name>/ Tools used during the build
92+
platform.json PlatformIO manifest
93+
platform.py Custom PlatformIO script
94+
95+
```
96+
6797
## Platforms
6898

6999
A list of platforms currently available in this project.
70100

71101
Platform name | Supported MCU(s) | Arduino Core | Source SDK (PIO framework)
72102
---------------|------------------------------------------------------------------------|--------------|--------------------------------------------------------------------------
73-
`realtek-ambz` | Realtek [AmebaZ](https://www.amebaiot.com/en/amebaz/) SoC (`RTL87xxB`) | | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
103+
`realtek-ambz` | Realtek [AmebaZ](https://www.amebaiot.com/en/amebaz/) SoC (`RTL87xxB`) | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
74104

75105
### Realtek Ameba
76106

@@ -96,3 +126,34 @@ As such, there are numerous CPUs with the same numbers but different series, whi
96126
- and probably many more
97127

98128
Different Ameba series are not compatible with each other. Apparently, there isn't a public SDK for AmebaZ that can support C++ properly (yet).
129+
130+
## Arduino Core support status
131+
132+
Note: this list will probably change with each functionality update.
133+
134+
&nbsp; | `realtek-ambz`
135+
--|--
136+
Core functions|✔️
137+
GPIO/PWM/IRQ|✔️/❓/✔️
138+
Analog input|❓
139+
UART I/O|✔️
140+
Flash I/O|❓
141+
**LIBRARIES**
142+
SPI|❌
143+
SPIFFS|❌
144+
Wire|❌
145+
BLE|-
146+
Wi-Fi|❌
147+
HTTP|❌
148+
NTP|❌
149+
OTA|❌
150+
MDNS|❌
151+
MQTT|❌
152+
SD|❌
153+
154+
Legend:
155+
- ✔️ working
156+
- ❗ broken
157+
- ❓ untested
158+
- ❌ not implemented (yet?)
159+
- \- not applicable

boards/wr3.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"f_cpu": "125000000L",
99
"amb_ota1_offset": "0x0800B000",
1010
"amb_ota2_offset": "0x080D0000",
11-
"amb_boot_all": "boot_all.bin"
11+
"amb_boot_all": "boot_all_77F7.bin"
1212
},
1313
"frameworks": [
1414
"realtek-ambz-sdk",

boards/wr3/bin/descript.ion

-1
This file was deleted.

boards/wr3/ld/descript.ion

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
export-rom_symbol_v01.txt amb1_sdk
2-
rlx8711B-symbol-v02-img2_xip1.ld amb1_sdk
3-
rlx8711B-symbol-v02-img2_xip2.ld amb1_sdk
4-
rlx8711B-symbol-v02-img2_xip2_2M.ld tysdk_for_rtl8710bn
5-
rlx8711B-symbol-v02-img2_xip1_2M.ld tysdk_for_rtl8710bn
61
rtl8710-symbol-v03-img2_arduino_arduino.ld amb1_arduino/rtl8710
72
export-rom_v03.txt amb1_arduino/rtl8710
83
export-rom_v04.txt RtlDuino/rtl8710

builder/frameworks/realtek-ambz-arduino.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
SDK_DIR = platform.get_package_dir("framework-realtek-amb1")
1818
BOARD_DIR = join(platform.get_dir(), "boards", variant)
1919
FIXUPS_DIR = join(platform.get_dir(), "fixups", "realtek-ambz")
20+
PLATFORM_DIR = join(platform.get_dir(), "platform", "realtek-ambz")
2021
CORE_DIR = join(platform.get_dir(), "arduino", "realtek-ambz")
2122
assert isdir(SDK_DIR)
2223
assert isdir(env.subst(BOARD_DIR))
2324
assert isdir(env.subst(FIXUPS_DIR))
25+
assert isdir(env.subst(PLATFORM_DIR))
2426
assert isdir(env.subst(CORE_DIR))
2527

2628
# Flags
@@ -75,7 +77,6 @@
7577
CPPPATH=[
7678
# fmt: off
7779
# prepend these as the Arduino core is incorrectly picking some includes from SDK
78-
join(BOARD_DIR),
7980
join(CORE_DIR, "cores", "arduino"),
8081
join(CORE_DIR, "cores", "arduino", "avr"),
8182
join(CORE_DIR, "cores", "arduino", "rtl8195a"),
@@ -143,7 +144,7 @@
143144
)
144145
env.Replace(
145146
LDSCRIPT_PATH=[
146-
join(BOARD_DIR, "ld", ldscript),
147+
join(PLATFORM_DIR, "ld", ldscript),
147148
],
148149
)
149150

builder/frameworks/realtek-ambz-sdk.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
SDK_DIR = platform.get_package_dir("framework-realtek-amb1")
1515
BOARD_DIR = join(platform.get_dir(), "boards", variant)
1616
FIXUPS_DIR = join(platform.get_dir(), "fixups", "realtek-ambz")
17+
PLATFORM_DIR = join(platform.get_dir(), "platform", "realtek-ambz")
1718
assert isdir(SDK_DIR)
1819
assert isdir(env.subst(BOARD_DIR))
1920
assert isdir(env.subst(FIXUPS_DIR))
21+
assert isdir(env.subst(PLATFORM_DIR))
2022

2123
ota1_offset = board.get("build.amb_ota1_offset")
2224
ota2_offset = board.get("build.amb_ota2_offset")
@@ -98,6 +100,9 @@
98100
env.Append(
99101
CPPPATH=[
100102
# fmt: off
103+
join(BOARD_DIR),
104+
join(FIXUPS_DIR),
105+
join(PLATFORM_DIR),
101106
join(SDK_DIR, "project", "realtek_amebaz_va0_example", "inc"),
102107
join(SDK_DIR, "component", "os", "freertos"),
103108
join(SDK_DIR, "component", "os", "freertos", "freertos_v8.1.2", "Source", "include"),
@@ -376,7 +381,7 @@
376381
join(SDK_DIR, "component", "soc", "realtek", "8711b", "misc", "bsp", "lib", "common", "GCC"),
377382
# fmt: on
378383
# linker script path
379-
join(BOARD_DIR, "ld"),
384+
join(PLATFORM_DIR, "ld"),
380385
],
381386
LIBS=[
382387
"_platform",
@@ -396,7 +401,7 @@
396401
)
397402
env.Replace(
398403
LDSCRIPT_PATH=[
399-
join(BOARD_DIR, "ld", ldscript),
404+
join(PLATFORM_DIR, "ld", ldscript),
400405
],
401406
)
402407

@@ -554,7 +559,7 @@ def package_ota(target, source, env):
554559
join("$BUILD_DIR", "boot_all"),
555560
env.BinToObj(
556561
join("$BUILD_DIR", "boot_all.o"),
557-
join(BOARD_DIR, "bin", boot_all),
562+
join(PLATFORM_DIR, "bin", boot_all),
558563
),
559564
)
560565
env.Prepend(LIBS=[target_sdk, target_boot])

descript.ion

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tools Firmware tools (i.e. flashers)
2+
platform Platform files (blobs, linker scripts)
3+
fixups Code fixups
4+
builder PlatformIO builders
5+
boards Board definitions
6+
arduino Arduino cores
File renamed without changes.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
boot_all_77F7.bin tysdk_for_rtl8710bn

0 commit comments

Comments
 (0)