Skip to content

Commit 4fa2301

Browse files
BL616/BL602_ALT (#2066)
* BL616 * BL602_ALT * Custom RTL8721DA UART pins * commonize ota & disable builds in workflow * small cleanup * commonize wifi * fixes
1 parent c1394cd commit 4fa2301

59 files changed

Lines changed: 2299 additions & 405 deletions

Some content is hidden

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

.github/workflows/workflow.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ jobs:
203203
- platform: OpenLN8825
204204
variant: default
205205
gcc: apt
206+
#- platform: OpenBL616
207+
# variant: default
208+
#- platform: OpenBL602_ALT
209+
# variant: default
206210

207211
# extras for BK7231T
208212
- platform: OpenBK7231T

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@
8585
path = sdk/OpenLN8825
8686
url = https://github.com/NonPIayerCharacter/OpenLN8825
8787
branch = master
88+
[submodule "sdk/bouffalo_sdk"]
89+
path = sdk/bouffalo_sdk
90+
url = https://github.com/bouffalolab/bouffalo_sdk
91+
branch = master

.releaserc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ publish:
258258
- path: "output/**/*_QIO_*.bin"
259259
- path: "output/**/*.rbl"
260260
- path: "output/**/*.img"
261-
- path: "output/**/OpenBL602*"
261+
- path: "output/**/OpenBL*"
262262
- path: "output/**/OpenW600*"
263263
- path: "output/**/OpenW800*"
264264
- path: "output/**/OpenLN882*"

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,24 @@ prebuild_OpenTXW81X: berry
391391
else echo "prebuild for OpenTXW81X not found ... "; \
392392
fi
393393

394+
prebuild_OpenBL616: berry
395+
git submodule update --init --recursive --depth=1 sdk/bouffalo_sdk
396+
if [ ! -e platforms/BL616/gcc ]; then cd platforms/BL616 && git clone https://github.com/bouffalolab/toolchain_gcc_t-head_linux.git gcc --depth=1; fi
397+
@if [ -e platforms/BL616/pre_build.sh ]; then \
398+
echo "prebuild found for OpenBL616"; \
399+
sh platforms/BL616/pre_build.sh; \
400+
else echo "prebuild for OpenBL616 not found ... "; \
401+
fi
402+
403+
prebuild_OpenBL602_ALT: berry
404+
git submodule update --init --recursive --depth=1 sdk/bouffalo_sdk
405+
if [ ! -e platforms/BL616/gcc ]; then cd platforms/BL616 && git clone https://github.com/bouffalolab/toolchain_gcc_t-head_linux.git gcc --depth=1; fi
406+
@if [ -e platforms/BL602_ALT/pre_build.sh ]; then \
407+
echo "prebuild found for OpenBL602_ALT"; \
408+
sh platforms/BL602_ALT/pre_build.sh; \
409+
else echo "prebuild for OpenBL602_ALT not found ... "; \
410+
fi
411+
394412
prebuild_OpenRDA5981: berry
395413
ifdef GITHUB_ACTIONS
396414
# just so that there would be no cache error
@@ -746,6 +764,20 @@ OpenRDA5981: prebuild_OpenRDA5981
746764
./sdk/OpenRDA5981/ota_lzma/xz --format=lzma -A -z -k -v -c sdk/OpenRDA5981/.build/OpenBeken.bin > sdk/OpenRDA5981/.build/OpenBeken.bin.lzma
747765
python3 sdk/OpenRDA5981/ota_lzma/ota_pack_image_lzma.py sdk/OpenRDA5981/.build/OpenBeken.bin sdk/OpenRDA5981/.build/OpenBeken.bin.lzma output/$(APP_VERSION)/OpenRDA5981_$(APP_VERSION)_ota.img $(APP_VERSION)
748766

767+
.PHONY: OpenBL616
768+
OpenBL616: prebuild_OpenBL616
769+
cd ./platforms/BL616 && PATH="$(PATH):$(PWD)/platforms/BL616/gcc/bin" $(MAKE) CHIP=bl616 BOARD=bl616dk APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT)
770+
mkdir -p output/$(APP_VERSION)
771+
cp ./platforms/BL616/build/build_out/OpenBeken_bl616.bin output/$(APP_VERSION)/OpenBL616_${APP_VERSION}.bin
772+
cp ./platforms/BL616/build/build_out/OpenBeken_bl616.xz.ota output/$(APP_VERSION)/OpenBL616_${APP_VERSION}_OTA.bin.xz.ota
773+
774+
.PHONY: OpenBL602_ALT
775+
OpenBL602_ALT: prebuild_OpenBL602_ALT
776+
cd ./platforms/BL602_ALT && PATH="$(PATH):$(PWD)/platforms/BL616/gcc/bin" $(MAKE) CHIP=bl602 BOARD=bl602dk APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT)
777+
mkdir -p output/$(APP_VERSION)
778+
dd conv=notrunc bs=1K skip=4 if=platforms/BL602_ALT/build/build_out/OpenBeken_bl602.bin of=output/$(APP_VERSION)/OpenBL602_ALT_${APP_VERSION}.bin
779+
cp ./platforms/BL602_ALT/build/build_out/OpenBeken_bl602.xz.ota output/$(APP_VERSION)/OpenBL602_ALT_${APP_VERSION}_OTA.bin.xz.ota
780+
749781
# Add custom Makefile if required
750782
-include custom.mk
751783

@@ -783,6 +815,7 @@ clean:
783815
-test -d ./platforms/ESP8266/build && cmake --build ./platforms/ESP8266/build --target clean
784816
-test -d ./sdk/OpenECR6600 && cd sdk/OpenECR6600 && make BOARD_DIR=$(ECRDIR)/Boards/ecr6600/standalone APP_NAME=OpenBeken TOPDIR=$(ECRDIR) GCC_PATH=$(ECRDIR)/tool/nds32le-elf-mculib-v3s/bin/ clean
785817
-test -d ./sdk/OpenBL602 && $(MAKE) -C sdk/OpenBL602/customer_app/bl602_sharedApp USER_SW_VER=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) CONFIG_CHIP_NAME=BL602
818+
-test -d ./platforms/BL616/build && $(MAKE) -C ./platforms/BL616 clean
786819
-test -d ./sdk/OpenBK7231T && $(MAKE) -C sdk/OpenBK7231T/platforms/bk7231t/bk7231t_os APP_BIN_NAME=$(APP_NAME) USER_SW_VER=$(APP_VERSION) clean
787820
-test -d ./sdk/OpenBK7231N && $(MAKE) -C sdk/OpenBK7231N/platforms/bk7231n/bk7231n_os APP_BIN_NAME=$(APP_NAME) USER_SW_VER=$(APP_VERSION) clean
788821
-$(RM) -r $(BUILD_DIR)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Although this repository is named `OpenBK7231T_App`, it has evolved into a multi
3434
- TXW81X (eg TXW817-810, see [development thread](https://www.elektroda.com/rtvforum/topic4033757.html))
3535
- RDA5981 (eg RDA5981AM, RDA5981BM, WRD2L, TYWRD3S, HLK-M50, see [development thread](https://www.elektroda.com/rtvforum/topic4105474.html), see [guide](https://www.elektroda.com/rtvforum/topic4148573.html))
3636
- LN8825B (eg SCW-T503)
37+
- BL616/BL618 (eg Ai-M62-12F, Ai-M61-32S)
3738

3839
Please use automatically compiled binaries from the Releases tab. To build OpenBeken yourself for any supported platform, fork our version of the submodule SDK first, and then check out this app repository alongside it. Details further down. Alternatively consider using the easier [override method.](https://www.elektroda.com/rtvforum/topic4082682.html)
3940

docs/platforms.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
| Platform | Family | GPIO | WPA3 | OTA | GPIO IRQ | UART | PWM | ADC | Deep sleep | WDT | SPI LED | IR |
2-
|---------------------------------------------------------|----------------|------|------|---------|----------|------|------|-----|------------|-----|---------|-----|
3-
| BK7231T | Beken || ✅¹² |||||||| ✅¹² ||
4-
| BK7231N | Beken || ✅¹² ||||||||||
5-
| BK7231S<br>BK7231U | Beken ||| ✅¹ |||||||||
6-
| BK7238 | Beken ||||||||||||
7-
| BK7252 | Beken ||| ⚠️¹'¹⁴ |||||||||
8-
| BK7252N | Beken ||||||||||||
9-
| XR809 | XRadio ||| ❌⁵ ||| ✅⁸ ||||||
10-
| XR806 | XRadio |||||| ✅⁸ ||||||
11-
| XR872/XF16 | XRadio ||| ✅² ||| ✅⁸ ||||||
12-
| BL602/LF686 | Bouffalo Lab ||| ✅⁴ |||||||||
13-
| W800/W801 | Winner Micro ||||||||||||
14-
| W600/W601 | Winner Micro |||||||||| ✅⁶ ||
15-
| LN882H | Lightning Semi ||| ✅⁴ |||||||||
16-
| ESP8266<br>ESP8285 | Espressif || ⚠️¹³ | ✅²'⁴ ||| ✅⁷ || ❗️ | ❓⁹ |||
17-
| ESP32<br>-C2<br>-C3<br>-C5<br>-C6<br>-C61<br>-S2<br>-S3 | Espressif || ⚠️¹³ | ✅⁴ ||||| ✅¹⁰ ||||
18-
| TR6260 | Transa Semi ||| ❗️³'⁴ ||| ✅⁸ ||| ✅⁹ |||
19-
| RTL8711AM (Ameba1) | Realtek || ❗️ | ✅⁴ ||| ✅⁸ ||||| ❓⁶ |
20-
| RTL8710B (AmebaZ) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| ⚠️⁶ |
21-
| RTL8710C<br>RTL8720C (AmebaZ2) | Realtek ||| ✅⁴ ||| ✅⁸ ||||||
22-
| RTL8720D (AmebaD)<br>RTL872xCSM<br>RTL8720CS (AmebaCS) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| ⚠️ |
23-
| RTL8721DA<br>RTL8711DAF (AmebaDplus) | Realtek ||||||||||| ⚠️ |
24-
| RTL8720E<br>RTL8710ECF (AmebaLite) | Realtek ||||||||||| ⚠️ |
25-
| ECR6600 | ESWIN |||||| ✅⁸ | ❗️ | ❗️¹¹ ||||
26-
| TXW81X | Taixin ||| ❗️ |||||||||
27-
| RDA5981 | RDA ||||||||||||
28-
| LN8825B | Lightning Semi ||||||||||||
1+
| Platform | Family | GPIO | WPA3 | OTA | GPIO IRQ | UART | PWM | ADC | Deep sleep | WDT | SPI LED | IR | BT |
2+
|---------------------------------------------------------|----------------|------|------|---------|----------|------|------|-----|------------|-----|---------|-----|------|
3+
| BK7231T | Beken || ✅¹² |||||||| ✅¹² |||
4+
| BK7231N | Beken || ✅¹² |||||||||||
5+
| BK7231S<br>BK7231U | Beken ||| ✅¹ ||||||||||
6+
| BK7238 | Beken |||||||||||||
7+
| BK7252 | Beken ||| ⚠️¹'¹⁴ ||||||||||
8+
| BK7252N | Beken |||||||||||||
9+
| XR809 | XRadio ||| ❗️⁵ ||| ✅⁸ ||||| ❓⁹ ||
10+
| XR806 | XRadio |||||| ✅⁸ ||||| ❓⁹ ||
11+
| XR872/XF16 | XRadio ||| ✅² ||| ✅⁸ ||||| ❓⁹ ||
12+
| BL602/LF686 | Bouffalo Lab ||| ✅⁴ ||||||||||
13+
| W800/W801 | Winner Micro |||||||||||||
14+
| W600/W601 | Winner Micro |||||||||| ✅⁶ |||
15+
| LN882H | Lightning Semi ||| ✅⁴ ||||||||||
16+
| ESP8266<br>ESP8285 | Espressif || ⚠️¹³ | ✅²'⁴ ||| ✅⁷ || ❗️ ||| ❓⁹ ||
17+
| ESP32<br>-C2<br>-C3<br>-C5<br>-C6<br>-C61<br>-S2<br>-S3 | Espressif || ⚠️¹³ | ✅⁴ ||||| ✅¹⁰ ||| ❓⁹ ||
18+
| TR6260 | Transa Semi ||| ✅⁴ ||| ✅⁸ ||||| ⚠️⁹ ||
19+
| RTL8711AM (Ameba1) | Realtek || ❗️ | ✅⁴ ||| ✅⁸ ||||| ❓⁶ ||
20+
| RTL8710B (AmebaZ) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| ✅⁶ ||
21+
| RTL8710C<br>RTL8720C (AmebaZ2) | Realtek ||| ✅⁴ ||| ✅⁸ |||||||
22+
| RTL8720D (AmebaD)<br>RTL872xCSM<br>RTL8720CS (AmebaCS) | Realtek ||| ✅⁴ ||| ✅⁸ |||||||
23+
| RTL8721DA<br>RTL8711DAF (AmebaDplus) | Realtek |||||||||||||
24+
| RTL8720E<br>RTL8710ECF (AmebaLite) | Realtek |||||||||||||
25+
| ECR6600 | ESWIN |||||| ✅⁸ | ❗️ | ❗️¹¹ |||||
26+
| TXW81X | Taixin ||| ❗️ ||||||||||
27+
| RDA5981 | RDA |||||||||||||
28+
| LN8825B | Lightning Semi |||||||||||||
29+
| BL616 | Bouffalo Lab ||| ✅⁴ ||||||||||
2930

3031

3132
✅ - Works<br>
@@ -43,7 +44,7 @@
4344
⁶ Disabled in obk_config <br>
4445
⁷ Software PWM, expect flickering<br>
4546
⁸ Be careful with pin assignments, some PWM channels overlap<br>
46-
WDT is configured in SDK<br>
47+
Receive only<br>
4748
¹⁰ Timer sleep only, no GPIO wakeup<br>
4849
¹¹ After waking up device will refuse to connect to WiFi until power cycled<br>
4950
¹² Only in _ALT builds<br>

libraries/easyflash/inc/ef_cfg.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@
152152
#define EF_START_ADDR 0x1E5000
153153
#define ENV_AREA_SIZE 0x8000
154154

155+
#elif PLATFORM_BL_NEW
156+
157+
#define EF_START_ADDR 0
158+
extern uint32_t ENV_AREA_SIZE;
159+
#undef EF_WRITE_GRAN
160+
#define EF_WRITE_GRAN 8
161+
155162
#elif WINDOWS
156163

157164
#define EF_START_ADDR 0

libraries/easyflash/ports/ef_port.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ typedef void* QueueHandle_t;
9797
extern int hal_flash_lock(void);
9898
extern int hal_flash_unlock(void);
9999

100+
#elif PLATFORM_BL_NEW
101+
102+
#include "bflb_mtd.h"
103+
104+
__attribute__((aligned(32))) static bflb_mtd_handle_t handle;
105+
uint32_t ENV_AREA_SIZE;
106+
uint32_t SECTOR_NUM;
107+
100108
#elif WINDOWS
101109

102110
#include "framework.h"
@@ -181,7 +189,11 @@ void xSemaphoreGive(QueueHandle_t handle)
181189
/* default ENV set for user */
182190
static const ef_env default_env_set[] =
183191
{
192+
#if PLATFORM_BL_NEW
193+
{"boot_times", "3", 1}
194+
#else
184195
{"nv_version","0.01"}
196+
#endif
185197
};
186198

187199
QueueHandle_t ef_mutex;
@@ -201,7 +213,43 @@ EfErrCode ef_port_init(ef_env const** default_env, size_t* default_env_size)
201213
*default_env = default_env_set;
202214
*default_env_size = sizeof(default_env_set) / sizeof(default_env_set[0]);
203215

216+
#if configUSE_RECURSIVE_MUTEXES && PLATFORM_BL_NEW
217+
ef_mutex = xSemaphoreCreateRecursiveMutex();
218+
#else
204219
ef_mutex = xSemaphoreCreateMutex();
220+
#endif
221+
222+
#if PLATFORM_BL_NEW
223+
int ret;
224+
__attribute__((aligned(32))) bflb_mtd_info_t info;
225+
226+
ret = bflb_mtd_open(BFLB_MTD_PARTITION_NAME_PSM, &handle, BFLB_MTD_OPEN_FLAG_BUSADDR);
227+
if(ret < 0)
228+
{
229+
EF_INFO("[EF] [PART] [XIP] error when get PSM partition %d\r\n", ret);
230+
puts("[EF] [PART] [XIP] Dead Loop. Reason: no Valid PSM partition found\r\n");
231+
while(1)
232+
{
233+
}
234+
}
235+
memset(&info, 0, sizeof(info));
236+
bflb_mtd_info(handle, &info);
237+
EF_INFO("[EF] Found Valid PSM partition, XIP Addr %08x, flash addr %08x, size %d\r\n",
238+
info.xip_addr,
239+
info.offset,
240+
info.size
241+
);
242+
if(info.size < 8 * 1024)
243+
{
244+
printf("[ERROR]psm partition is less than 8k,easyflash can not work!");
245+
while(1);
246+
}
247+
ENV_AREA_SIZE = (info.size / EF_ERASE_MIN_SIZE) * EF_ERASE_MIN_SIZE;
248+
SECTOR_NUM = ENV_AREA_SIZE / EF_ERASE_MIN_SIZE;
249+
printf("ENV AREA SIZE %ld, SECTOR NUM %ld\r\n", ENV_AREA_SIZE, SECTOR_NUM);
250+
251+
printf("*default_env_size = 0x%08x\r\n", *default_env_size);
252+
#endif
205253

206254
return result;
207255
}
@@ -244,6 +292,12 @@ EfErrCode ef_port_read(uint32_t addr, uint32_t* buf, size_t size)
244292
flash_read((char*)buf, (unsigned long)size, addr);
245293
hal_flash_unlock();
246294
return EF_NO_ERR;
295+
#elif PLATFORM_BL_NEW
296+
if(bflb_mtd_read(handle, addr, size, (uint8_t*)buf) < 0)
297+
{
298+
return EF_READ_ERR;
299+
}
300+
return EF_NO_ERR;
247301
#endif
248302
}
249303

@@ -325,6 +379,12 @@ EfErrCode ef_port_erase(uint32_t addr, size_t size)
325379

326380
return EF_NO_ERR;
327381

382+
#elif PLATFORM_BL_NEW
383+
if(bflb_mtd_erase(handle, addr, size) < 0)
384+
{
385+
return EF_ERASE_ERR;
386+
}
387+
return EF_NO_ERR;
328388
#endif
329389
return result;
330390
}
@@ -390,6 +450,12 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t* buf, size_t size)
390450

391451
hal_flash_unlock();
392452

453+
return EF_NO_ERR;
454+
#elif PLATFORM_BL_NEW
455+
if(bflb_mtd_write(handle, addr, size, (const uint8_t*)buf) < 0)
456+
{
457+
return EF_WRITE_ERR;
458+
}
393459
return EF_NO_ERR;
394460
#endif
395461
}
@@ -399,15 +465,23 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t* buf, size_t size)
399465
*/
400466
void ef_port_env_lock(void)
401467
{
468+
#if configUSE_RECURSIVE_MUTEXES && PLATFORM_BL_NEW
469+
xSemaphoreTakeRecursive(ef_mutex, 0xFFFFFFFF);
470+
#else
402471
xSemaphoreTake(ef_mutex, 0xFFFFFFFF);
472+
#endif
403473
}
404474

405475
/**
406476
* unlock the ENV ram cache
407477
*/
408478
void ef_port_env_unlock(void)
409479
{
480+
#if configUSE_RECURSIVE_MUTEXES && PLATFORM_BL_NEW
481+
xSemaphoreGiveRecursive(ef_mutex);
482+
#else
410483
xSemaphoreGive(ef_mutex);
484+
#endif
411485
}
412486

413487
/**

libraries/easyflash/src/ef_env.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
#define SECTOR_SIZE EF_ERASE_MIN_SIZE
115115
#define SECTOR_NUM (ENV_AREA_SIZE / (EF_ERASE_MIN_SIZE))
116116

117-
#if !WINDOWS && !LINUX
117+
#if !WINDOWS && !LINUX && !PLATFORM_BL_NEW
118118
#if (SECTOR_NUM < 2)
119119
#error "The sector number must lager then or equal to 2"
120120
#endif

platforms/BL602_ALT/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
gcc

0 commit comments

Comments
 (0)