Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bouffalolab] Enable -Wundef and fix compile error #29756

Merged
merged 6 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ bl_iot_sdk("sdk") {
"CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE=48",
]

defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
include_dirs += [ "${examples_plat_dir}/common/rpc" ]
defines += [ "PW_RPC_ENABLED=1" ]
defines += [ "DISABLE_PRINT=1" ]
} else if (chip_build_libshell) {
include_dirs += [ "${examples_plat_dir}/common/plat" ]
Expand All @@ -101,26 +101,20 @@ bouffalolab_executable("lighting_app") {
defines = [
"APP_TASK_STACK_SIZE=2044",
"CHIP_UART_BAUDRATE=${baudrate}",
"BL602_ENABLE=1",
"START_ENTRY=bfl_main",
"SYS_AOS_LOOP_ENABLE",
]

if (enable_debug_frame_ptr) {
defines += [ "CONF_ENABLE_FRAME_PTR=1" ]
}

if (false == enable_reset_counter) {
defines += [ "BOOT_PIN_RESET=8" ]
}

if (chip_enable_factory_data) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ]
}

if (chip_enable_factory_data_test) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ]
}
defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
defines +=
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
defines += [
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
]

bl_plat_name = "bl602"
sources = [
Expand All @@ -140,8 +134,8 @@ bouffalolab_executable("lighting_app") {
"${example_dir}/common/ZclCallbacks.cpp",
"${examples_plat_dir}/common/iot_sdk/aos_task.c",
"${examples_plat_dir}/common/iot_sdk/demo_pwm.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.c",
"${examples_plat_dir}/common/iot_sdk/uart.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.cpp",
"${examples_plat_dir}/common/iot_sdk/uart.cpp",
"${examples_plat_dir}/common/plat/LEDWidget.cpp",
"${examples_plat_dir}/common/plat/OTAConfig.cpp",
"${examples_plat_dir}/common/plat/main.cpp",
Expand All @@ -167,9 +161,10 @@ bouffalolab_executable("lighting_app") {
"${examples_plat_dir}/common/iot_sdk",
]

defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]
defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
defines += [
"PW_RPC_ENABLED",
"PW_RPC_ATTRIBUTE_SERVICE=1",
"PW_RPC_BUTTON_SERVICE=1",
"PW_RPC_DESCRIPTOR_SERVICE=1",
Expand Down Expand Up @@ -216,8 +211,6 @@ bouffalolab_executable("lighting_app") {
"${chip_root}/examples/common/pigweed/bouffalolab",
]
} else if (chip_build_libshell) {
defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ]

deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]

include_dirs += [
Expand All @@ -226,9 +219,9 @@ bouffalolab_executable("lighting_app") {
]
}

defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ]
if (enable_heap_monitoring) {
sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ]
defines += [ "HEAP_MONITORING=1" ]
}

cflags_c = [ "-Wno-sign-compare" ]
Expand Down
60 changes: 26 additions & 34 deletions examples/lighting-app/bouffalolab/bl702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,21 @@ bl_iot_sdk("sdk") {
"PRINT_DEBUG=0",
]

defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
include_dirs += [ "${examples_plat_dir}/common/rpc" ]
defines += [ "PW_RPC_ENABLED=1" ]
defines += [ "DISABLE_PRINT=1" ]
} else if (chip_build_libshell) {
include_dirs += [ "${examples_plat_dir}/common/plat" ]
} else {
if (chip_build_libshell) {
include_dirs += [ "${examples_plat_dir}/common/plat" ]
}
}

defines += [ "CHIP_DEVICE_CONFIG_ENABLE_ETHERNET=${chip_enable_ethernet}" ]

if (chip_enable_wifi || chip_enable_ethernet) {
include_dirs += [ "${examples_plat_dir}/bl702/lwipopts" ]
}

defines += [ "CHIP_DEVICE_CONFIG_ENABLE_ETHERNET=${chip_enable_ethernet}" ]
if (chip_enable_ethernet) {
defines += [ "CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE=48" ]
}
Expand Down Expand Up @@ -133,14 +134,15 @@ bouffalolab_executable("lighting_app") {
defines = [
"APP_TASK_STACK_SIZE=2048",
"CHIP_UART_BAUDRATE=${baudrate}",
"BL702_ENABLE=1",
"START_ENTRY=bl702_main",
]

if (enable_debug_frame_ptr) {
defines += [ "CONF_ENABLE_FRAME_PTR=1" ]
}

defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
defines +=
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
defines += [
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
]
if (chip_config_network_layer_ble) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ]
}
Expand All @@ -149,14 +151,6 @@ bouffalolab_executable("lighting_app") {
defines += [ "BOOT_PIN_RESET=31" ]
}

if (chip_enable_factory_data) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ]
}

if (chip_enable_factory_data_test) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ]
}

if ("XT-ZB6-DevKit" == board) {
defines += [ "XT_ZB6_DevKit" ]
} else if ("BL706-NIGHT-LIGHT" == board) {
Expand All @@ -168,8 +162,8 @@ bouffalolab_executable("lighting_app") {
"${example_dir}/common/ZclCallbacks.cpp",
"${examples_plat_dir}/common/iot_sdk/aos_task.c",
"${examples_plat_dir}/common/iot_sdk/demo_pwm.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.c",
"${examples_plat_dir}/common/iot_sdk/uart.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.cpp",
"${examples_plat_dir}/common/iot_sdk/uart.cpp",
"${examples_plat_dir}/common/plat/LEDWidget.cpp",
"${examples_plat_dir}/common/plat/OTAConfig.cpp",
"${examples_plat_dir}/common/plat/main.cpp",
Expand All @@ -196,10 +190,6 @@ bouffalolab_executable("lighting_app") {
include_dirs += [ "${examples_plat_dir}/bl702/lwipopts" ]
}

if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
}

if (defined(enable_cdc_module) && enable_cdc_module) {
defines += [ "CFG_USB_CDC_ENABLE" ]
}
Expand Down Expand Up @@ -238,9 +228,10 @@ bouffalolab_executable("lighting_app") {
}
}

defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]
defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
defines += [
"PW_RPC_ENABLED=1",
"PW_RPC_ATTRIBUTE_SERVICE=1",
"PW_RPC_BUTTON_SERVICE=1",
"PW_RPC_DESCRIPTOR_SERVICE=1",
Expand Down Expand Up @@ -289,23 +280,24 @@ bouffalolab_executable("lighting_app") {
"${chip_root}/examples/common",
"${chip_root}/examples/common/pigweed/bouffalolab",
]
} else if (chip_build_libshell) {
defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]

include_dirs += [
"${chip_root}/src/lib/shell",
"${chip_root}/examples/shell/shell_common/include",
]
} else {
if (chip_build_libshell) {
include_dirs += [
"${chip_root}/src/lib/shell",
"${chip_root}/examples/shell/shell_common/include",
]

deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
}
}

defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ]
if (enable_heap_monitoring) {
sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ]
defines += [ "HEAP_MONITORING=1" ]
}

if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
ldscript = "${examples_plat_dir}/bl702/ldscripts/psram_flash.ld"
} else {
ldscript = "${examples_plat_dir}/bl702/ldscripts/flash.ld"
Expand Down
51 changes: 21 additions & 30 deletions examples/lighting-app/bouffalolab/bl702l/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ bl_iot_sdk("sdk") {
"PRINT_DEBUG=0",
]

defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
include_dirs += [ "${examples_plat_dir}/common/rpc" ]
defines += [ "PW_RPC_ENABLED=1" ]
defines += [ "DISABLE_PRINT=1" ]
} else if (chip_build_libshell) {
include_dirs += [ "${examples_plat_dir}/common/plat" ]
Expand Down Expand Up @@ -111,14 +111,15 @@ bouffalolab_executable("lighting_app") {
defines = [
"APP_TASK_STACK_SIZE=2048",
"CHIP_UART_BAUDRATE=${baudrate}",
"BL702L_ENABLE=1",
"START_ENTRY=bl702_main",
]

if (enable_debug_frame_ptr) {
defines += [ "CONF_ENABLE_FRAME_PTR=1" ]
}

defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ]
defines +=
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
defines += [
"CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}",
]
if (chip_config_network_layer_ble) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ]
}
Expand All @@ -127,14 +128,6 @@ bouffalolab_executable("lighting_app") {
defines += [ "BOOT_PIN_RESET=16" ]
}

if (chip_enable_factory_data) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ]
}

if (chip_enable_factory_data_test) {
defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ]
}

if ("BL704LDK" == board) {
defines += [ "XT_ZB6_DevKit" ]
}
Expand All @@ -144,8 +137,8 @@ bouffalolab_executable("lighting_app") {
"${example_dir}/common/ZclCallbacks.cpp",
"${examples_plat_dir}/common/iot_sdk/aos_task.c",
"${examples_plat_dir}/common/iot_sdk/demo_pwm.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.c",
"${examples_plat_dir}/common/iot_sdk/uart.c",
"${examples_plat_dir}/common/iot_sdk/platform_port.cpp",
"${examples_plat_dir}/common/iot_sdk/uart.cpp",
"${examples_plat_dir}/common/plat/LEDWidget.cpp",
"${examples_plat_dir}/common/plat/OTAConfig.cpp",
"${examples_plat_dir}/common/plat/main.cpp",
Expand All @@ -168,10 +161,6 @@ bouffalolab_executable("lighting_app") {
"${examples_plat_dir}/common/iot_sdk",
]

if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
}

if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
Expand Down Expand Up @@ -201,9 +190,10 @@ bouffalolab_executable("lighting_app") {
]
}

defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]
defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
if (chip_enable_pw_rpc) {
defines += [
"PW_RPC_ENABLED=1",
"PW_RPC_ATTRIBUTE_SERVICE=1",
"PW_RPC_BUTTON_SERVICE=1",
"PW_RPC_DESCRIPTOR_SERVICE=1",
Expand Down Expand Up @@ -252,23 +242,24 @@ bouffalolab_executable("lighting_app") {
"${chip_root}/examples/common",
"${chip_root}/examples/common/pigweed/bouffalolab",
]
} else if (chip_build_libshell) {
defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]

deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
} else {
if (chip_build_libshell) {
include_dirs += [
"${chip_root}/src/lib/shell",
"${chip_root}/examples/shell/shell_common/include",
]

include_dirs += [
"${chip_root}/src/lib/shell",
"${chip_root}/examples/shell/shell_common/include",
]
deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
}
}

defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ]
if (enable_heap_monitoring) {
sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ]
defines += [ "HEAP_MONITORING=1" ]
}

if (enable_psram) {
defines += [ "CFG_USE_PSRAM=1" ]
ldscript = "${examples_plat_dir}/bl702l/ldscripts/psram_flash_rom.ld"
} else {
ldscript = "${examples_plat_dir}/bl702l/ldscripts/flash_rom.ld"
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/bouffalolab/common/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void AppTask::AppTaskMain(void * pvParameter)
app_event_t appEvent;
bool onoff = false;

#if !(BL702_ENABLE && CHIP_DEVICE_CONFIG_ENABLE_ETHERNET)
#if !(CHIP_DEVICE_LAYER_TARGET_BL702 && CHIP_DEVICE_CONFIG_ENABLE_ETHERNET)
sLightLED.Init();
#endif

Expand Down
3 changes: 3 additions & 0 deletions examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ a lot of data that needs to be copied, this should be set high. */
#define LWIP_NETIF_LINK_CALLBACK 1

/*Enable dns*/
#define LWIP_DNS_SERVER 0
#define LWIP_DNS 1
#define LWIP_DNS_SECURE 0

Expand All @@ -271,6 +272,8 @@ a lot of data that needs to be copied, this should be set high. */
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN)

#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)

/*
---------------------------------
---------- MISC. options ----------
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/bouffalolab/bl702/lwipopts/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ a lot of data that needs to be copied, this should be set high. */
#define LWIP_NETIF_LINK_CALLBACK 1

/*Enable dns*/
#define LWIP_DNS_SERVER 0
#define LWIP_DNS 1
#define LWIP_DNS_SECURE 0

Expand All @@ -283,6 +284,7 @@ a lot of data that needs to be copied, this should be set high. */
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN)

#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)
/*
---------------------------------
---------- MISC. options ----------
Expand Down
Loading
Loading