Skip to content

Commit 1834732

Browse files
BL616
1 parent 6a04d82 commit 1834732

37 files changed

Lines changed: 1940 additions & 41 deletions

.github/workflows/workflow.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ jobs:
203203
- platform: OpenLN8825
204204
variant: default
205205
gcc: apt
206+
- platform: OpenBL616
207+
variant: default
206208

207209
# extras for BK7231T
208210
- 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

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,15 @@ 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+
394403
prebuild_OpenRDA5981: berry
395404
ifdef GITHUB_ACTIONS
396405
# just so that there would be no cache error
@@ -746,6 +755,13 @@ OpenRDA5981: prebuild_OpenRDA5981
746755
./sdk/OpenRDA5981/ota_lzma/xz --format=lzma -A -z -k -v -c sdk/OpenRDA5981/.build/OpenBeken.bin > sdk/OpenRDA5981/.build/OpenBeken.bin.lzma
747756
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)
748757

758+
.PHONY: OpenBL616
759+
OpenBL616: prebuild_OpenBL616
760+
cd ./platforms/BL616 && PATH="$(PATH):$(PWD)/platforms/BL616/gcc/bin" $(MAKE) CHIP=bl616 BOARD=bl616dk APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT)
761+
mkdir -p output/$(APP_VERSION)
762+
cp ./platforms/BL616/build/build_out/OpenBeken_bl616.bin output/$(APP_VERSION)/OpenBL616_${APP_VERSION}.bin
763+
cp ./platforms/BL616/build/build_out/OpenBeken_bl616.xz.ota output/$(APP_VERSION)/OpenBL616_${APP_VERSION}_OTA.bin.xz.ota
764+
749765
# Add custom Makefile if required
750766
-include custom.mk
751767

@@ -783,6 +799,7 @@ clean:
783799
-test -d ./platforms/ESP8266/build && cmake --build ./platforms/ESP8266/build --target clean
784800
-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
785801
-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
802+
-test -d ./platforms/BL616/build && $(MAKE) -C ./platforms/BL616 clean
786803
-test -d ./sdk/OpenBK7231T && $(MAKE) -C sdk/OpenBK7231T/platforms/bk7231t/bk7231t_os APP_BIN_NAME=$(APP_NAME) USER_SW_VER=$(APP_VERSION) clean
787804
-test -d ./sdk/OpenBK7231N && $(MAKE) -C sdk/OpenBK7231N/platforms/bk7231n/bk7231n_os APP_BIN_NAME=$(APP_NAME) USER_SW_VER=$(APP_VERSION) clean
788805
-$(RM) -r $(BUILD_DIR)

docs/platforms.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@
66
| BK7238 | Beken ||||||||||||
77
| BK7252 | Beken ||| ⚠️¹'¹⁴ |||||||||
88
| BK7252N | Beken ||||||||||||
9-
| XR809 | XRadio ||| ||| ✅⁸ ||||| |
10-
| XR806 | XRadio |||||| ✅⁸ ||||| |
11-
| XR872/XF16 | XRadio ||| ✅² ||| ✅⁸ ||||| |
9+
| XR809 | XRadio ||| ❗️||| ✅⁸ ||||| ❓⁹ |
10+
| XR806 | XRadio |||||| ✅⁸ ||||| ❓⁹ |
11+
| XR872/XF16 | XRadio ||| ✅² ||| ✅⁸ ||||| ❓⁹ |
1212
| BL602/LF686 | Bouffalo Lab ||| ✅⁴ |||||||||
13-
| W800/W801 | Winner Micro ||||||||||| |
14-
| W600/W601 | Winner Micro |||||||||| ✅⁶ | |
13+
| W800/W801 | Winner Micro ||||||||||| |
14+
| W600/W601 | Winner Micro |||||||||| ✅⁶ | |
1515
| 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 ||| ❗️³'||| ✅⁸ |||| | |
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 ||| ||| ✅⁸ ||| | | ⚠️⁹ |
1919
| RTL8711AM (Ameba1) | Realtek || ❗️ | ✅⁴ ||| ✅⁸ ||||| ❓⁶ |
20-
| RTL8710B (AmebaZ) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| ⚠️|
20+
| RTL8710B (AmebaZ) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| |
2121
| 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 |||||| ✅⁸ | ❗️ | ❗️¹¹ || | |
22+
| RTL8720D (AmebaD)<br>RTL872xCSM<br>RTL8720CS (AmebaCS) | Realtek ||| ✅⁴ ||| ✅⁸ ||||| |
23+
| RTL8721DA<br>RTL8711DAF (AmebaDplus) | Realtek ||||||||||| |
24+
| RTL8720E<br>RTL8710ECF (AmebaLite) | Realtek ||||||||||| |
25+
| ECR6600 | ESWIN |||||| ✅⁸ | ❗️ | ❗️¹¹ || | |
2626
| TXW81X | Taixin ||| ❗️ |||||||||
2727
| RDA5981 | RDA ||||||||||||
28-
| LN8825B | Lightning Semi ||||||||||||
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>

platforms/BL616/.gitignore

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

platforms/BL616/CMakeLists.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
find_package(bouffalo_sdk REQUIRED HINTS $ENV{BL_SDK_BASE})
4+
5+
sdk_set_main_file(main.c)
6+
7+
sdk_add_compile_definitions(
8+
-DPLATFORM_BL_NEW=1
9+
-DPLATFORM_BL616=1
10+
)
11+
sdk_add_compile_options(
12+
-Os
13+
-Wno-undef
14+
-Wno-unused-variable
15+
-Wno-return-type
16+
-g0
17+
)
18+
19+
if(DEFINED ENV{APP_VERSION})
20+
sdk_add_compile_definitions(-DUSER_SW_VER="$ENV{APP_VERSION}")
21+
endif()
22+
if(DEFINED ENV{OBK_VARIANT})
23+
sdk_add_compile_definitions(-DOBK_VARIANT=$ENV{OBK_VARIANT})
24+
endif()
25+
26+
set(SDK_CJSON true)
27+
set(SDK_LFS true)
28+
set(OBK_SRCS "../../src/")
29+
include($ENV{BL_SDK_BASE}/../../platforms/obk_main.cmake)
30+
31+
sdk_add_include_directories(.)
32+
target_sources(app PRIVATE
33+
# ${OBK_SRCS}hal/bl_new/hal_adc_bl_new.c
34+
${OBK_SRCS}hal/bl_new/hal_flashConfig_bl_new.c
35+
${OBK_SRCS}hal/bl_new/hal_flashVars_bl_new.c
36+
${OBK_SRCS}hal/bl_new/hal_generic_bl_new.c
37+
${OBK_SRCS}hal/bl_new/hal_hwtimer_bl_new.c
38+
# ${OBK_SRCS}hal/bl_new/hal_main_bl_new.c
39+
${OBK_SRCS}hal/bl_new/hal_pins_bl_new.c
40+
${OBK_SRCS}hal/bl_new/hal_wifi_bl_new.c
41+
# ${OBK_SRCS}hal/bl_new/hal_uart_bl_new.c
42+
${OBK_SRCS}hal/bl_new/hal_ota_bl_new.c
43+
${OBKM_SRC}
44+
${OBKM_SRC_CXX}
45+
${BERRY_SRC_C}
46+
../../libraries/mqtt_patched.c)
47+
48+
project(OpenBeken)

platforms/BL616/FreeRTOSConfig.h

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/*
2+
* FreeRTOS Kernel V10.2.1
3+
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*
25+
* 1 tab == 4 spaces!
26+
*/
27+
28+
#ifndef FREERTOS_CONFIG_H
29+
#define FREERTOS_CONFIG_H
30+
31+
/*-----------------------------------------------------------
32+
* Application specific definitions.
33+
*
34+
* These definitions should be adjusted for your particular hardware and
35+
* application requirements.
36+
*
37+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
38+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
39+
*
40+
* See http://www.freertos.org/a00110.html.
41+
*----------------------------------------------------------*/
42+
#include "stdio.h"
43+
44+
#if defined(BL602) || defined(BL702) || defined(BL702L)
45+
#define configMTIME_BASE_ADDRESS (0x02000000UL + 0xBFF8UL)
46+
#define configMTIMECMP_BASE_ADDRESS (0x02000000UL + 0x4000UL)
47+
#else
48+
#if __riscv_xlen == 64
49+
#define configMTIME_BASE_ADDRESS (0)
50+
#define configMTIMECMP_BASE_ADDRESS ((0xE4000000UL) + 0x4000UL)
51+
#else
52+
#define configMTIME_BASE_ADDRESS ((0xE0000000UL) + 0xBFF8UL)
53+
#define configMTIMECMP_BASE_ADDRESS ((0xE0000000UL) + 0x4000UL)
54+
#endif
55+
#endif
56+
#define configSUPPORT_STATIC_ALLOCATION 1
57+
#define configUSE_PREEMPTION 1
58+
#define configUSE_IDLE_HOOK 1
59+
#define configUSE_TICK_HOOK 0
60+
#define configCPU_CLOCK_HZ ((uint32_t)(1 * 1000 * 1000))
61+
#define configTICK_RATE_HZ ((TickType_t)1000)
62+
#define configMAX_PRIORITIES (32)
63+
#define configMINIMAL_STACK_SIZE ((unsigned short)128) /* Only needs to be this high as some demo tasks also use this constant. In production only the idle task would use this. */
64+
#define configTOTAL_HEAP_SIZE ((size_t)100 * 1024)
65+
#define configMAX_TASK_NAME_LEN (16)
66+
#define configUSE_TRACE_FACILITY 1
67+
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
68+
#define configUSE_16_BIT_TICKS 0
69+
#define configIDLE_SHOULD_YIELD 0
70+
#define configUSE_MUTEXES 1
71+
#define configQUEUE_REGISTRY_SIZE 8
72+
#define configCHECK_FOR_STACK_OVERFLOW 2
73+
#define configUSE_RECURSIVE_MUTEXES 1
74+
#define configUSE_MALLOC_FAILED_HOOK 1
75+
#define configUSE_APPLICATION_TASK_TAG 1
76+
#define configUSE_COUNTING_SEMAPHORES 1
77+
#define configGENERATE_RUN_TIME_STATS 0
78+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
79+
#define configUSE_TICKLESS_IDLE 0
80+
#define configUSE_POSIX_ERRNO 1
81+
82+
/* Co-routine definitions. */
83+
#define configUSE_CO_ROUTINES 0
84+
#define configMAX_CO_ROUTINE_PRIORITIES (2)
85+
86+
/* Software timer definitions. */
87+
#define configUSE_TIMERS 1
88+
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
89+
#define configTIMER_QUEUE_LENGTH 4
90+
#define configTIMER_TASK_STACK_DEPTH (1024)
91+
92+
/* Task priorities. Allow these to be overridden. */
93+
#ifndef uartPRIMARY_PRIORITY
94+
#define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
95+
#endif
96+
97+
/* Set the following definitions to 1 to include the API function, or zero
98+
to exclude the API function. */
99+
#define INCLUDE_vTaskPrioritySet 1
100+
#define INCLUDE_uxTaskPriorityGet 1
101+
#define INCLUDE_vTaskDelete 1
102+
#define INCLUDE_vTaskCleanUpResources 1
103+
#define INCLUDE_vTaskSuspend 1
104+
#define INCLUDE_vTaskDelayUntil 1
105+
#define INCLUDE_vTaskDelay 1
106+
#define INCLUDE_eTaskGetState 1
107+
#define INCLUDE_xTimerPendFunctionCall 1
108+
#define INCLUDE_xTaskAbortDelay 1
109+
#define INCLUDE_xTaskGetHandle 1
110+
#define INCLUDE_xSemaphoreGetMutexHolder 1
111+
112+
/* Normal assert() semantics without relying on the provision of an assert.h
113+
header file. */
114+
void vApplicationMallocFailedHook(void);
115+
void vAssertCalled(void);
116+
#define configASSERT(x) \
117+
if ((x) == 0) { \
118+
printf("file [%s]\r\n", __FILE__); \
119+
printf("func [%s]\r\n", __FUNCTION__); \
120+
printf("line [%d]\r\n", __LINE__); \
121+
printf("%s\r\n", (const char *)(#x)); \
122+
vAssertCalled(); \
123+
}
124+
125+
#if (configUSE_TICKLESS_IDLE != 0)
126+
void vApplicationSleep(uint32_t xExpectedIdleTime);
127+
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime)
128+
#endif
129+
130+
// #define portUSING_MPU_WRAPPERS
131+
132+
/* Enable TLS */
133+
#define config_ENABLE_OS_TLS_SWITCH
134+
#ifdef config_ENABLE_OS_TLS_SWITCH
135+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1
136+
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
137+
#endif
138+
139+
#endif /* FREERTOS_CONFIG_H */

platforms/BL616/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mainmenu "SDK Configuration"
2+
3+
source "$BL_SDK_BASE/Kconfig"
4+

platforms/BL616/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SDK_DEMO_PATH ?= $(abspath .)
2+
BL_SDK_BASE ?= $(abspath ./../../sdk/bouffalo_sdk)
3+
4+
export BL_SDK_BASE
5+
6+
CROSS_COMPILE ?= riscv64-unknown-elf-
7+
8+
include $(BL_SDK_BASE)/project.build

platforms/BL616/defconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CONFIG_NEWLIB = n
2+
CONFIG_NEWLIB_STANDARD = n
3+
4+
CONFIG_VSNPRINTF_NANO = n
5+
CONFIG_VSNPRINTF_FLOAT = y
6+
CONFIG_VSNPRINTF_FLOAT_EX = y
7+
CONFIG_VSNPRINTF_LONG_LONG = y
8+
9+
CONFIG_FREERTOS = y
10+
11+
CONFIG_BFLB_MTD = y
12+
CONFIG_BFLB_OTA = y
13+
CONFIG_PARTITION = y
14+
CONFIG_FOTA = y
15+
CONFIG_LWIP = y
16+
CONFIG_RF = y
17+
CONFIG_MBEDTLS = y
18+
CONFIG_DHCPD = y
19+
CONFIG_WIFI6 = y
20+
CONFIG_MACSW_SELECT = default
21+
CONFIG_FHOST = y
22+
CONFIG_SHELL = y
23+
#CONFIG_TLSF = y
24+
CONFIG_PWRMGMT = y
25+
CONFIG_COREDUMP = n
26+
CONFIG_COREDUMP_V2 = n
27+
CONFIG_LITTLEFS = y
28+
CONFIG_BACKTRACE = n

0 commit comments

Comments
 (0)