Skip to content

Commit fd20832

Browse files
committed
[Bouffalo Lab] Update Bouffalo SDK to bouffalolab_release_bl_iot_sdk_1.6.40-2000-gb17d51bc3
1 parent 82579f1 commit fd20832

40 files changed

+1112
-995
lines changed

examples/lighting-app/bouffalolab/README.md

+107-153
Large diffs are not rendered by default.

examples/lighting-app/bouffalolab/bl602/BUILD.gn

-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ bouffalolab_executable("lighting_app") {
110110
defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
111111
defines +=
112112
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
113-
defines += [
114-
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
115-
]
116113

117114
bl_plat_name = "bl602"
118115
sources = [

examples/lighting-app/bouffalolab/bl602/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pw_assert_BACKEND = "$dir_pw_assert_log"
2424
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
2525

2626
chip_detail_logging = false
27+
#is_debug = false
2728

2829
pw_build_LINK_DEPS = [
2930
"$dir_pw_assert:impl",

examples/lighting-app/bouffalolab/bl702/BUILD.gn

-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ bouffalolab_executable("lighting_app") {
138138
defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
139139
defines +=
140140
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
141-
defines += [
142-
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
143-
]
144141
if (chip_config_network_layer_ble) {
145142
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ]
146143
}

examples/lighting-app/bouffalolab/bl702/args.gni

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pw_assert_BACKEND = "$dir_pw_assert_log"
2424
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
2525

2626
chip_detail_logging = false
27+
# use -Os instead of -Og
28+
is_debug = false
2729

2830
pw_build_LINK_DEPS = [
2931
"$dir_pw_assert:impl",

examples/lighting-app/bouffalolab/bl702l/BUILD.gn

-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ bouffalolab_executable("lighting_app") {
115115
defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
116116
defines +=
117117
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
118-
defines += [
119-
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
120-
]
121118
if (chip_config_network_layer_ble) {
122119
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ]
123120
}

examples/lighting-app/bouffalolab/bl702l/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pw_assert_BACKEND = "$dir_pw_assert_log"
2424
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
2525

2626
chip_detail_logging = false
27+
is_debug = false
2728

2829
pw_build_LINK_DEPS = [
2930
"$dir_pw_assert:impl",

examples/lighting-app/bouffalolab/common/AppTask.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <credentials/DeviceAttestationCredsProvider.h>
2626
#include <credentials/examples/DeviceAttestationCredsExample.h>
2727
#include <system/SystemClock.h>
28+
#include <platform/bouffalolab/common/DiagnosticDataProviderImpl.h>
2829

2930
#if HEAP_MONITORING
3031
#include "MemMonitoring.h"
@@ -134,6 +135,7 @@ void AppTask::AppTaskMain(void * pvParameter)
134135
{
135136
app_event_t appEvent;
136137
bool onoff = false;
138+
uint64_t currentHeapFree = 0;
137139

138140
#if !(CHIP_DEVICE_LAYER_TARGET_BL702 && CHIP_DEVICE_CONFIG_ENABLE_ETHERNET)
139141
sLightLED.Init();
@@ -184,7 +186,8 @@ void AppTask::AppTaskMain(void * pvParameter)
184186

185187
vTaskSuspend(NULL);
186188

187-
ChipLogProgress(NotSpecified, "App Task started, with SRAM heap %d left\r\n", xPortGetFreeHeapSize());
189+
DiagnosticDataProviderImpl::GetDefaultInstance().GetCurrentHeapFree(currentHeapFree);
190+
ChipLogProgress(NotSpecified, "App Task started, with SRAM heap %lld left\r\n",currentHeapFree);
188191

189192
while (true)
190193
{

examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ a lot of data that needs to be copied, this should be set high. */
264264
#define LWIP_IPV6_DHCP6 1
265265
#define LWIP_AUTOIP 1
266266
#define LWIP_IPV6_MLD 1
267-
#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 1
267+
#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
268268
#define LWIP_HOOK_FILENAME "bl_lwip_hooks.h"
269269

270270
#define LWIP_NETIF_EXT_STATUS_CALLBACK 1

examples/platform/bouffalolab/bl702l/FreeRTOSConfig.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ to exclude the API function. */
159159
/* Normal assert() semantics without relying on the provision of an assert.h
160160
header file. */
161161
#ifdef __cplusplus
162-
extern "C" void (*vAssertCalled)(void);
162+
extern "C" void vAssertCalled(void);
163163
#else
164-
extern void (*vAssertCalled)(void);
164+
extern void vAssertCalled(void);
165165
#endif
166166
#define configASSERT(x) \
167167
if ((x) == 0) \
@@ -182,9 +182,9 @@ Like all task stack sizes, the value is the number of words, not bytes. */
182182
#if (configUSE_TICKLESS_IDLE != 0)
183183
#include "portmacro.h"
184184
#ifdef __cplusplus
185-
extern "C" void (*vApplicationSleep)(TickType_t xExpectedIdleTime);
185+
extern "C" void vApplicationSleep(TickType_t xExpectedIdleTime);
186186
#else
187-
extern void (*vApplicationSleep)(TickType_t xExpectedIdleTime);
187+
extern void vApplicationSleep(TickType_t xExpectedIdleTime);
188188
#endif
189189
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime)
190190
#endif

examples/platform/bouffalolab/bl702l/ldscripts/psram_flash_rom.ld

-3
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,4 @@ SECTIONS
297297

298298
/* rom driver */
299299
INCLUDE ../../third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/romdriver.ld
300-
301-
/* rom data & code */
302-
INCLUDE ../../third_party/bouffalolab/repo/components/platform/soc/bl702l/bl702l/evb/ld/rom_map.ld
303300
}

examples/platform/bouffalolab/common/iot_sdk/platform_port.cpp

+2-74
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ extern "C" {
5656
#elif CHIP_DEVICE_LAYER_TARGET_BL702L
5757
#include <bl_flash.h>
5858
#endif
59-
60-
#if CHIP_DEVICE_LAYER_TARGET_BL702L
61-
#include <rom_freertos_ext.h>
62-
#include <rom_hal_ext.h>
63-
#include <rom_lmac154_ext.h>
64-
#endif
6559
}
6660

6761
#include <uart.h>
@@ -85,7 +79,6 @@ extern "C" unsigned int sleep(unsigned int seconds)
8579
return 0;
8680
}
8781

88-
#if !CHIP_DEVICE_LAYER_TARGET_BL702L
8982
extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName)
9083
{
9184
printf("Stack Overflow checked. Stack name %s", pcTaskName);
@@ -169,9 +162,7 @@ extern "C" void vAssertCalled(void)
169162
{
170163
void * ra = (void *) __builtin_return_address(0);
171164

172-
#if CONF_ENABLE_FRAME_PTR == 0
173165
taskDISABLE_INTERRUPTS();
174-
#endif
175166

176167
if (xPortIsInsideInterrupt())
177168
{
@@ -182,65 +173,13 @@ extern "C" void vAssertCalled(void)
182173
printf("vAssertCalled, ra = %p in task %s\r\n", (void *) ra, pcTaskGetName(NULL));
183174
}
184175

185-
#if CONF_ENABLE_FRAME_PTR
186176
portABORT();
187-
#endif
188177

189-
while (true)
190-
;
178+
while (true) ;
191179
}
192-
#endif
193-
194-
#if CHIP_DEVICE_LAYER_TARGET_BL702L
195-
extern "C" void __attribute__((weak)) user_vAssertCalled(void)
196-
{
197-
void * ra = (void *) __builtin_return_address(0);
198-
199-
taskDISABLE_INTERRUPTS();
200-
201-
if (xPortIsInsideInterrupt())
202-
{
203-
printf("vAssertCalled, ra = %p in ISR\r\n", (void *) ra);
204-
}
205-
else
206-
{
207-
printf("vAssertCalled, ra = %p in task %s\r\n", (void *) ra, pcTaskGetName(NULL));
208-
}
209180

210-
while (true)
211-
;
212-
}
213-
214-
extern "C" void __attribute__((weak)) user_vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName)
215-
{
216-
puts("Stack Overflow checked\r\n");
217-
if (pcTaskName)
218-
{
219-
printf("Stack name %s\r\n", pcTaskName);
220-
}
221-
while (1)
222-
{
223-
/*empty here*/
224-
}
225-
}
226-
227-
extern "C" void __attribute__((weak)) user_vApplicationMallocFailedHook(void)
228-
{
229-
printf("Memory Allocate Failed. Current left size is %d bytes\r\n", xPortGetFreeHeapSize());
230-
#if defined(CFG_USE_PSRAM)
231-
printf("Current psram left size is %d bytes\r\n", xPortGetFreeHeapSizePsram());
232-
#endif
233-
while (1)
234-
{
235-
/*empty here*/
236-
}
237-
}
238-
239-
extern "C" void bflb_assert(void) __attribute__((weak, alias("user_vAssertCalled")));
240-
#else
241181
extern "C" void user_vAssertCalled(void) __attribute__((weak, alias("vAssertCalled")));
242182
extern "C" void bflb_assert(void) __attribute__((weak, alias("vAssertCalled")));
243-
#endif
244183

245184
// ================================================================================
246185
// Main Code
@@ -336,16 +275,8 @@ extern "C" void setup_heap()
336275
{
337276
bl_sys_init();
338277

339-
#if CHIP_DEVICE_LAYER_TARGET_BL702
340-
bl_sys_em_config();
341-
#elif CHIP_DEVICE_LAYER_TARGET_BL702L
278+
#if CHIP_DEVICE_LAYER_TARGET_BL702 || CHIP_DEVICE_LAYER_TARGET_BL702L
342279
bl_sys_em_config();
343-
344-
// Initialize rom data
345-
extern uint8_t _rom_data_run;
346-
extern uint8_t _rom_data_load;
347-
extern uint8_t _rom_data_size;
348-
memcpy((void *) &_rom_data_run, (void *) &_rom_data_load, (size_t) &_rom_data_size);
349280
#endif
350281

351282
#if CHIP_DEVICE_LAYER_TARGET_BL702
@@ -376,9 +307,6 @@ extern "C" void app_init(void)
376307

377308
#if CHIP_DEVICE_LAYER_TARGET_BL702L
378309
bl_flash_init();
379-
380-
rom_freertos_init(256, 400);
381-
rom_hal_init();
382310
#endif
383311

384312
hosal_uart_init(&uart_stdio);

examples/platform/bouffalolab/common/plat/OTAConfig.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <app/server/Server.h>
2121

2222
#include <platform/bouffalolab/common/OTAImageProcessorImpl.h>
23+
2324
// Global OTA objects
2425
chip::DefaultOTARequestor gRequestorCore;
2526
chip::DefaultOTARequestorStorage gRequestorStorage;

examples/platform/bouffalolab/common/plat/platform.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include <uart.h>
4343
#endif
4444

45-
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE || CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST
45+
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE
4646
#include <platform/bouffalolab/common/FactoryDataProvider.h>
4747
#endif
4848

@@ -87,7 +87,7 @@ chip::app::Clusters::NetworkCommissioning::Instance
8787
}
8888
#endif
8989

90-
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE || CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST
90+
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE
9191
namespace {
9292
FactoryDataProvider sFactoryDataProvider;
9393
}
@@ -180,7 +180,7 @@ void UnlockOpenThreadTask(void)
180180
CHIP_ERROR PlatformManagerImpl::PlatformInit(void)
181181
{
182182
chip::RendezvousInformationFlags rendezvousMode(chip::RendezvousInformationFlag::kOnNetwork);
183-
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE || CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST
183+
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE
184184
CHIP_ERROR retFactoryData = sFactoryDataProvider.Init();
185185
#endif
186186

@@ -213,15 +213,14 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void)
213213
#else
214214
ReturnLogErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice));
215215
#endif
216-
217216
#endif
218217

219218
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
220219
ReturnLogErrorOnFailure(sWiFiNetworkCommissioningInstance.Init());
221220
#endif
222221

223222
// Initialize device attestation config
224-
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE || CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST
223+
#if CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE
225224
if (CHIP_NO_ERROR == retFactoryData)
226225
{
227226
SetDeviceInstanceInfoProvider(&sFactoryDataProvider);

examples/platform/bouffalolab/common/route_hook/bl_route_hook.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdbool.h>
22
#include <string.h>
33

4+
#include <lwip/tcpip.h>
45
#include "lwip/icmp6.h"
56
#include "lwip/mld6.h"
67
#include "lwip/netif.h"
@@ -158,25 +159,30 @@ int8_t bl_route_hook_init(void)
158159
uint8_t ret = 0;
159160
struct netif * lwip_netif = deviceInterface_getNetif();
160161

162+
LOCK_TCPIP_CORE();
163+
161164
if (lwip_netif == NULL)
162165
{
163166
printf("Invalid network interface\r\n");
164-
return -1;
167+
ret = -1;
168+
goto exit;
165169
}
166170

167171
for (bl_route_hook_t * iter = s_hooks; iter != NULL; iter++)
168172
{
169173
if (iter->netif == lwip_netif)
170174
{
171-
return 0;
175+
ret = 0;
176+
break;
172177
}
173178
}
174179

175180
hook = (bl_route_hook_t *) malloc(sizeof(bl_route_hook_t));
176181
if (hook == NULL)
177182
{
178183
printf("Cannot allocate hook\r\n");
179-
return -1;
184+
ret = -1;
185+
goto exit;
180186
}
181187

182188
if (mld6_joingroup_netif(lwip_netif, ip_2_ip6(&router_group)) != ERR_OK)
@@ -202,5 +208,7 @@ int8_t bl_route_hook_init(void)
202208
{
203209
free(hook);
204210
}
211+
UNLOCK_TCPIP_CORE();
212+
205213
return ret;
206214
}

0 commit comments

Comments
 (0)