From e82b9d746d092712cfb5467ab1f8fc94fba5fafb Mon Sep 17 00:00:00 2001 From: Robert Lipe <> Date: Sun, 8 Nov 2020 13:48:34 -0600 Subject: [PATCH] Customer_apps whitespace fix .c and .h get tabs expanded to four spaces for consistency, traliing whitespace whacked. Makefiles do NOT get tabs changed. --- customer_app/benchmark_security_aes/Makefile | 2 +- .../benchmark_security_aes/aes_test.c | 2 +- .../benchmark_security_aes/malloc_hw.c | 2 +- .../benchmark_security_aes_ecb_tc_test.py | 6 +- .../bl602_boot2/bl602_boot2/BLSP_Boot2.mk | 4 +- .../bl602_boot2/bl602_boot2/blsp_boot2.c | 4 +- .../bl602_boot2/blsp_boot2_flash.ld | 72 +++---- .../bl602_boot2/blsp_boot_decompress.c | 2 +- .../bl602_boot2/blsp_boot_decompress.h | 0 .../bl602_boot2/blsp_boot_parser.c | 52 ++--- .../bl602_boot2/blsp_boot_parser.h | 0 .../bl602_boot2/bl602_boot2/blsp_bootinfo.h | 30 +-- .../bl602_boot2/bl602_boot2/blsp_common.c | 32 +-- .../bl602_boot2/bl602_boot2/blsp_common.h | 0 .../bl602_boot2/bl602_boot2/blsp_media_boot.c | 50 ++--- .../bl602_boot2/bl602_boot2/blsp_media_boot.h | 0 .../bl602_boot2/bl602_boot2/blsp_port.c | 56 ++--- .../bl602_boot2/bl602_boot2/blsp_port.h | 0 .../bl602_boot2/bl602_boot2/bouffalo.mk | 2 +- .../bl602_boot2_mini/BLSP_Boot2.mk | 4 +- .../bl602_boot2_mini/blsp_boot2.c | 4 +- .../bl602_boot2_mini/blsp_boot2_flash.ld | 72 +++---- .../bl602_boot2_mini/blsp_boot_decompress.c | 2 +- .../bl602_boot2_mini/blsp_boot_parser.c | 52 ++--- .../bl602_boot2_mini/blsp_bootinfo.h | 30 +-- .../bl602_boot2_mini/blsp_common.c | 18 +- .../bl602_boot2_mini/blsp_media_boot.c | 50 ++--- .../bl602_boot2_mini/blsp_port.c | 56 ++--- .../bl602_boot2_mini/bouffalo.mk | 2 +- .../bl602_demo_at/bl602_demo_at/at_cmd_usr.c | 0 .../bl602_demo_at/aws_iot_main.c | 6 +- .../bl602_demo_at/bl602_demo_at/ble.c | 20 +- .../bl602_demo_at/blsync_ble_app.c | 12 +- .../bl602_demo_at/blsync_ble_app.h | 2 +- .../bl602_demo_at/bl602_demo_at/coex_debug.c | 6 +- .../bl602_demo_at/bl602_demo_at/main.c | 4 +- .../bl602_demo_event_RPI_ble_wifi_tc_test.py | 10 +- .../bl602_demo_event_RPI_wifi_ap_tc_test.py | 2 +- .../bl602_demo_event/aws_iot_main.c | 6 +- .../bl602_demo_event/bl602_demo_event/ble.c | 200 +++++++++--------- .../bl602_demo_event/coex_debug.c | 6 +- .../bl602_demo_event/bl602_demo_event/main.c | 14 +- .../bl602_demo_event_RPI_ble_wifi_tc_test.py | 10 +- .../bl602_demo_event_RPI_wifi_ap_tc_test.py | 2 +- .../bl602_demo_nano/bl602_demo_nano/ble.c | 200 +++++++++--------- .../bl602_demo_nano/coex_debug.c | 6 +- .../bl602_demo_nano/bl602_demo_nano/main.c | 0 .../bl602_demo_noconnectivity/coex_debug.c | 6 +- .../bl602_demo_noconnectivity/main.c | 0 .../bl602_demo_wifi/aws_iot_main.c | 6 +- .../bl602_demo_wifi/coex_debug.c | 6 +- .../bl602_demo_wifi/bl602_demo_wifi/main.c | 0 .../bl602_demo_wifi_RPI_iperf_tc_test.py | 22 +- .../tests/bl602_demo_wifi_capcode_tc_test.py | 14 +- .../tests/bl602_demo_wifi_manager_tc_test.py | 8 +- .../tests/bl602_demo_wifi_ota_tc_test.py | 8 +- .../sdk_app_ble_sync/blsync_ble_app.c | 10 +- .../sdk_app_ble_sync/blsync_ble_app.h | 2 +- .../sdk_app_ble_sync/sdk_app_ble_sync/main.c | 0 customer_app/sdk_app_blog/sdk_app_blog/main.c | 0 customer_app/sdk_app_cli/sdk_app_cli/demo.c | 2 +- customer_app/sdk_app_cli/sdk_app_cli/main.c | 0 .../sdk_app_cronalarm/demo.c | 4 +- .../sdk_app_cronalarm/main.c | 0 customer_app/sdk_app_dac/Makefile | 2 +- .../sdk_app_dac/sdk_app_dac/dac_audio.c | 2 +- customer_app/sdk_app_dac/sdk_app_dac/demo.c | 10 +- customer_app/sdk_app_dac/sdk_app_dac/main.c | 14 +- .../sdk_app_dac/tests/sdk_app_gpio_tc_test.py | 4 +- customer_app/sdk_app_easyflash/Makefile | 2 +- .../sdk_app_easyflash/main.c | 0 customer_app/sdk_app_event/Makefile | 4 +- .../sdk_app_event/sdk_app_event/demo.c | 4 +- .../sdk_app_event/sdk_app_event/main.c | 4 +- .../tests/sdk_app_event_tc_test.py | 2 +- customer_app/sdk_app_fdt/Makefile | 4 +- customer_app/sdk_app_fdt/sdk_app_fdt/main.c | 2 +- .../sdk_app_fdt/tests/sdk_app_fdt_tc_test.py | 2 +- customer_app/sdk_app_gpio/Makefile | 2 +- customer_app/sdk_app_gpio/sdk_app_gpio/demo.c | 10 +- customer_app/sdk_app_gpio/sdk_app_gpio/main.c | 0 .../tests/sdk_app_gpio_tc_test.py | 4 +- customer_app/sdk_app_hbnram/Makefile | 4 +- .../sdk_app_hbnram/sdk_app_hbnram/demo.c | 34 +-- .../sdk_app_hbnram/sdk_app_hbnram/main.c | 2 +- customer_app/sdk_app_heap/Makefile | 2 +- customer_app/sdk_app_heap/sdk_app_heap/main.c | 2 +- .../sdk_app_helloworld/main.c | 6 +- .../sdk_app_http_client_socket/main.c | 0 .../sdk_app_http_client_socket_tc_test.py | 4 +- .../sdk_app_http_client_tcp/main.c | 0 .../tests/sdk_app_http_client_tcp_tc_test.py | 4 +- customer_app/sdk_app_i2c/Makefile | 2 +- customer_app/sdk_app_i2c/sdk_app_i2c/demo.c | 14 +- customer_app/sdk_app_i2c/sdk_app_i2c/main.c | 2 +- customer_app/sdk_app_ir/Makefile | 2 +- customer_app/sdk_app_ir/sdk_app_ir/demo.c | 10 +- customer_app/sdk_app_ir/sdk_app_ir/main.c | 2 +- customer_app/sdk_app_mdns/sdk_app_mdns/main.c | 12 +- customer_app/sdk_app_pwm/sdk_app_pwm/main.c | 0 .../sdk_app_pwm/tests/sdk_app_pwm_tc_test.py | 4 +- .../sdk_app_romfs/sdk_app_romfs/demo.c | 2 +- .../sdk_app_romfs/sdk_app_romfs/main.c | 0 .../tests/sdk_app_romfs_tc_test.py | 2 +- customer_app/sdk_app_timer/Makefile | 2 +- .../sdk_app_timer/sdk_app_timer/demo.c | 16 +- .../sdk_app_timer/sdk_app_timer/main.c | 2 +- .../sdk_app_uart_ctl/sdk_app_uart_ctl/main.c | 0 .../sdk_app_uart_echo/demo.c | 4 +- .../sdk_app_uart_echo/main.c | 0 .../tests/sdk_app_uart_echo_tc_test.py | 4 +- 111 files changed, 705 insertions(+), 705 deletions(-) mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.h mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.h mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_common.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_common.h mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.h mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_port.c mode change 100755 => 100644 customer_app/bl602_boot2/bl602_boot2/blsp_port.h mode change 100755 => 100644 customer_app/bl602_demo_at/bl602_demo_at/at_cmd_usr.c mode change 100755 => 100644 customer_app/bl602_demo_at/bl602_demo_at/main.c mode change 100755 => 100644 customer_app/bl602_demo_event/bl602_demo_event/main.c mode change 100755 => 100644 customer_app/bl602_demo_nano/bl602_demo_nano/main.c mode change 100755 => 100644 customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/main.c mode change 100755 => 100644 customer_app/bl602_demo_wifi/bl602_demo_wifi/main.c mode change 100755 => 100644 customer_app/sdk_app_ble_sync/sdk_app_ble_sync/main.c mode change 100755 => 100644 customer_app/sdk_app_blog/sdk_app_blog/main.c mode change 100755 => 100644 customer_app/sdk_app_cli/sdk_app_cli/main.c mode change 100755 => 100644 customer_app/sdk_app_cronalarm/sdk_app_cronalarm/main.c mode change 100755 => 100644 customer_app/sdk_app_dac/sdk_app_dac/main.c mode change 100755 => 100644 customer_app/sdk_app_easyflash/sdk_app_easyflash/main.c mode change 100755 => 100644 customer_app/sdk_app_event/sdk_app_event/main.c mode change 100755 => 100644 customer_app/sdk_app_fdt/sdk_app_fdt/main.c mode change 100755 => 100644 customer_app/sdk_app_gpio/sdk_app_gpio/main.c mode change 100755 => 100644 customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c mode change 100755 => 100644 customer_app/sdk_app_heap/sdk_app_heap/main.c mode change 100755 => 100644 customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c mode change 100755 => 100644 customer_app/sdk_app_http_client_socket/sdk_app_http_client_socket/main.c mode change 100755 => 100644 customer_app/sdk_app_http_client_tcp/sdk_app_http_client_tcp/main.c mode change 100755 => 100644 customer_app/sdk_app_i2c/sdk_app_i2c/main.c mode change 100755 => 100644 customer_app/sdk_app_ir/sdk_app_ir/main.c mode change 100755 => 100644 customer_app/sdk_app_mdns/sdk_app_mdns/main.c mode change 100755 => 100644 customer_app/sdk_app_pwm/sdk_app_pwm/main.c mode change 100755 => 100644 customer_app/sdk_app_romfs/sdk_app_romfs/main.c mode change 100755 => 100644 customer_app/sdk_app_timer/sdk_app_timer/main.c mode change 100755 => 100644 customer_app/sdk_app_uart_ctl/sdk_app_uart_ctl/main.c mode change 100755 => 100644 customer_app/sdk_app_uart_echo/sdk_app_uart_echo/main.c diff --git a/customer_app/benchmark_security_aes/Makefile b/customer_app/benchmark_security_aes/Makefile index 8c30fde2..8d49c4d7 100644 --- a/customer_app/benchmark_security_aes/Makefile +++ b/customer_app/benchmark_security_aes/Makefile @@ -19,7 +19,7 @@ $(info ****** Trying SDK PATH [$(BL60X_SDK_PATH)]) endif COMPONENTS_BLSYS := bltime blfdt bloop loopadc looprt loopset -COMPONENTS_VFS := +COMPONENTS_VFS := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop lwip utils cli blog blog_testc mbedtls INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) diff --git a/customer_app/benchmark_security_aes/benchmark_security_aes/aes_test.c b/customer_app/benchmark_security_aes/benchmark_security_aes/aes_test.c index f0d81266..c4b06ca7 100644 --- a/customer_app/benchmark_security_aes/benchmark_security_aes/aes_test.c +++ b/customer_app/benchmark_security_aes/benchmark_security_aes/aes_test.c @@ -746,7 +746,7 @@ void aes_ctr_test(uint32_t length, uint32_t count, printf("CTR HW\r\n"); bl_aes_test(ptr, ptr, length, count, keytype, AES_CTR_MODE); } - + free_hw(ptr); } diff --git a/customer_app/benchmark_security_aes/benchmark_security_aes/malloc_hw.c b/customer_app/benchmark_security_aes/benchmark_security_aes/malloc_hw.c index 195de7e1..89377f2a 100644 --- a/customer_app/benchmark_security_aes/benchmark_security_aes/malloc_hw.c +++ b/customer_app/benchmark_security_aes/benchmark_security_aes/malloc_hw.c @@ -74,7 +74,7 @@ void *malloc_hw (size_t size, ram_type_t type) if (p_heap_addr == NULL) { return NULL; } - + ptr = NULL; counts = 0; while (1) { diff --git a/customer_app/benchmark_security_aes/tests/benchmark_security_aes_ecb_tc_test.py b/customer_app/benchmark_security_aes/tests/benchmark_security_aes_ecb_tc_test.py index 82ee445d..42a84cb0 100644 --- a/customer_app/benchmark_security_aes/tests/benchmark_security_aes_ecb_tc_test.py +++ b/customer_app/benchmark_security_aes/tests/benchmark_security_aes_ecb_tc_test.py @@ -23,7 +23,7 @@ def benchmark_security_aes_tc(env, extra_data): dut.expect('Init CLI with event Driven', timeout=0.5) print('BL602 CLI init done') time.sleep(0.1) - + for aes in ['ecb', 'cbc', 'ctr', 'gcm'] : for key, keybit in enumerate(['128', '192', '256'], 1) : for ram, ramtype in enumerate(['dtcm', 'ocram', 'wram'], 0) : @@ -42,11 +42,11 @@ def benchmark_security_aes_tc(env, extra_data): dut.write('test_aes_gmac 32768 256 0') speed = dut.expect(re.compile(r"aes encrypt speed is (.+)\r"), timeout=30) print('aes gmac hw dtcm test done speed is : {}'.format(speed[0])) - + dut.write('test_aes_gmac 32768 256 1') speed = dut.expect(re.compile(r"aes encrypt speed is (.+)\r"), timeout=30) print('aes gmac hw ocram test done speed is : {}'.format(speed[0])) - + dut.write('test_aes_gmac 32768 256 2') speed = dut.expect(re.compile(r"aes encrypt speed is (.+)\r"), timeout=30) print('aes gmac hw wram test done speed is : {}'.format(speed[0])) diff --git a/customer_app/bl602_boot2/bl602_boot2/BLSP_Boot2.mk b/customer_app/bl602_boot2/bl602_boot2/BLSP_Boot2.mk index 3b78fa85..eaff327f 100755 --- a/customer_app/bl602_boot2/bl602_boot2/BLSP_Boot2.mk +++ b/customer_app/bl602_boot2/bl602_boot2/BLSP_Boot2.mk @@ -7,8 +7,8 @@ MODULE_OUT_DIR:= $(TARGET_OUT_PATH)/$(MODULE_DIR) $(MODULE_OUT_DIR)/%.o: LOCAL_CFLAGS:= -DBLSP_BOOT2_ROLLBACK -O2 $(MODULE_OUT_DIR)/%.o: LOCAL_INCLUDE:= -I$(MODULE_DIR) -LOCAL_COM_SRCS_FILE:= -local_com_objs := $(subst .c,.o,$(LOCAL_COM_SRCS_FILE)) +LOCAL_COM_SRCS_FILE:= +local_com_objs := $(subst .c,.o,$(LOCAL_COM_SRCS_FILE)) $(MODULE_OUT_DIR)/%.o:$(MODULE_DIR)/%.c @mkdir -p $(dir $@) diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c b/customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c old mode 100755 new mode 100644 index ad736a76..2e705dbc --- a/customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c @@ -432,9 +432,9 @@ int main(void) MSG_DBG("MCU SDK:%s\r\n",MCU_SDK_VERSION); MSG_DBG("BSP:%s\r\n",BSP_VERSION); #endif - if(BLSP_Boot2_Dump_Critical_Flag()){ + if(BLSP_Boot2_Dump_Critical_Flag()){ BLSP_Dump_Data(&clkCfg,16); - BLSP_Dump_Data(&flashCfg,16); + BLSP_Dump_Data(&flashCfg,16); } MSG_DBG("Get efuse config\r\n"); diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot2_flash.ld b/customer_app/bl602_boot2/bl602_boot2/blsp_boot2_flash.ld index 01a4fff8..26fe73aa 100755 --- a/customer_app/bl602_boot2/bl602_boot2/blsp_boot2_flash.ld +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_boot2_flash.ld @@ -35,13 +35,13 @@ SECTIONS { . = ALIGN(4); __text_code_start__ = .; - + KEEP (*(.text.metal.init.enter)) KEEP (*(SORT_NONE(.init))) - + *(.text) *(.text.*) - + /*put .rodata**/ *(EXCLUDE_FILE( *bl602_glb.o \ *bl602_pds.o \ @@ -53,34 +53,34 @@ SECTIONS *bl602_ef_ctrl.o) .rodata*) *(.rodata) *(.rodata.*) - + *(.srodata) *(.srodata.*) - + . = ALIGN(4); __text_code_end__ = .; } > xip_memory - + . = ALIGN(4); __itcm_load_addr = .; - + .itcm_region : AT (__itcm_load_addr) { . = ALIGN(4); __tcm_code_start__ = .; - + *(.tcm_code) *(.tcm_const) *(.sclock_rlt_code) *(.sclock_rlt_const) - + *bl602_romapi.o(.text) *bl602_romapi.o(.text.*) *bl602_romapi.o(.rodata) *bl602_romapi.o(.rodata.*) *bl602_romapi.o(.srodata) *bl602_romapi.o(.srodata.*) - + *bl602_glb.o*(.rodata*) *bl602_pds.o*(.rodata*) *bl602_common.o*(.rodata*) @@ -89,24 +89,24 @@ SECTIONS *bl602_sflash.o*(.rodata*) *bl602_xip_sflash.o*(.rodata*) *bl602_ef_ctrl.o*(.rodata*) - + . = ALIGN(4); __tcm_code_end__ = .; } > itcm_memory - + __dtcm_load_addr = __itcm_load_addr + SIZEOF(.itcm_region); - + .dtcm_region : AT (__dtcm_load_addr) { . = ALIGN(4); __tcm_data_start__ = .; - + *(.tcm_data) - + . = ALIGN(4); __tcm_data_end__ = .; } > dtcm_memory - + /*************************************************************************/ /* .stack_dummy section doesn't contains any symbols. It is only * used for linker to calculate size of stack sections, and assign @@ -117,59 +117,59 @@ SECTIONS . = . + StackSize; . = ALIGN(0x4); } > dtcm_memory - + /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory); __StackLimit = __StackTop - SIZEOF(.stack_dummy); - + /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __tcm_data_end__, "region RAM overflowed with stack") /*************************************************************************/ - + __system_ram_load_addr = __dtcm_load_addr + SIZEOF(.dtcm_region); - + .system_ram_data_region : AT (__system_ram_load_addr) { . = ALIGN(4); __system_ram_data_start__ = .; - + *(.system_ram) - + . = ALIGN(4); __system_ram_data_end__ = .; } > ram_memory - + __ram_load_addr = __system_ram_load_addr + SIZEOF(.system_ram_data_region); - + /* Data section */ RAM_DATA : AT (__ram_load_addr) { . = ALIGN(4); __ram_data_start__ = .; - + PROVIDE( __global_pointer$ = . + 0x800 ); - + *(.data) *(.data.*) *(.sdata) *(.sdata.*) *(.sdata2) *(.sdata2.*) - + . = ALIGN(4); __ram_data_end__ = .; } > ram_memory - + .bss (NOLOAD) : { . = ALIGN(4); __bss_start__ = .; - + *(.bss*) *(.sbss*) *(COMMON) - + . = ALIGN(4); __bss_end__ = .; } > ram_memory @@ -178,25 +178,25 @@ SECTIONS { . = ALIGN(4); __noinit_data_start__ = .; - + *(.noinit_data*) - + . = ALIGN(4); __noinit_data_end__ = .; } > ram_memory - + .heap (NOLOAD): { . = ALIGN(4); __HeapBase = .; - + /*__end__ = .;*/ /*end = __end__;*/ KEEP(*(.heap*)) - + . = ALIGN(4); __HeapLimit = .; } > ram_memory - + } diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c old mode 100755 new mode 100644 index 2b7f2b50..303459fc --- a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c @@ -101,7 +101,7 @@ static int32_t BLSP_Boot2_Fw_Decompress(uint32_t srcAddress,uint32_t destAddress struct xz_buf b; struct xz_dec *s; enum xz_ret ret; - + *pDestSize=0; if(destMaxSize>0){ XIP_SFlash_Erase_Need_Lock(&flashCfg,destAddress,destAddress+destMaxSize-1); diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.h b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.h old mode 100755 new mode 100644 diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c old mode 100755 new mode 100644 index a5cf7607..3dd23561 --- a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c @@ -96,7 +96,7 @@ SEC_Eng_SHA256_Ctx shaCtx; * *******************************************************************************/ static uint32_t BLSP_Boot_Parse_Is_PKHash_Valid(uint8_t cpuType,uint8_t *pkhash) -{ +{ if(cpuType==BFLB_BOOT2_CPU_0){ if(0==memcmp(efuseCfg.pkHashCpu0,pkhash,BFLB_BOOT2_PK_HASH_SIZE)){ return 1; @@ -106,7 +106,7 @@ static uint32_t BLSP_Boot_Parse_Is_PKHash_Valid(uint8_t cpuType,uint8_t *pkhash) return 1; } } - + return 0; } @@ -132,7 +132,7 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) uint32_t crcPass=0; uint32_t i=0; uint32_t *phash=(uint32_t *)header->hash; - + if(header->bootCfg.bval.crcIgnore==1&&header->crc32==BFLB_BOOT2_DEADBEEF_VAL){ MSG_WAR("Crc ignored\r\n"); crcPass=1; @@ -146,7 +146,7 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) if(header->bootCfg.bval.notLoadInBoot){ return BFLB_BOOT2_IMG_BOOTHEADER_NOT_LOAD_ERROR; } - + /* Get which CPU's img it is*/ for(i=0;imagicCode,BFLB_BOOT2_CPU0_MAGIC, @@ -157,25 +157,25 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) break; } } - + if(i==BFLB_BOOT2_CPU_MAX){ /* No cpu img magic match */ MSG_ERR("Magic code error\r\n"); return BFLB_BOOT2_IMG_BOOTHEADER_MAGIC_ERROR; } - - bootImgCfg->cpuType=i; + + bootImgCfg->cpuType=i; bootImgCfg->entryPoint=0; /* Set image valid 0 as default */ bootImgCfg->imgValid=0; - + /* Deal with pll config */ /* Encrypt and sign */ bootImgCfg->encryptType=header->bootCfg.bval.encryptType; bootImgCfg->signType=header->bootCfg.bval.sign; bootImgCfg->keySel=header->bootCfg.bval.keySel; - + /* Xip relative */ bootImgCfg->noSegment=header->bootCfg.bval.noSegment; bootImgCfg->cacheEnable=header->bootCfg.bval.cacheEnable; @@ -183,17 +183,17 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) bootImgCfg->haltCPU1=header->bootCfg.bval.haltCPU1; bootImgCfg->cacheWayDisable=header->bootCfg.bval.cacheWayDisable; bootImgCfg->hashIgnore=header->bootCfg.bval.hashIgnore; - + /* Firmware len*/ bootImgCfg->imgSegmentInfo.imgLen=header->imgSegmentInfo.imgLen; - + /* Boot entry and flash offset */ - bootImgCfg->entryPoint=header->bootEntry; + bootImgCfg->entryPoint=header->bootEntry; bootImgCfg->imgStart.flashOffset=header->imgStart.flashOffset; MSG_DBG("sign %d,encrypt:%d\r\n",bootImgCfg->signType, bootImgCfg->encryptType); - + /* Check encrypt and sign match*/ if(efuseCfg.encrypted[i]!=0){ if(bootImgCfg->encryptType==0){ @@ -201,13 +201,13 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) return BFLB_BOOT2_IMG_BOOTHEADER_ENCRYPT_NOTFIT; } } - + if(efuseCfg.sign[i]^bootImgCfg->signType){ MSG_ERR("sign not fit\r\n"); bootImgCfg->signType=efuseCfg.sign[i]; return BFLB_BOOT2_IMG_BOOTHEADER_SIGN_NOTFIT; } - + if(psMode==BFLB_PSM_HBN && (!efuseCfg.hbnCheckSign)){ /* In HBN Mode, if user select to ignore hash and sign*/ bootImgCfg->hashIgnore=1; @@ -215,14 +215,14 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) efuseCfg.sign[i]!=0 ){ /* If signed or user not really want to ignore, hash can't be ignored*/ bootImgCfg->hashIgnore=0; - } + } ARCH_MemCpy_Fast(bootImgCfg->imgHash,header->hash,sizeof(header->hash)); - + if(bootImgCfg->imgSegmentInfo.imgLen==0){ return BFLB_BOOT2_IMG_SEGMENT_CNT_ERROR; } - + /* Start hash here*/ Sec_Eng_SHA256_Init(&shaCtx,SEC_ENG_SHA_ID0,SEC_ENG_SHA256, shaTmpBuf,padding); Sec_Eng_SHA_Start(SEC_ENG_SHA_ID0); @@ -248,18 +248,18 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) *******************************************************************************/ int32_t BLSP_Boot_Parse_PKey(Boot_Image_Config *bootImgCfg,uint8_t *data,uint8_t own) { - Boot_PK_Config *cfg=(Boot_PK_Config*)data; + Boot_PK_Config *cfg=(Boot_PK_Config*)data; uint32_t pk_hash[BFLB_BOOT2_PK_HASH_SIZE/4]; - + if(cfg->crc32==BFLB_Soft_CRC32((uint8_t*)cfg,sizeof(Boot_PK_Config)-4)){ /* Check public key with data info in OTP*/ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,data,BFLB_BOOT2_ECC_KEYXSIZE+BFLB_BOOT2_ECC_KEYYSIZE); Sec_Eng_SHA256_Finish(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)pk_hash); - + Sec_Eng_SHA256_Init(&shaCtx,SEC_ENG_SHA_ID0,SEC_ENG_SHA256, shaTmpBuf,padding); Sec_Eng_SHA_Start(SEC_ENG_SHA_ID0); - + /* Check pk is valid */ if(own==1){ if(1!=BLSP_Boot_Parse_Is_PKHash_Valid(bootImgCfg->cpuType, @@ -297,7 +297,7 @@ int32_t BLSP_Boot_Parse_Signature(Boot_Image_Config *bootImgCfg,uint8_t *data,ui if(cfg->sigLen>sizeof(bootImgCfg->signature)){ return BFLB_BOOT2_IMG_SIGNATURE_LEN_ERROR; } - + /* CRC include sig_len*/ crc=BFLB_Soft_CRC32((uint8_t *)&cfg->sigLen,cfg->sigLen+sizeof(cfg->sigLen)); if(memcmp(&crc,&cfg->signature[cfg->sigLen],4)==0){ @@ -330,7 +330,7 @@ int32_t BLSP_Boot_Parse_AesIv(Boot_Image_Config *bootImgCfg,uint8_t *data) Boot_AES_Config *cfg=(Boot_AES_Config *)data; if(cfg->crc32==BFLB_Soft_CRC32(cfg->aesIV,sizeof(cfg->aesIV))){ - memcpy(bootImgCfg->aesiv,cfg->aesIV,sizeof(Boot_AES_Config)); + memcpy(bootImgCfg->aesiv,cfg->aesIV,sizeof(Boot_AES_Config)); /* Update image hash */ if(!bootImgCfg->hashIgnore){ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,data,sizeof(Boot_AES_Config)); @@ -355,7 +355,7 @@ int32_t BLSP_Boot_Parser_Check_Signature(Boot_Image_Config *bootImgCfg) { int32_t ret=0; uint64_t startTime=0; - + MSG_DBG("%d,%d\r\n",psMode,efuseCfg.hbnCheckSign); if(psMode==BFLB_PSM_HBN&&(!efuseCfg.hbnCheckSign)){ return BFLB_BOOT2_SUCCESS; @@ -388,7 +388,7 @@ int32_t BLSP_Boot_Parser_Check_Signature(Boot_Image_Config *bootImgCfg) int32_t BLSP_Boot_Parser_Check_Hash(Boot_Image_Config *bootImgCfg) { uint32_t imgHashCal[BFLB_BOOT2_HASH_SIZE/4]; - + if(!bootImgCfg->hashIgnore){ Sec_Eng_SHA256_Finish(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)imgHashCal); if(memcmp(imgHashCal,bootImgCfg->imgHash , diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.h b/customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.h old mode 100755 new mode 100644 diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h b/customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h old mode 100755 new mode 100644 index 7a63e949..a3c42ed9 --- a/customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h @@ -58,16 +58,16 @@ #define BFLB_BOOT2_CPU_0 0 #define BFLB_BOOT2_CPU_1 1 #define BFLB_BOOT2_CPU_MAX 2 - -/* Public key hash size */ + +/* Public key hash size */ #define BFLB_BOOT2_PK_HASH_SIZE 256/8 #define BFLB_BOOT2_HASH_SIZE 256/8 -/* Public key type */ +/* Public key type */ #define BFLB_BOOT2_ECC_KEYXSIZE 256/8 #define BFLB_BOOT2_ECC_KEYYSIZE 256/8 #define BFLB_BOOT2_SIGN_MAXSIZE 2048/8 - -/* Power save define */ + +/* Power save define */ #define BFLB_PSM_ACTIVE 0 #define BFLB_PSM_HBN 1 @@ -149,7 +149,7 @@ typedef struct { uint8_t pllClk; uint8_t hclkDiv; uint8_t bclkDiv; - + uint8_t flashClkType; uint8_t flashClkDiv; uint8_t rsvd[2]; @@ -163,8 +163,8 @@ typedef struct { typedef struct { uint32_t magicCode; /*'BFXP'*/ - uint32_t rivison; - Boot_Flash_Config flashCfg; + uint32_t rivison; + Boot_Flash_Config flashCfg; Boot_Clk_Config clkCfg; __PACKED_UNION { __PACKED_STRUCT { @@ -184,12 +184,12 @@ typedef struct { } bval; uint32_t wval; }bootCfg ; - + __PACKED_UNION { uint32_t segmentCnt; uint32_t imgLen; }imgSegmentInfo; - + uint32_t bootEntry; /* entry point of the image*/ __PACKED_UNION { uint32_t ramAddr; @@ -225,12 +225,12 @@ typedef struct { uint8_t signType; uint8_t keySel; uint8_t imgValid; - + uint8_t noSegment; uint8_t cacheEnable; uint8_t cacheWayDisable; uint8_t hashIgnore; - + uint8_t aesRegionLock; uint8_t haltCPU1; uint8_t cpuType; @@ -240,8 +240,8 @@ typedef struct { uint32_t segmentCnt; uint32_t imgLen; }imgSegmentInfo; - - uint32_t mspVal; + + uint32_t mspVal; uint32_t entryPoint; __PACKED_UNION { uint32_t ramAddr; @@ -257,7 +257,7 @@ typedef struct { uint8_t aesiv[16+4]; //iv in boot header uint8_t ecKeyX[BFLB_BOOT2_ECC_KEYXSIZE]; //ec key in boot header - uint8_t ecKeyY[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header + uint8_t ecKeyY[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header uint8_t ecKeyX2[BFLB_BOOT2_ECC_KEYXSIZE]; //ec key in boot header uint8_t ecKeyY2[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header diff --git a/customer_app/bl602_boot2/bl602_boot2/blsp_common.c b/customer_app/bl602_boot2/bl602_boot2/blsp_common.c old mode 100755 new mode 100644 index be01cbcf..0166b42d --- a/customer_app/bl602_boot2/bl602_boot2/blsp_common.c +++ b/customer_app/bl602_boot2/bl602_boot2/blsp_common.c @@ -100,7 +100,7 @@ void BLSP_Dump_Data(void *datain,int len) { int i=0; uint8_t *data=(uint8_t *)datain; - + for(i=0;iBFLB_BOOT2_READBUF_SIZE){ readLen=BFLB_BOOT2_READBUF_SIZE; } - + ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,readLen); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; @@ -124,7 +124,7 @@ static int32_t BLSP_MediaBot_Cal_Hash(uint32_t startAddr,uint32_t totalLen) /* Update hash*/ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)boot2ReadBuf,readLen); //BLSP_Dump_Data((uint8_t *)boot2ReadBuf,readLen); - + addr+=readLen; dealLen+=readLen; } @@ -145,7 +145,7 @@ static int32_t BLSP_MediaBoot_Read_Signature(uint32_t addr,uint32_t *len) int32_t ret=BFLB_BOOT2_SUCCESS; uint32_t sig_len; uint8_t *ptmp; - + /* Read signature*/ ret=BLSP_MediaBoot_Read(addr,(uint8_t*)&sig_len,sizeof(sig_len)); if(ret!=BFLB_BOOT2_SUCCESS){ @@ -164,7 +164,7 @@ static int32_t BLSP_MediaBoot_Read_Signature(uint32_t addr,uint32_t *len) ARCH_MemCpy_Fast(boot2ReadBuf,&sig_len,sizeof(sig_len)); addr+=(sig_len+4); *len=sig_len; - + return ret; } @@ -183,7 +183,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ uint32_t addr=bootheaderAddr; int32_t ret; uint32_t sig_len; - + /* Read boot header*/ MSG_DBG("R header from %08x\r\n",addr); ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_Header_Config)); @@ -193,7 +193,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ if(BLSP_Boot2_Dump_Critical_Flag()){ BLSP_Dump_Data(boot2ReadBuf,sizeof(Boot_Header_Config)); } - + addr+=sizeof(Boot_Header_Config); ret=BLSP_Boot_Parse_BootHeader(bootImgCfg,(uint8_t *)boot2ReadBuf); if(ret!=BFLB_BOOT2_SUCCESS){ @@ -201,7 +201,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ } /* Due to OTA, the flashOffset is changed, so copy from partition info */ bootImgCfg->imgStart.flashOffset=imgAddr; - + /* If sign enable,get pk key and signature*/ if(bootImgCfg->signType){ /* Read public key */ @@ -217,7 +217,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_Boot_Parse_PKey(bootImgCfg,(uint8_t *)boot2ReadBuf,1); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } /* Read public key 2*/ MSG_DBG("R PK2\r\n"); ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_PK_Config)); @@ -248,7 +248,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ if(ret!=BFLB_BOOT2_SUCCESS){ return ret; } - + /* Read signature2*/ MSG_DBG("R SIG2\r\n"); BLSP_MediaBoot_Read_Signature(addr,&sig_len); @@ -266,7 +266,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ return ret; } } - + /* If encrypt enable,get AES key*/ if(bootImgCfg->encryptType){ /* Read aes iv*/ @@ -274,7 +274,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_AES_Config)); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } if(BLSP_Boot2_Dump_Critical_Flag()){ BLSP_Dump_Data(boot2ReadBuf,sizeof(Boot_AES_Config)); } @@ -284,7 +284,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ return ret; } } - + if(bootImgCfg->noSegment){ /* Flash image */ if(!bootImgCfg->hashIgnore){ @@ -302,12 +302,12 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_Boot_Parser_Check_Signature(bootImgCfg); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } bootImgCfg->imgValid=1; }else{ bootImgCfg->imgValid=0; - } - + } + return ret; } @@ -350,9 +350,9 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8 uint32_t i=0; uint32_t validImgFound=0; uint32_t bootHeaderAddr[BFLB_BOOT2_CPU_MAX]; - + MSG_DBG("Media boot main\r\n"); - + /* Reset some parameters*/ for(i=0;i xip_memory - + . = ALIGN(4); __itcm_load_addr = .; - + .itcm_region : AT (__itcm_load_addr) { . = ALIGN(4); __tcm_code_start__ = .; - + *(.tcm_code) *(.tcm_const) *(.sclock_rlt_code) *(.sclock_rlt_const) - + *bl602_romapi.o(.text) *bl602_romapi.o(.text.*) *bl602_romapi.o(.rodata) *bl602_romapi.o(.rodata.*) *bl602_romapi.o(.srodata) *bl602_romapi.o(.srodata.*) - + *bl602_glb.o*(.rodata*) *bl602_pds.o*(.rodata*) *bl602_common.o*(.rodata*) @@ -89,24 +89,24 @@ SECTIONS *bl602_sflash.o*(.rodata*) *bl602_xip_sflash.o*(.rodata*) *bl602_ef_ctrl.o*(.rodata*) - + . = ALIGN(4); __tcm_code_end__ = .; } > itcm_memory - + __dtcm_load_addr = __itcm_load_addr + SIZEOF(.itcm_region); - + .dtcm_region : AT (__dtcm_load_addr) { . = ALIGN(4); __tcm_data_start__ = .; - + *(.tcm_data) - + . = ALIGN(4); __tcm_data_end__ = .; } > dtcm_memory - + /*************************************************************************/ /* .stack_dummy section doesn't contains any symbols. It is only * used for linker to calculate size of stack sections, and assign @@ -117,59 +117,59 @@ SECTIONS . = . + StackSize; . = ALIGN(0x4); } > dtcm_memory - + /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory); __StackLimit = __StackTop - SIZEOF(.stack_dummy); - + /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __tcm_data_end__, "region RAM overflowed with stack") /*************************************************************************/ - + __system_ram_load_addr = __dtcm_load_addr + SIZEOF(.dtcm_region); - + .system_ram_data_region : AT (__system_ram_load_addr) { . = ALIGN(4); __system_ram_data_start__ = .; - + *(.system_ram) - + . = ALIGN(4); __system_ram_data_end__ = .; } > ram_memory - + __ram_load_addr = __system_ram_load_addr + SIZEOF(.system_ram_data_region); - + /* Data section */ RAM_DATA : AT (__ram_load_addr) { . = ALIGN(4); __ram_data_start__ = .; - + PROVIDE( __global_pointer$ = . + 0x800 ); - + *(.data) *(.data.*) *(.sdata) *(.sdata.*) *(.sdata2) *(.sdata2.*) - + . = ALIGN(4); __ram_data_end__ = .; } > ram_memory - + .bss (NOLOAD) : { . = ALIGN(4); __bss_start__ = .; - + *(.bss*) *(.sbss*) *(COMMON) - + . = ALIGN(4); __bss_end__ = .; } > ram_memory @@ -178,25 +178,25 @@ SECTIONS { . = ALIGN(4); __noinit_data_start__ = .; - + *(.noinit_data*) - + . = ALIGN(4); __noinit_data_end__ = .; } > ram_memory - + .heap (NOLOAD): { . = ALIGN(4); __HeapBase = .; - + /*__end__ = .;*/ /*end = __end__;*/ KEEP(*(.heap*)) - + . = ALIGN(4); __HeapLimit = .; } > ram_memory - + } diff --git a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_decompress.c b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_decompress.c index 2b7f2b50..303459fc 100644 --- a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_decompress.c +++ b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_decompress.c @@ -101,7 +101,7 @@ static int32_t BLSP_Boot2_Fw_Decompress(uint32_t srcAddress,uint32_t destAddress struct xz_buf b; struct xz_dec *s; enum xz_ret ret; - + *pDestSize=0; if(destMaxSize>0){ XIP_SFlash_Erase_Need_Lock(&flashCfg,destAddress,destAddress+destMaxSize-1); diff --git a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_parser.c b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_parser.c index 9e52ddd0..de781e51 100644 --- a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_parser.c +++ b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_boot_parser.c @@ -96,7 +96,7 @@ SEC_Eng_SHA256_Ctx shaCtx; * *******************************************************************************/ static uint32_t BLSP_Boot_Parse_Is_PKHash_Valid(uint8_t cpuType,uint8_t *pkhash) -{ +{ if(cpuType==BFLB_BOOT2_CPU_0){ if(0==memcmp(efuseCfg.pkHashCpu0,pkhash,BFLB_BOOT2_PK_HASH_SIZE)){ return 1; @@ -106,7 +106,7 @@ static uint32_t BLSP_Boot_Parse_Is_PKHash_Valid(uint8_t cpuType,uint8_t *pkhash) return 1; } } - + return 0; } @@ -132,7 +132,7 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) uint32_t crcPass=0; uint32_t i=0; uint32_t *phash=(uint32_t *)header->hash; - + if(header->bootCfg.bval.crcIgnore==1&&header->crc32==BFLB_BOOT2_DEADBEEF_VAL){ MSG_WAR("Crc ignored\r\n"); crcPass=1; @@ -146,7 +146,7 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) if(header->bootCfg.bval.notLoadInBoot){ return BFLB_BOOT2_IMG_BOOTHEADER_NOT_LOAD_ERROR; } - + /* Get which CPU's img it is*/ for(i=0;imagicCode,BFLB_BOOT2_CPU0_MAGIC, @@ -157,25 +157,25 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) break; } } - + if(i==BFLB_BOOT2_CPU_MAX){ /* No cpu img magic match */ MSG_ERR("Magic code error\r\n"); return BFLB_BOOT2_IMG_BOOTHEADER_MAGIC_ERROR; } - - bootImgCfg->cpuType=i; + + bootImgCfg->cpuType=i; bootImgCfg->entryPoint=0; /* Set image valid 0 as default */ bootImgCfg->imgValid=0; - + /* Deal with pll config */ /* Encrypt and sign */ bootImgCfg->encryptType=header->bootCfg.bval.encryptType; bootImgCfg->signType=header->bootCfg.bval.sign; bootImgCfg->keySel=header->bootCfg.bval.keySel; - + /* Xip relative */ bootImgCfg->noSegment=header->bootCfg.bval.noSegment; bootImgCfg->cacheEnable=header->bootCfg.bval.cacheEnable; @@ -183,17 +183,17 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) bootImgCfg->haltCPU1=header->bootCfg.bval.haltCPU1; bootImgCfg->cacheWayDisable=header->bootCfg.bval.cacheWayDisable; bootImgCfg->hashIgnore=header->bootCfg.bval.hashIgnore; - + /* Firmware len*/ bootImgCfg->imgSegmentInfo.imgLen=header->imgSegmentInfo.imgLen; - + /* Boot entry and flash offset */ - bootImgCfg->entryPoint=header->bootEntry; + bootImgCfg->entryPoint=header->bootEntry; bootImgCfg->imgStart.flashOffset=header->imgStart.flashOffset; MSG_DBG("sign %d,encrypt:%d\r\n",bootImgCfg->signType, bootImgCfg->encryptType); - + /* Check encrypt and sign match*/ if(efuseCfg.encrypted[i]!=0){ if(bootImgCfg->encryptType==0){ @@ -201,13 +201,13 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) return BFLB_BOOT2_IMG_BOOTHEADER_ENCRYPT_NOTFIT; } } - + if(efuseCfg.sign[i]^bootImgCfg->signType){ MSG_ERR("sign not fit\r\n"); bootImgCfg->signType=efuseCfg.sign[i]; return BFLB_BOOT2_IMG_BOOTHEADER_SIGN_NOTFIT; } - + if(psMode==BFLB_PSM_HBN && (!efuseCfg.hbnCheckSign)){ /* In HBN Mode, if user select to ignore hash and sign*/ bootImgCfg->hashIgnore=1; @@ -215,14 +215,14 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) efuseCfg.sign[i]!=0 ){ /* If signed or user not really want to ignore, hash can't be ignored*/ bootImgCfg->hashIgnore=0; - } + } ARCH_MemCpy_Fast(bootImgCfg->imgHash,header->hash,sizeof(header->hash)); - + if(bootImgCfg->imgSegmentInfo.imgLen==0){ return BFLB_BOOT2_IMG_SEGMENT_CNT_ERROR; } - + /* Start hash here*/ Sec_Eng_SHA256_Init(&shaCtx,SEC_ENG_SHA_ID0,SEC_ENG_SHA256, shaTmpBuf,padding); Sec_Eng_SHA_Start(SEC_ENG_SHA_ID0); @@ -248,18 +248,18 @@ int32_t BLSP_Boot_Parse_BootHeader(Boot_Image_Config *bootImgCfg,uint8_t *data) *******************************************************************************/ int32_t BLSP_Boot_Parse_PKey(Boot_Image_Config *bootImgCfg,uint8_t *data,uint8_t own) { - Boot_PK_Config *cfg=(Boot_PK_Config*)data; + Boot_PK_Config *cfg=(Boot_PK_Config*)data; uint32_t pk_hash[BFLB_BOOT2_PK_HASH_SIZE/4]; - + if(cfg->crc32==BFLB_Soft_CRC32((uint8_t*)cfg,sizeof(Boot_PK_Config)-4)){ /* Check public key with data info in OTP*/ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,data,BFLB_BOOT2_ECC_KEYXSIZE+BFLB_BOOT2_ECC_KEYYSIZE); Sec_Eng_SHA256_Finish(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)pk_hash); - + Sec_Eng_SHA256_Init(&shaCtx,SEC_ENG_SHA_ID0,SEC_ENG_SHA256, shaTmpBuf,padding); Sec_Eng_SHA_Start(SEC_ENG_SHA_ID0); - + /* Check pk is valid */ if(own==1){ if(1!=BLSP_Boot_Parse_Is_PKHash_Valid(bootImgCfg->cpuType, @@ -297,7 +297,7 @@ int32_t BLSP_Boot_Parse_Signature(Boot_Image_Config *bootImgCfg,uint8_t *data,ui if(cfg->sigLen>sizeof(bootImgCfg->signature)){ return BFLB_BOOT2_IMG_SIGNATURE_LEN_ERROR; } - + /* CRC include sig_len*/ crc=BFLB_Soft_CRC32((uint8_t *)&cfg->sigLen,cfg->sigLen+sizeof(cfg->sigLen)); if(memcmp(&crc,&cfg->signature[cfg->sigLen],4)==0){ @@ -330,7 +330,7 @@ int32_t BLSP_Boot_Parse_AesIv(Boot_Image_Config *bootImgCfg,uint8_t *data) Boot_AES_Config *cfg=(Boot_AES_Config *)data; if(cfg->crc32==BFLB_Soft_CRC32(cfg->aesIV,sizeof(cfg->aesIV))){ - memcpy(bootImgCfg->aesiv,cfg->aesIV,sizeof(Boot_AES_Config)); + memcpy(bootImgCfg->aesiv,cfg->aesIV,sizeof(Boot_AES_Config)); /* Update image hash */ if(!bootImgCfg->hashIgnore){ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,data,sizeof(Boot_AES_Config)); @@ -354,7 +354,7 @@ int32_t BLSP_Boot_Parse_AesIv(Boot_Image_Config *bootImgCfg,uint8_t *data) int32_t BLSP_Boot_Parser_Check_Signature(Boot_Image_Config *bootImgCfg) { int32_t ret=0; - + MSG_DBG("%d,%d\r\n",psMode,efuseCfg.hbnCheckSign); if(psMode==BFLB_PSM_HBN&&(!efuseCfg.hbnCheckSign)){ return BFLB_BOOT2_SUCCESS; @@ -387,7 +387,7 @@ int32_t BLSP_Boot_Parser_Check_Signature(Boot_Image_Config *bootImgCfg) int32_t BLSP_Boot_Parser_Check_Hash(Boot_Image_Config *bootImgCfg) { uint32_t imgHashCal[BFLB_BOOT2_HASH_SIZE/4]; - + if(!bootImgCfg->hashIgnore){ Sec_Eng_SHA256_Finish(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)imgHashCal); if(memcmp(imgHashCal,bootImgCfg->imgHash , diff --git a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_bootinfo.h b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_bootinfo.h index 7a63e949..a3c42ed9 100644 --- a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_bootinfo.h +++ b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_bootinfo.h @@ -58,16 +58,16 @@ #define BFLB_BOOT2_CPU_0 0 #define BFLB_BOOT2_CPU_1 1 #define BFLB_BOOT2_CPU_MAX 2 - -/* Public key hash size */ + +/* Public key hash size */ #define BFLB_BOOT2_PK_HASH_SIZE 256/8 #define BFLB_BOOT2_HASH_SIZE 256/8 -/* Public key type */ +/* Public key type */ #define BFLB_BOOT2_ECC_KEYXSIZE 256/8 #define BFLB_BOOT2_ECC_KEYYSIZE 256/8 #define BFLB_BOOT2_SIGN_MAXSIZE 2048/8 - -/* Power save define */ + +/* Power save define */ #define BFLB_PSM_ACTIVE 0 #define BFLB_PSM_HBN 1 @@ -149,7 +149,7 @@ typedef struct { uint8_t pllClk; uint8_t hclkDiv; uint8_t bclkDiv; - + uint8_t flashClkType; uint8_t flashClkDiv; uint8_t rsvd[2]; @@ -163,8 +163,8 @@ typedef struct { typedef struct { uint32_t magicCode; /*'BFXP'*/ - uint32_t rivison; - Boot_Flash_Config flashCfg; + uint32_t rivison; + Boot_Flash_Config flashCfg; Boot_Clk_Config clkCfg; __PACKED_UNION { __PACKED_STRUCT { @@ -184,12 +184,12 @@ typedef struct { } bval; uint32_t wval; }bootCfg ; - + __PACKED_UNION { uint32_t segmentCnt; uint32_t imgLen; }imgSegmentInfo; - + uint32_t bootEntry; /* entry point of the image*/ __PACKED_UNION { uint32_t ramAddr; @@ -225,12 +225,12 @@ typedef struct { uint8_t signType; uint8_t keySel; uint8_t imgValid; - + uint8_t noSegment; uint8_t cacheEnable; uint8_t cacheWayDisable; uint8_t hashIgnore; - + uint8_t aesRegionLock; uint8_t haltCPU1; uint8_t cpuType; @@ -240,8 +240,8 @@ typedef struct { uint32_t segmentCnt; uint32_t imgLen; }imgSegmentInfo; - - uint32_t mspVal; + + uint32_t mspVal; uint32_t entryPoint; __PACKED_UNION { uint32_t ramAddr; @@ -257,7 +257,7 @@ typedef struct { uint8_t aesiv[16+4]; //iv in boot header uint8_t ecKeyX[BFLB_BOOT2_ECC_KEYXSIZE]; //ec key in boot header - uint8_t ecKeyY[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header + uint8_t ecKeyY[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header uint8_t ecKeyX2[BFLB_BOOT2_ECC_KEYXSIZE]; //ec key in boot header uint8_t ecKeyY2[BFLB_BOOT2_ECC_KEYYSIZE]; //ec key in boot header diff --git a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_common.c b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_common.c index 790d066d..78b504a7 100644 --- a/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_common.c +++ b/customer_app/bl602_boot2_mini/bl602_boot2_mini/blsp_common.c @@ -100,7 +100,7 @@ void BLSP_Dump_Data(void *datain,int len) { int i=0; uint8_t *data=(uint8_t *)datain; - + for(i=0;iBFLB_BOOT2_READBUF_SIZE){ readLen=BFLB_BOOT2_READBUF_SIZE; } - + ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,readLen); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; @@ -124,7 +124,7 @@ static int32_t BLSP_MediaBot_Cal_Hash(uint32_t startAddr,uint32_t totalLen) /* Update hash*/ Sec_Eng_SHA256_Update(&shaCtx,SEC_ENG_SHA_ID0,(uint8_t *)boot2ReadBuf,readLen); //BLSP_Dump_Data((uint8_t *)boot2ReadBuf,readLen); - + addr+=readLen; dealLen+=readLen; } @@ -145,7 +145,7 @@ static int32_t BLSP_MediaBoot_Read_Signature(uint32_t addr,uint32_t *len) int32_t ret=BFLB_BOOT2_SUCCESS; uint32_t sig_len; uint8_t *ptmp; - + /* Read signature*/ ret=BLSP_MediaBoot_Read(addr,(uint8_t*)&sig_len,sizeof(sig_len)); if(ret!=BFLB_BOOT2_SUCCESS){ @@ -164,7 +164,7 @@ static int32_t BLSP_MediaBoot_Read_Signature(uint32_t addr,uint32_t *len) ARCH_MemCpy_Fast(boot2ReadBuf,&sig_len,sizeof(sig_len)); addr+=(sig_len+4); *len=sig_len; - + return ret; } @@ -183,7 +183,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ uint32_t addr=bootheaderAddr; int32_t ret; uint32_t sig_len; - + /* Read boot header*/ MSG_DBG("R header from %08x\r\n",addr); ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_Header_Config)); @@ -193,7 +193,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ if(BLSP_Boot2_Dump_Critical_Flag()){ BLSP_Dump_Data(boot2ReadBuf,sizeof(Boot_Header_Config)); } - + addr+=sizeof(Boot_Header_Config); ret=BLSP_Boot_Parse_BootHeader(bootImgCfg,(uint8_t *)boot2ReadBuf); if(ret!=BFLB_BOOT2_SUCCESS){ @@ -201,7 +201,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ } /* Due to OTA, the flashOffset is changed, so copy from partition info */ bootImgCfg->imgStart.flashOffset=imgAddr; - + /* If sign enable,get pk key and signature*/ if(bootImgCfg->signType){ /* Read public key */ @@ -217,7 +217,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_Boot_Parse_PKey(bootImgCfg,(uint8_t *)boot2ReadBuf,1); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } /* Read public key 2*/ MSG_DBG("R PK2\r\n"); ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_PK_Config)); @@ -248,7 +248,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ if(ret!=BFLB_BOOT2_SUCCESS){ return ret; } - + /* Read signature2*/ MSG_DBG("R SIG2\r\n"); BLSP_MediaBoot_Read_Signature(addr,&sig_len); @@ -266,7 +266,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ return ret; } } - + /* If encrypt enable,get AES key*/ if(bootImgCfg->encryptType){ /* Read aes iv*/ @@ -274,7 +274,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_MediaBoot_Read(addr,boot2ReadBuf,sizeof(Boot_AES_Config)); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } if(BLSP_Boot2_Dump_Critical_Flag()){ BLSP_Dump_Data(boot2ReadBuf,sizeof(Boot_AES_Config)); } @@ -284,7 +284,7 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ return ret; } } - + if(bootImgCfg->noSegment){ /* Flash image */ if(!bootImgCfg->hashIgnore){ @@ -302,12 +302,12 @@ static int32_t BLSP_MediaBoot_Parse_One_FW(Boot_Image_Config *bootImgCfg,uint32_ ret=BLSP_Boot_Parser_Check_Signature(bootImgCfg); if(ret!=BFLB_BOOT2_SUCCESS){ return ret; - } + } bootImgCfg->imgValid=1; }else{ bootImgCfg->imgValid=0; - } - + } + return ret; } @@ -350,9 +350,9 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8 uint32_t i=0; uint32_t validImgFound=0; uint32_t bootHeaderAddr[BFLB_BOOT2_CPU_MAX]; - + MSG_DBG("Media boot main\r\n"); - + /* Reset some parameters*/ for(i=0;iuser_data; + bfl_ble_mesh_gen_onoff_srv_t *srv = model->user_data; - switch (ctx->recv_op) { - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_GET: - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); - break; - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET: - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK: - if (set->op_en == false) { - srv->state.onoff = set->onoff; - } else { - /* TODO: Delay and state transition */ - srv->state.onoff = set->onoff; - } + switch (ctx->recv_op) { + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_GET: + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); + break; + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET: + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK: + if (set->op_en == false) { + srv->state.onoff = set->onoff; + } else { + /* TODO: Delay and state transition */ + srv->state.onoff = set->onoff; + } model_gen_cb(set->onoff); - if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) { - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); - } - bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, - sizeof(srv->state.onoff), &srv->state.onoff, ROLE_NODE); - break; - default: - break; - } + if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) { + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); + } + bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, + sizeof(srv->state.onoff), &srv->state.onoff, ROLE_NODE); + break; + default: + break; + } } @@ -197,39 +197,39 @@ static void example_ble_mesh_generic_server_cb(bfl_ble_mesh_generic_server_cb_ev #if defined(CONFIG_BT_MESH_MODEL_LIGHT_SRV) static void example_handle_light_lgn_msg(bfl_ble_mesh_model_t *model, - bfl_ble_mesh_msg_ctx_t *ctx, - bfl_ble_mesh_server_recv_light_lightness_set_t *set) + bfl_ble_mesh_msg_ctx_t *ctx, + bfl_ble_mesh_server_recv_light_lightness_set_t *set) { - bfl_ble_mesh_light_lightness_srv_t *srv = model->user_data; + bfl_ble_mesh_light_lightness_srv_t *srv = model->user_data; - switch (ctx->recv_op) { - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET: - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); - break; - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET: - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK: - if (set->op_en == false) { - srv->state->lightness_actual = set->lightness; - } else { - /* TODO: Delay and state transition */ - srv->state->lightness_actual = set->lightness; - } - if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET) { - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); - } - bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, - sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual, ROLE_NODE); - break; - default: - break; - } + switch (ctx->recv_op) { + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET: + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); + break; + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET: + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK: + if (set->op_en == false) { + srv->state->lightness_actual = set->lightness; + } else { + /* TODO: Delay and state transition */ + srv->state->lightness_actual = set->lightness; + } + if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET) { + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); + } + bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, + sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual, ROLE_NODE); + break; + default: + break; + } } static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_event_t event, - bfl_ble_mesh_lighting_server_cb_param_t *param) + bfl_ble_mesh_lighting_server_cb_param_t *param) { printf("event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x\n", event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst); @@ -241,19 +241,19 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK) { printf("Light lightness [%x]\n", param->value.state_change.lightness_set.lightness); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK) { - printf("Light ctl ln[%x]tp[%x]uv[%x]\n", - param->value.state_change.ctl_set.lightness, - param->value.state_change.ctl_set.temperature, - param->value.state_change.ctl_set.delta_uv); + printf("Light ctl ln[%x]tp[%x]uv[%x]\n", + param->value.state_change.ctl_set.lightness, + param->value.state_change.ctl_set.temperature, + param->value.state_change.ctl_set.delta_uv); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || - param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { - printf("Light hsl l[%x]h[%x]s[%x]\n", - param->value.state_change.hsl_set.lightness, - param->value.state_change.hsl_set.hue, - param->value.state_change.hsl_set.saturation); + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || + param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { + printf("Light hsl l[%x]h[%x]s[%x]\n", + param->value.state_change.hsl_set.lightness, + param->value.state_change.hsl_set.hue, + param->value.state_change.hsl_set.saturation); } break; case BFL_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT: @@ -263,20 +263,20 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ printf("onoff 0x%02x\n", srv->state->lightness_actual); example_handle_light_lgn_msg(param->model, ¶m->ctx, NULL); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_GET) { + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_GET) { bfl_ble_mesh_light_ctl_srv_t *srv = param->model->user_data; - printf("Light ctl ln[%x]ln_t[%x] tp[%x]tp_t[%x] uv[%x]uv_t[%x]\n", - srv->state->lightness, srv->state->target_lightness, - srv->state->temperature, srv->state->target_temperature, - srv->state->delta_uv, srv->state->target_delta_uv); + printf("Light ctl ln[%x]ln_t[%x] tp[%x]tp_t[%x] uv[%x]uv_t[%x]\n", + srv->state->lightness, srv->state->target_lightness, + srv->state->temperature, srv->state->target_temperature, + srv->state->delta_uv, srv->state->target_delta_uv); //example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_GET) { + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_GET) { bfl_ble_mesh_light_hsl_srv_t *srv = param->model->user_data; - printf("Light ctl l[%x]l_t[%x] h[%x]h_t[%x] s[%x]s_t[%x]\n", - srv->state->lightness, srv->state->target_lightness, - srv->state->hue, srv->state->target_hue, - srv->state->saturation, srv->state->target_saturation); + printf("Light ctl l[%x]l_t[%x] h[%x]h_t[%x] s[%x]s_t[%x]\n", + srv->state->lightness, srv->state->target_lightness, + srv->state->hue, srv->state->target_hue, + srv->state->saturation, srv->state->target_saturation); //example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } break; @@ -291,26 +291,26 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ } example_handle_light_lgn_msg(param->model, ¶m->ctx, ¶m->value.set.lightness); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK) { - printf("Light ctl ln[%x] tp[%d] uv[%x] tid[%x]\n", - param->value.set.ctl.lightness, - param->value.set.ctl.temperature, - param->value.set.ctl.delta_uv, - param->value.set.ctl.tid); + printf("Light ctl ln[%x] tp[%d] uv[%x] tid[%x]\n", + param->value.set.ctl.lightness, + param->value.set.ctl.temperature, + param->value.set.ctl.delta_uv, + param->value.set.ctl.tid); if (param->value.set.ctl.op_en) { printf("trans_time [%x], delay [%x]\n", param->value.set.ctl.trans_time, param->value.set.ctl.delay); } //example_handle_gen_onoff_msg(param->model, ¶m->ctx, ¶m->value.set.onoff); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { - printf("Light hsl l[%x] h[%d] s[%x] tid[%x]\n", - param->value.set.hsl.lightness, - param->value.set.hsl.hue, - param->value.set.hsl.saturation, - param->value.set.hsl.tid); + printf("Light hsl l[%x] h[%d] s[%x] tid[%x]\n", + param->value.set.hsl.lightness, + param->value.set.hsl.hue, + param->value.set.hsl.saturation, + param->value.set.hsl.tid); if (param->value.set.hsl.op_en) { printf("trans_time 0x%02x, delay 0x%02x\n", param->value.set.hsl.trans_time, param->value.set.hsl.delay); @@ -330,7 +330,7 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ #ifndef CONFIG_BT_TL void bt_enable_cb(int err) { - if (!err) { + if (!err) { ble_cli_register(); #if defined(CONFIG_BT_STACK_PTS) pts_cli_register(); @@ -340,15 +340,15 @@ void bt_enable_cb(int err) blemesh_cli_register(); #if defined(CONFIG_BT_MESH_MODEL) #if defined(CONFIG_BT_MESH_MODEL_GEN_SRV) - bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); - bfl_ble_mesh_register_generic_server_callback(example_ble_mesh_generic_server_cb); + bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); + bfl_ble_mesh_register_generic_server_callback(example_ble_mesh_generic_server_cb); #endif #if defined(CONFIG_BT_MESH_MODEL_LIGHT_SRV) - bfl_ble_mesh_register_lighting_server_callback(example_ble_mesh_lighting_server_cb); + bfl_ble_mesh_register_lighting_server_callback(example_ble_mesh_lighting_server_cb); #endif #else - bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); - mesh_gen_srv_callback_register(model_gen_cb); + bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); + mesh_gen_srv_callback_register(model_gen_cb); #endif /* CONFIG_BT_MESH_MODEL */ #endif diff --git a/customer_app/bl602_demo_event/bl602_demo_event/coex_debug.c b/customer_app/bl602_demo_event/bl602_demo_event/coex_debug.c index 58622361..20fe22aa 100644 --- a/customer_app/bl602_demo_event/bl602_demo_event/coex_debug.c +++ b/customer_app/bl602_demo_event/bl602_demo_event/coex_debug.c @@ -34,7 +34,7 @@ void coex_dump_pta(void); void coex_dump_wifi(void); void coex_dump_ble(void); -static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) +static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) { coex_dump_pta(); coex_dump_wifi(); @@ -43,14 +43,14 @@ static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { { "coex_dump", "coex dump", cmd_coex_dump}, -}; +}; int codex_debug_cli_init() { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/bl602_demo_event/bl602_demo_event/main.c b/customer_app/bl602_demo_event/bl602_demo_event/main.c old mode 100755 new mode 100644 index 7e7e7320..aa60b03f --- a/customer_app/bl602_demo_event/bl602_demo_event/main.c +++ b/customer_app/bl602_demo_event/bl602_demo_event/main.c @@ -173,7 +173,7 @@ void vApplicationSleep( TickType_t xExpectedIdleTime_ms ) if(xExpectedIdleTime_ms + xTaskGetTickCount() == portMAX_DELAY){ freertos_max_idle = true; - }else{ + }else{ xExpectedIdleTime_ms -= 1; expectedIdleTime_32768cycles = 32768 * xExpectedIdleTime_ms / 1000; } @@ -189,7 +189,7 @@ void vApplicationSleep( TickType_t xExpectedIdleTime_ms ) if(eSleepStatus == eAbortSleep || ble_controller_sleep_is_ongoing()) { /*A task has been moved out of the Blocked state since this macro was - executed, or a context siwth is being held pending.Restart the tick + executed, or a context siwth is being held pending.Restart the tick and exit the critical section. */ /*Enable mtimer interrrupt*/ *(volatile uint8_t*)configCLIC_TIMER_ENABLE_ADDRESS = 1; @@ -199,9 +199,9 @@ void vApplicationSleep( TickType_t xExpectedIdleTime_ms ) bleSleepDuration_32768cycles = ble_controller_sleep(); - if(bleSleepDuration_32768cycles < TIME_5MS_IN_32768CYCLE) + if(bleSleepDuration_32768cycles < TIME_5MS_IN_32768CYCLE) { - /*BLE controller does not allow sleep. Do not enter a sleep state.Restart the tick + /*BLE controller does not allow sleep. Do not enter a sleep state.Restart the tick and exit the critical section. */ /*Enable mtimer interrrupt*/ //printf("%s:not do pds sleep\r\n", __func__); @@ -992,7 +992,7 @@ static void cmd_align(char *buf, int len, int argc, char **argv) if (!testbuf) { log_error("mem error.\r\n"); } - + memset(testbuf, 0xEE, 1024); for (i = 0; i < 32; i++) { testbuf[i] = i; @@ -1131,7 +1131,7 @@ static void aos_loop_proc(void *pvParameters) uint32_t fdt = 0, offset = 0; static StackType_t proc_stack_looprt[512]; static StaticTask_t proc_task_looprt; - + /*Init bloop stuff*/ looprt_start(proc_stack_looprt, 512, &proc_task_looprt); loopset_led_hook_on_looprt(); @@ -1202,7 +1202,7 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. Note that, as the array is necessarily of type StackType_t, configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - //*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + //*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; *pulIdleTaskStackSize = 512;//size 512 words is For ble pds mode, otherwise stack overflow of idle task will happen. } diff --git a/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_ble_wifi/bl602_demo_event_RPI_ble_wifi_tc_test.py b/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_ble_wifi/bl602_demo_event_RPI_ble_wifi_tc_test.py index ce52aa0e..8046c6b0 100644 --- a/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_ble_wifi/bl602_demo_event_RPI_ble_wifi_tc_test.py +++ b/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_ble_wifi/bl602_demo_event_RPI_ble_wifi_tc_test.py @@ -36,12 +36,12 @@ def bl602_demo_event_RPI_ble_wifi_tc(env, extra_data): dut.expect("Register auth callback successfully", timeout=1) dut.write('ble_start_adv 0 0 0x80 0x80') dut.expect("Advertising started", timeout=1) - + dut.write('ble_read_local_address') local_addr = dut.expect(re.compile(r"Local public addr : (.*) "), timeout=2) print(f'Local public addr {local_addr[0]}') # scan bluetooth - + rst = scan_device(local_addr[0]) if rst != True: raise Exception @@ -85,7 +85,7 @@ def bl602_demo_event_RPI_ble_wifi_tc(env, extra_data): dut.expect("Register auth callback successfully", timeout=1) dut.write('ble_start_adv 0 0 0x80 0x80') dut.expect("Advertising started", timeout=1) - + dut.write('ble_read_local_address') local_addr = dut.expect(re.compile(r"Local public addr : (.*) "), timeout=2) print(f'Local public addr is {local_addr[0]}') @@ -115,7 +115,7 @@ def scan_device(mac): result_list = line.decode('utf-8').split('\n') except: result_list = line.decode('gbk').split('\n') - + finally: rst = rst + result_list @@ -133,7 +133,7 @@ def scan_device(mac): return False def connect_device(mac): - + conn = btle.Peripheral(mac, "public") print("BLE is connected") #conn.disconnect() diff --git a/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_wifi_ap/bl602_demo_event_RPI_wifi_ap_tc_test.py b/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_wifi_ap/bl602_demo_event_RPI_wifi_ap_tc_test.py index c768c92a..0174071a 100644 --- a/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_wifi_ap/bl602_demo_event_RPI_wifi_ap_tc_test.py +++ b/customer_app/bl602_demo_event/tests/bl602_demo_event_RPI_wifi_ap/bl602_demo_event_RPI_wifi_ap_tc_test.py @@ -35,7 +35,7 @@ def bl602_demo_event_RPI_wifi_ap_tc(env, extra_data): rst = connect_device(ap_ssid[0]) if rst != True: raise Exception - + dut.halt() except Exception: print('ENV_TEST_FAILURE: BL602 ble_wifi test failed') diff --git a/customer_app/bl602_demo_nano/bl602_demo_nano/ble.c b/customer_app/bl602_demo_nano/bl602_demo_nano/ble.c index ca175504..364e8434 100644 --- a/customer_app/bl602_demo_nano/bl602_demo_nano/ble.c +++ b/customer_app/bl602_demo_nano/bl602_demo_nano/ble.c @@ -65,7 +65,7 @@ #if defined(CONFIG_BT_WIFIPROV_SERVER) static void wifiprov_connect_ap_ind(void) { - printf("Recevied indication to connect to AP\r\n"); + printf("Recevied indication to connect to AP\r\n"); wifi_prov_api_event_trigger_connect(); } @@ -83,7 +83,7 @@ static void wifiprov_ssid_ind(void *buf,size_t size) static void wifiprov_bssid_ind(void *buf,size_t size) { - + printf("Recevied bssid: %s \r\n", bt_hex(buf, size)); } @@ -94,11 +94,11 @@ static void wifiprov_password_ind(void *buf,size_t size) } struct conn_callback WifiProv_conn_callback = { - .local_connect_remote_ap = wifiprov_connect_ap_ind, - .local_disconnect_remote_ap = wifiprov_disc_from_ap_ind, - .get_remote_ap_ssid = wifiprov_ssid_ind, - .get_remote_ap_bssid = wifiprov_bssid_ind, - .get_remote_password = wifiprov_password_ind, + .local_connect_remote_ap = wifiprov_connect_ap_ind, + .local_disconnect_remote_ap = wifiprov_disc_from_ap_ind, + .get_remote_ap_ssid = wifiprov_ssid_ind, + .get_remote_ap_bssid = wifiprov_bssid_ind, + .get_remote_password = wifiprov_password_ind, }; #endif @@ -111,40 +111,40 @@ struct conn_callback WifiProv_conn_callback = { void model_gen_cb(uint8_t value) { - bl_gpio_output_set(LED_PIN, value); + bl_gpio_output_set(LED_PIN, value); } #if defined(CONFIG_BT_MESH_MODEL) static void example_handle_gen_onoff_msg(bfl_ble_mesh_model_t *model, - bfl_ble_mesh_msg_ctx_t *ctx, - bfl_ble_mesh_server_recv_gen_onoff_set_t *set) + bfl_ble_mesh_msg_ctx_t *ctx, + bfl_ble_mesh_server_recv_gen_onoff_set_t *set) { - bfl_ble_mesh_gen_onoff_srv_t *srv = model->user_data; + bfl_ble_mesh_gen_onoff_srv_t *srv = model->user_data; - switch (ctx->recv_op) { - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_GET: - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); - break; - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET: - case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK: - if (set->op_en == false) { - srv->state.onoff = set->onoff; - } else { - /* TODO: Delay and state transition */ - srv->state.onoff = set->onoff; - } + switch (ctx->recv_op) { + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_GET: + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); + break; + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET: + case BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK: + if (set->op_en == false) { + srv->state.onoff = set->onoff; + } else { + /* TODO: Delay and state transition */ + srv->state.onoff = set->onoff; + } model_gen_cb(set->onoff); - if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) { - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); - } - bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, - sizeof(srv->state.onoff), &srv->state.onoff, ROLE_NODE); - break; - default: - break; - } + if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) { + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); + } + bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, + sizeof(srv->state.onoff), &srv->state.onoff, ROLE_NODE); + break; + default: + break; + } } @@ -193,39 +193,39 @@ static void example_ble_mesh_generic_server_cb(bfl_ble_mesh_generic_server_cb_ev #if defined(CONFIG_BT_MESH_MODEL_LIGHT_SRV) static void example_handle_light_lgn_msg(bfl_ble_mesh_model_t *model, - bfl_ble_mesh_msg_ctx_t *ctx, - bfl_ble_mesh_server_recv_light_lightness_set_t *set) + bfl_ble_mesh_msg_ctx_t *ctx, + bfl_ble_mesh_server_recv_light_lightness_set_t *set) { - bfl_ble_mesh_light_lightness_srv_t *srv = model->user_data; + bfl_ble_mesh_light_lightness_srv_t *srv = model->user_data; - switch (ctx->recv_op) { - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET: - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); - break; - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET: - case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK: - if (set->op_en == false) { - srv->state->lightness_actual = set->lightness; - } else { - /* TODO: Delay and state transition */ - srv->state->lightness_actual = set->lightness; - } - if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET) { - bfl_ble_mesh_server_model_send_msg(model, ctx, - BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); - } - bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, - sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual, ROLE_NODE); - break; - default: - break; - } + switch (ctx->recv_op) { + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET: + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); + break; + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET: + case BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK: + if (set->op_en == false) { + srv->state->lightness_actual = set->lightness; + } else { + /* TODO: Delay and state transition */ + srv->state->lightness_actual = set->lightness; + } + if (ctx->recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET) { + bfl_ble_mesh_server_model_send_msg(model, ctx, + BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual); + } + bfl_ble_mesh_model_publish(model, BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS, + sizeof(srv->state->lightness_actual), (uint8_t*)&srv->state->lightness_actual, ROLE_NODE); + break; + default: + break; + } } static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_event_t event, - bfl_ble_mesh_lighting_server_cb_param_t *param) + bfl_ble_mesh_lighting_server_cb_param_t *param) { printf("event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x\n", event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst); @@ -237,19 +237,19 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK) { printf("Light lightness [%x]\n", param->value.state_change.lightness_set.lightness); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK) { - printf("Light ctl ln[%x]tp[%x]uv[%x]\n", - param->value.state_change.ctl_set.lightness, - param->value.state_change.ctl_set.temperature, - param->value.state_change.ctl_set.delta_uv); + printf("Light ctl ln[%x]tp[%x]uv[%x]\n", + param->value.state_change.ctl_set.lightness, + param->value.state_change.ctl_set.temperature, + param->value.state_change.ctl_set.delta_uv); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || - param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { - printf("Light hsl l[%x]h[%x]s[%x]\n", - param->value.state_change.hsl_set.lightness, - param->value.state_change.hsl_set.hue, - param->value.state_change.hsl_set.saturation); + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || + param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { + printf("Light hsl l[%x]h[%x]s[%x]\n", + param->value.state_change.hsl_set.lightness, + param->value.state_change.hsl_set.hue, + param->value.state_change.hsl_set.saturation); } break; case BFL_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT: @@ -259,20 +259,20 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ printf("onoff 0x%02x\n", srv->state->lightness_actual); example_handle_light_lgn_msg(param->model, ¶m->ctx, NULL); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_GET) { + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_GET) { bfl_ble_mesh_light_ctl_srv_t *srv = param->model->user_data; - printf("Light ctl ln[%x]ln_t[%x] tp[%x]tp_t[%x] uv[%x]uv_t[%x]\n", - srv->state->lightness, srv->state->target_lightness, - srv->state->temperature, srv->state->target_temperature, - srv->state->delta_uv, srv->state->target_delta_uv); + printf("Light ctl ln[%x]ln_t[%x] tp[%x]tp_t[%x] uv[%x]uv_t[%x]\n", + srv->state->lightness, srv->state->target_lightness, + srv->state->temperature, srv->state->target_temperature, + srv->state->delta_uv, srv->state->target_delta_uv); //example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_GET) { + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_GET) { bfl_ble_mesh_light_hsl_srv_t *srv = param->model->user_data; - printf("Light ctl l[%x]l_t[%x] h[%x]h_t[%x] s[%x]s_t[%x]\n", - srv->state->lightness, srv->state->target_lightness, - srv->state->hue, srv->state->target_hue, - srv->state->saturation, srv->state->target_saturation); + printf("Light ctl l[%x]l_t[%x] h[%x]h_t[%x] s[%x]s_t[%x]\n", + srv->state->lightness, srv->state->target_lightness, + srv->state->hue, srv->state->target_hue, + srv->state->saturation, srv->state->target_saturation); //example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } break; @@ -287,26 +287,26 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ } example_handle_light_lgn_msg(param->model, ¶m->ctx, ¶m->value.set.lightness); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK) { - printf("Light ctl ln[%x] tp[%d] uv[%x] tid[%x]\n", - param->value.set.ctl.lightness, - param->value.set.ctl.temperature, - param->value.set.ctl.delta_uv, - param->value.set.ctl.tid); + printf("Light ctl ln[%x] tp[%d] uv[%x] tid[%x]\n", + param->value.set.ctl.lightness, + param->value.set.ctl.temperature, + param->value.set.ctl.delta_uv, + param->value.set.ctl.tid); if (param->value.set.ctl.op_en) { printf("trans_time [%x], delay [%x]\n", param->value.set.ctl.trans_time, param->value.set.ctl.delay); } //example_handle_gen_onoff_msg(param->model, ¶m->ctx, ¶m->value.set.onoff); } - else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || + else if (param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET || param->ctx.recv_op == BFL_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK) { - printf("Light hsl l[%x] h[%d] s[%x] tid[%x]\n", - param->value.set.hsl.lightness, - param->value.set.hsl.hue, - param->value.set.hsl.saturation, - param->value.set.hsl.tid); + printf("Light hsl l[%x] h[%d] s[%x] tid[%x]\n", + param->value.set.hsl.lightness, + param->value.set.hsl.hue, + param->value.set.hsl.saturation, + param->value.set.hsl.tid); if (param->value.set.hsl.op_en) { printf("trans_time 0x%02x, delay 0x%02x\n", param->value.set.hsl.trans_time, param->value.set.hsl.delay); @@ -325,7 +325,7 @@ static void example_ble_mesh_lighting_server_cb(bfl_ble_mesh_lighting_server_cb_ void bt_enable_cb(int err) { - if (!err) { + if (!err) { ble_cli_register(); #if defined(CONFIG_BT_STACK_PTS) pts_cli_register(); @@ -335,15 +335,15 @@ void bt_enable_cb(int err) blemesh_cli_register(); #if defined(CONFIG_BT_MESH_MODEL) #if defined(CONFIG_BT_MESH_MODEL_GEN_SRV) - bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); - bfl_ble_mesh_register_generic_server_callback(example_ble_mesh_generic_server_cb); + bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); + bfl_ble_mesh_register_generic_server_callback(example_ble_mesh_generic_server_cb); #endif #if defined(CONFIG_BT_MESH_MODEL_LIGHT_SRV) - bfl_ble_mesh_register_lighting_server_callback(example_ble_mesh_lighting_server_cb); + bfl_ble_mesh_register_lighting_server_callback(example_ble_mesh_lighting_server_cb); #endif #else - bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); - mesh_gen_srv_callback_register(model_gen_cb); + bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW); + mesh_gen_srv_callback_register(model_gen_cb); #endif /* CONFIG_BT_MESH_MODEL */ #endif diff --git a/customer_app/bl602_demo_nano/bl602_demo_nano/coex_debug.c b/customer_app/bl602_demo_nano/bl602_demo_nano/coex_debug.c index 58622361..20fe22aa 100644 --- a/customer_app/bl602_demo_nano/bl602_demo_nano/coex_debug.c +++ b/customer_app/bl602_demo_nano/bl602_demo_nano/coex_debug.c @@ -34,7 +34,7 @@ void coex_dump_pta(void); void coex_dump_wifi(void); void coex_dump_ble(void); -static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) +static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) { coex_dump_pta(); coex_dump_wifi(); @@ -43,14 +43,14 @@ static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { { "coex_dump", "coex dump", cmd_coex_dump}, -}; +}; int codex_debug_cli_init() { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/bl602_demo_nano/bl602_demo_nano/main.c b/customer_app/bl602_demo_nano/bl602_demo_nano/main.c old mode 100755 new mode 100644 diff --git a/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/coex_debug.c b/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/coex_debug.c index bad43db5..2bcefc02 100644 --- a/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/coex_debug.c +++ b/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/coex_debug.c @@ -33,7 +33,7 @@ void coex_dump_pta(void); void coex_dump_wifi(void); -static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) +static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) { coex_dump_pta(); coex_dump_wifi(); @@ -41,14 +41,14 @@ static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { { "coex_dump", "coex dump", cmd_coex_dump}, -}; +}; int codex_debug_cli_init() { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/main.c b/customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/main.c old mode 100755 new mode 100644 diff --git a/customer_app/bl602_demo_wifi/bl602_demo_wifi/aws_iot_main.c b/customer_app/bl602_demo_wifi/bl602_demo_wifi/aws_iot_main.c index 065296dd..8de2da75 100644 --- a/customer_app/bl602_demo_wifi/bl602_demo_wifi/aws_iot_main.c +++ b/customer_app/bl602_demo_wifi/bl602_demo_wifi/aws_iot_main.c @@ -127,8 +127,8 @@ #define USR_AWS_IOT_CONFIG_FILE "/romfs/aws/config" ///< Device private key filename #define AWS_IOT_MQTT_HOST "ap3im43fimllm-ats.iot.us-east-1.amazonaws.com" #define AWS_IOT_MQTT_PORT 443 ///< default port for MQTT/S -#define AWS_IOT_MQTT_CLIENT_ID "bl60xDevRjwang" -#define AWS_IOT_MY_THING_NAME "bl60xDevRjwang" +#define AWS_IOT_MQTT_CLIENT_ID "bl60xDevRjwang" +#define AWS_IOT_MY_THING_NAME "bl60xDevRjwang" #define ROOMTEMPERATURE_UPPERLIMIT 32.0f #define ROOMTEMPERATURE_LOWERLIMIT 25.0f @@ -311,7 +311,7 @@ static int _update_mqtt_config_default(ShadowInitParameters_t *sp, ShadowConnect return 0; } -void aws_main_entry(void *param) +void aws_main_entry(void *param) { IoT_Error_t rc = FAILURE; ShadowInitParameters_t sp = ShadowInitParametersDefault; diff --git a/customer_app/bl602_demo_wifi/bl602_demo_wifi/coex_debug.c b/customer_app/bl602_demo_wifi/bl602_demo_wifi/coex_debug.c index bad43db5..2bcefc02 100644 --- a/customer_app/bl602_demo_wifi/bl602_demo_wifi/coex_debug.c +++ b/customer_app/bl602_demo_wifi/bl602_demo_wifi/coex_debug.c @@ -33,7 +33,7 @@ void coex_dump_pta(void); void coex_dump_wifi(void); -static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) +static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, char **argv) { coex_dump_pta(); coex_dump_wifi(); @@ -41,14 +41,14 @@ static void __attribute__((unused)) cmd_coex_dump(char *buf, int len, int argc, const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { { "coex_dump", "coex dump", cmd_coex_dump}, -}; +}; int codex_debug_cli_init() { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/bl602_demo_wifi/bl602_demo_wifi/main.c b/customer_app/bl602_demo_wifi/bl602_demo_wifi/main.c old mode 100755 new mode 100644 diff --git a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_RPI_iperf/bl602_demo_wifi_RPI_iperf_tc_test.py b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_RPI_iperf/bl602_demo_wifi_RPI_iperf_tc_test.py index fd096b65..7189851a 100644 --- a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_RPI_iperf/bl602_demo_wifi_RPI_iperf_tc_test.py +++ b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_RPI_iperf/bl602_demo_wifi_RPI_iperf_tc_test.py @@ -57,12 +57,12 @@ def bl602_demo_wifi_RPI_iperf_tc(env, extra_data): if check_result == 'failed': print("ipu failed!") test_num+=1 - + check_result = check_board_log_result(action_cmd, board_log_name) if check_result == 'failed': print("ipu failed!") test_num+=1 - + elif action_cmd == 'ipc': implement_time = '15' board_cmd = "ipc {}".format(RPI_ip) @@ -76,7 +76,7 @@ def bl602_demo_wifi_RPI_iperf_tc(env, extra_data): if check_result == 'failed': print("ipc failed!") test_num+=1 - + check_result = check_board_log_result(action_cmd, board_log_name) if check_result == 'failed': print("ipc failed!") @@ -95,7 +95,7 @@ def bl602_demo_wifi_RPI_iperf_tc(env, extra_data): if check_result == 'failed': print("ipc failed!") test_num+=1 - + check_result = check_board_log_result(action_cmd, board_log_name) if check_result == 'failed': print("ipc failed!") @@ -114,7 +114,7 @@ def bl602_demo_wifi_RPI_iperf_tc(env, extra_data): if check_result == 'failed': print("ipc failed!") test_num+=1 - + check_result = check_board_log_result(action_cmd, board_log_name) if check_result == 'failed': print("ipc failed!") @@ -122,7 +122,7 @@ def bl602_demo_wifi_RPI_iperf_tc(env, extra_data): else: print('endif') - + if test_num != 0: raise Exception @@ -184,13 +184,13 @@ def check_board_log_result(action_cmd, log_name): with open(log_name, 'rb') as f: lines_data = f.readlines() if action_cmd == 'ipc': - find_iperf_speed_line('ipc ', lines_data) + find_iperf_speed_line('ipc ', lines_data) elif action_cmd == 'ips': - find_iperf_speed_line('ips', lines_data) + find_iperf_speed_line('ips', lines_data) elif action_cmd == 'ipu': - find_iperf_speed_line('ipu ', lines_data) + find_iperf_speed_line('ipu ', lines_data) elif action_cmd == 'ipus': - find_iperf_speed_line('ipus', lines_data) + find_iperf_speed_line('ipus', lines_data) else: pass # f.close() @@ -249,7 +249,7 @@ def write_log(iperf_log_name, result, timeout): with open(iperf_log_name, mode='w') as fhandle: start_time = time.perf_counter() #print('start_time = {}'.format(start_time)) - while True: + while True: cur_time = time.perf_counter() #print('cur_time = {}'.format(cur_time)) if cur_time - start_time < float(timeout): diff --git a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_capcode_tc_test.py b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_capcode_tc_test.py index f940883a..d5ac020f 100644 --- a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_capcode_tc_test.py +++ b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_capcode_tc_test.py @@ -36,15 +36,15 @@ def bl602_demo_wifi_capcode_tc(env, extra_data): bssid1 = os.getenv('ROUTER_SSID_FOR_PPM1') bssid2 = os.getenv('ROUTER_SSID_FOR_PPM2') bssid3 = os.getenv('ROUTER_SSID_FOR_PPM3') - + str_str1 = (regexp_str, bssid1) str_str2 = (regexp_str, bssid2) str_str3 = (regexp_str, bssid3) - + search_str1 = " ".join(str_str1) search_str2 = " ".join(str_str2) search_str3 = " ".join(str_str3) - + dev1 = re.search(search_str1, list_all[0]) dev2 = re.search(search_str2, list_all[0]) dev3 = re.search(search_str3, list_all[0]) @@ -55,25 +55,25 @@ def bl602_demo_wifi_capcode_tc(env, extra_data): dev1_num = dev1.group(1) if (math.fabs(int(dev1_num)) > 5) : print(f'use dev1:{bssid1}, ppm need calibration {dev1_num}') - raise Exception("ppm need calibration") + raise Exception("ppm need calibration") else: print(f'use dev1:{bssid1}, ppm is accurate {dev1_num}') elif (dev2 != None) : dev2_num = dev2.group(1) if (math.fabs(int(dev2_num)) > 5) : print(f'use dev2:{bssid2}, ppm need calibration {dev2_num}') - raise Exception("ppm need calibration") + raise Exception("ppm need calibration") else: print(f'use dev2:{bssid2}, ppm is accurate {dev2_num}') elif (dev3 != None) : dev3_num = dev3.group(1) if (math.fabs(int(dev3_num)) > 5) : print(f'use dev3:{bssid3}, ppm need calibration {dev3_num}') - raise Exception("ppm need calibration") + raise Exception("ppm need calibration") else: print(f'use dev3:{bssid3}, ppm is accurate {dev3_num}') else : - raise Exception("No test equipment available") + raise Exception("No test equipment available") dut.halt() diff --git a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_manager_tc_test.py b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_manager_tc_test.py index 76ca2a17..be65a668 100644 --- a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_manager_tc_test.py +++ b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_manager_tc_test.py @@ -31,7 +31,7 @@ def bl602_demo_wifi_manager_tc(env, extra_data): dut.write('wifi_sta_connect bl_test 12345678') dut.expect("Reason: SSID error, scan no bssid and channel", timeout=10) print('case1:SSID error test successed') - + print('To reboot BL602') dut.write('reboot') dut.expect("Booting BL602 Chip...", timeout=0.5) @@ -45,7 +45,7 @@ def bl602_demo_wifi_manager_tc(env, extra_data): dut.write(cmd_wifi_connect) dut.expect("Reason: Passwd error, 4-way handshake timeout", timeout=20) print('case2:Passwd error test successed') - + print('To reboot BL602') dut.write('reboot') dut.expect("Booting BL602 Chip...", timeout=0.5) @@ -62,11 +62,11 @@ def bl602_demo_wifi_manager_tc(env, extra_data): dut.expect("Entering wifiConnected_IPOK state", timeout=20) print('case3:connect wifi test successed') print('Please power off router!') - + #cmd = "ssh xiaohei@192.168.4.145 'cd /home/xiaohei/PycharmProjects/router_auto_test/ ; python3 test.py close_wifi'" #subprocess.call(cmd, shell=True) #dut.expect("Reason: Beacon Loss", timeout=20) - + print('case4:Beacon Loss test successed') dut.halt() diff --git a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_ota_tc_test.py b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_ota_tc_test.py index 2b1f2dc8..132c82f6 100644 --- a/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_ota_tc_test.py +++ b/customer_app/bl602_demo_wifi/tests/bl602_demo_wifi_ota_tc_test.py @@ -44,7 +44,7 @@ def bl602_demo_wifi_ota_tc(env, extra_data): dut.write(cmd_wifi_connect) dut.expect("Entering wifiConnected_IPOK state", timeout=30) - #get host ip + #get host ip ip = get_ip_address(bytes('eth0', encoding = "utf8")) print(ip) @@ -54,7 +54,7 @@ def bl602_demo_wifi_ota_tc(env, extra_data): ota_path = path + '/tools/flash_tool/bl602/ota' p = subprocess.Popen('cat FW_OTA.bin.xz.ota | nc -l 3333', shell=True, cwd=ota_path) print(p.pid) - + cmd = 'ota_tcp' + ' ' + ip dut.write(cmd) time.sleep(0.5) @@ -68,11 +68,11 @@ def bl602_demo_wifi_ota_tc(env, extra_data): new_age = int(dev1.group(5)) print(new_age) else: - raise Exception("no match") + raise Exception("no match") if new_age != old_age + 2: raise Exception("ota failed") - + #os.killpg(os.getpgid(p.pid),9) nc=processinfo('nc') cat=processinfo('cat') diff --git a/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.c b/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.c index 74858f03..19f4aef7 100644 --- a/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.c +++ b/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.c @@ -43,7 +43,7 @@ static void wifiprov_connect_ap_ind(struct wifi_conn *info) { extern int wifi_mgmr_status_code_clean_internal(); wifi_mgmr_status_code_clean_internal(); - printf("Recevied indication to connect to AP\r\n"); + printf("Recevied indication to connect to AP\r\n"); wifi_prov_api_event_trigger_connect(info); } @@ -73,10 +73,10 @@ static void blesync_complete_cb (void *p_arg) } static struct blesync_wifi_func WifiProv_conn_callback = { - .local_connect_remote_ap = wifiprov_connect_ap_ind, - .local_disconnect_remote_ap = wifiprov_disc_from_ap_ind, - .local_wifi_scan = wifiprov_wifi_scan, - .local_wifi_state_get = wifiprov_api_state_get, + .local_connect_remote_ap = wifiprov_connect_ap_ind, + .local_disconnect_remote_ap = wifiprov_disc_from_ap_ind, + .local_wifi_scan = wifiprov_wifi_scan, + .local_wifi_state_get = wifiprov_api_state_get, }; static void blsync_init(int err) diff --git a/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.h b/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.h index 25f6d8a3..6bda8646 100644 --- a/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.h +++ b/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/blsync_ble_app.h @@ -34,4 +34,4 @@ void blsync_ble_start (void); void blsync_ble_stop (void); -#endif +#endif diff --git a/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/main.c b/customer_app/sdk_app_ble_sync/sdk_app_ble_sync/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_blog/sdk_app_blog/main.c b/customer_app/sdk_app_blog/sdk_app_blog/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_cli/sdk_app_cli/demo.c b/customer_app/sdk_app_cli/sdk_app_cli/demo.c index afef3696..8d9269d5 100644 --- a/customer_app/sdk_app_cli/sdk_app_cli/demo.c +++ b/customer_app/sdk_app_cli/sdk_app_cli/demo.c @@ -37,7 +37,7 @@ static void cmd_cli(char *buf, int len, int argc, char **argv) } const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { - {"test", "cli test", cmd_cli}, + {"test", "cli test", cmd_cli}, }; int test_cli_init(void) diff --git a/customer_app/sdk_app_cli/sdk_app_cli/main.c b/customer_app/sdk_app_cli/sdk_app_cli/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/demo.c b/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/demo.c index 24417db8..03e7ebf0 100644 --- a/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/demo.c +++ b/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/demo.c @@ -145,7 +145,7 @@ static void cmd_test_seconds(char *buf, int len, int argc, char **argv) static void cmd_test_minutes(char *buf, int len, int argc, char **argv) { cron_alarm_create("27 44 9 * * *", test_min01, 0); // every 9:44:27 - cron_alarm_create("0 */1 * * * *", test_min02, 0); // timer for every 1 minutes + cron_alarm_create("0 */1 * * * *", test_min02, 0); // timer for every 1 minutes cron_alarm_create("15 3 * * * *", test_min03, 1); // 3 minutes run once return; } @@ -232,7 +232,7 @@ static void cmd_add_week(char *buf, int len, int argc, char **argv) cronal_time(604800 * num); } else { } - + return; } diff --git a/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/main.c b/customer_app/sdk_app_cronalarm/sdk_app_cronalarm/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_dac/Makefile b/customer_app/sdk_app_dac/Makefile index db502db3..7b40373a 100644 --- a/customer_app/sdk_app_dac/Makefile +++ b/customer_app/sdk_app_dac/Makefile @@ -20,7 +20,7 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 diff --git a/customer_app/sdk_app_dac/sdk_app_dac/dac_audio.c b/customer_app/sdk_app_dac/sdk_app_dac/dac_audio.c index cd313b9a..d9e93d6b 100644 --- a/customer_app/sdk_app_dac/sdk_app_dac/dac_audio.c +++ b/customer_app/sdk_app_dac/sdk_app_dac/dac_audio.c @@ -170,7 +170,7 @@ static void DAC_LLI_Init(uint32_t *psrc, uint32_t bufsize) } LLIList[i].dmaCtrl= dmaCtrlRegVal; } - + LLIList[i - 1].nextLLI=(uint32_t)&LLIList[0]; diff --git a/customer_app/sdk_app_dac/sdk_app_dac/demo.c b/customer_app/sdk_app_dac/sdk_app_dac/demo.c index d9c49941..4d4201be 100644 --- a/customer_app/sdk_app_dac/sdk_app_dac/demo.c +++ b/customer_app/sdk_app_dac/sdk_app_dac/demo.c @@ -32,7 +32,7 @@ #include #include "bl_gpio.h" -static void cmd_gpio_func(char *buf, int len, int argc, char **argv) +static void cmd_gpio_func(char *buf, int len, int argc, char **argv) { int ionum = -1, inputmode = -1, pullup = -1, pulldown = -1; @@ -63,7 +63,7 @@ static void cmd_gpio_func(char *buf, int len, int argc, char **argv) } } -static void cmd_gpio_set(char *buf, int len, int argc, char **argv) +static void cmd_gpio_set(char *buf, int len, int argc, char **argv) { int ionum = -1, val = -1; @@ -86,7 +86,7 @@ static void cmd_gpio_set(char *buf, int len, int argc, char **argv) bl_gpio_output_set(ionum, val ? 1 : 0); } -static void cmd_gpio_get(char *buf, int len, int argc, char **argv) +static void cmd_gpio_get(char *buf, int len, int argc, char **argv) { int ionum = -1, ret; uint8_t val; @@ -114,13 +114,13 @@ const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { {"gpio-func", "gpio-func pinnum 0/1[0:output, 1:input] 0/1[pullup] 0/1[pulldown]", cmd_gpio_func}, {"gpio-set", "gpio-set pinnum 0/1", cmd_gpio_set}, {"gpio-get", "gpio-get pinnum", cmd_gpio_get}, -}; +}; int gpio_cli_init(void) { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_dac/sdk_app_dac/main.c b/customer_app/sdk_app_dac/sdk_app_dac/main.c old mode 100755 new mode 100644 index 6e4be750..f02171e8 --- a/customer_app/sdk_app_dac/sdk_app_dac/main.c +++ b/customer_app/sdk_app_dac/sdk_app_dac/main.c @@ -134,7 +134,7 @@ static void cmd_play_audio(char *buf, int len, int argc, char **argv) romfs_filebuf_t filebuf; uint16_t *p_u16addr; uint32_t bufsize; - + fd_audio = aos_open("/romfs/audio_32k", 0); if (fd_audio < 0) { @@ -144,12 +144,12 @@ static void cmd_play_audio(char *buf, int len, int argc, char **argv) aos_ioctl(fd_audio, IOCTL_ROMFS_GET_FILEBUF, (long unsigned int)&filebuf); aos_close(fd_audio); - // From a long unsigned int* to a uint16_t* should be a NOP, even + // From a long unsigned int* to a uint16_t* should be a NOP, even // considering alignment. p_u16addr = (uint16_t*) filebuf.buf; bufsize = filebuf.bufsize; - - audio_dac_dma_test(p_u16addr, bufsize, sampling); + + audio_dac_dma_test(p_u16addr, bufsize, sampling); return; @@ -176,7 +176,7 @@ static void aos_loop_proc(void *pvParameters) if (0 == get_dts_addr("uart", &fdt, &offset)) { vfs_uart_init(fdt, offset); } - + #ifdef CONF_USER_ENABLE_VFS_ROMFS romfs_register(); printf("romfs register \r\n"); @@ -194,8 +194,8 @@ static void aos_loop_proc(void *pvParameters) aos_poll_read_fd(fd_console, aos_cli_event_cb_read_get(), (void*)0x12345678); _cli_init(); } - - + + aos_loop_run(); puts("------------------------------------------\r\n"); diff --git a/customer_app/sdk_app_dac/tests/sdk_app_gpio_tc_test.py b/customer_app/sdk_app_dac/tests/sdk_app_gpio_tc_test.py index 26ebf642..febd3eac 100644 --- a/customer_app/sdk_app_dac/tests/sdk_app_gpio_tc_test.py +++ b/customer_app/sdk_app_dac/tests/sdk_app_gpio_tc_test.py @@ -25,13 +25,13 @@ def sdk_app_gpio_tc(env, extra_data): dut.write('gpio-func 8 0 0 0') dut.expect("GPIO8 is set output with null pullup null pulldown", timeout=1) - + dut.write('gpio-set 8 1') dut.expect("GPIO8 is set to high", timeout=1) dut.write('gpio-set 8 0') dut.expect("GPIO8 is set to lo", timeout=1) - + dut.write('gpio-get 8') dut.expect("GPIO8 val is low", timeout=1) dut.halt() diff --git a/customer_app/sdk_app_easyflash/Makefile b/customer_app/sdk_app_easyflash/Makefile index 290bb927..14f6c256 100644 --- a/customer_app/sdk_app_easyflash/Makefile +++ b/customer_app/sdk_app_easyflash/Makefile @@ -18,7 +18,7 @@ $(info ****** Please SET BL60X_SDK_PATH ******) $(info ****** Trying SDK PATH [$(BL60X_SDK_PATH)]) endif -COMPONENTS_NETWORK := +COMPONENTS_NETWORK := COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs diff --git a/customer_app/sdk_app_easyflash/sdk_app_easyflash/main.c b/customer_app/sdk_app_easyflash/sdk_app_easyflash/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_event/Makefile b/customer_app/sdk_app_event/Makefile index 823f8305..b1938629 100644 --- a/customer_app/sdk_app_event/Makefile +++ b/customer_app/sdk_app_event/Makefile @@ -20,10 +20,10 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc -INCLUDE_COMPONENTS += +INCLUDE_COMPONENTS += INCLUDE_COMPONENTS += $(COMPONENTS_NETWORK) INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) INCLUDE_COMPONENTS += $(COMPONENTS_VFS) diff --git a/customer_app/sdk_app_event/sdk_app_event/demo.c b/customer_app/sdk_app_event/sdk_app_event/demo.c index e2cc11bc..b8c5bf78 100644 --- a/customer_app/sdk_app_event/sdk_app_event/demo.c +++ b/customer_app/sdk_app_event/sdk_app_event/demo.c @@ -39,14 +39,14 @@ static void monitor_socket_cmd(char *buf, int len, int argc, char **argv) // STATIC_CLI_CMD_ATTRIBUTE makes this(these) command(s) static const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { { "event", "monitor socket", monitor_socket_cmd }, -}; +}; int event_cli_init(void) { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_event/sdk_app_event/main.c b/customer_app/sdk_app_event/sdk_app_event/main.c old mode 100755 new mode 100644 index b003d342..c4b68778 --- a/customer_app/sdk_app_event/sdk_app_event/main.c +++ b/customer_app/sdk_app_event/sdk_app_event/main.c @@ -135,7 +135,7 @@ static void event_cb_demo_event(input_event_t *event, void *private_data) break; case CODE_DEMO_TEST2: { - printf("######This is event test2\r\n"); + printf("######This is event test2\r\n"); } break; default: @@ -145,7 +145,7 @@ static void event_cb_demo_event(input_event_t *event, void *private_data) } } -static void delay_action(void *arg) +static void delay_action(void *arg) { printf("######This is event delay_action\r\n"); } diff --git a/customer_app/sdk_app_event/tests/sdk_app_event_tc_test.py b/customer_app/sdk_app_event/tests/sdk_app_event_tc_test.py index 28452b1c..fd461ab6 100644 --- a/customer_app/sdk_app_event/tests/sdk_app_event_tc_test.py +++ b/customer_app/sdk_app_event/tests/sdk_app_event_tc_test.py @@ -25,7 +25,7 @@ def sdk_app_event_tc(env, extra_data): dut.expect("######This is event test1", timeout=1) dut.expect("######This is event test2", timeout=1) - + dut.write('event') dut.expect("#####This is event poll_read_fd", timeout=6) dut.halt() diff --git a/customer_app/sdk_app_fdt/Makefile b/customer_app/sdk_app_fdt/Makefile index 17797690..9ebd0b47 100644 --- a/customer_app/sdk_app_fdt/Makefile +++ b/customer_app/sdk_app_fdt/Makefile @@ -20,10 +20,10 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc -INCLUDE_COMPONENTS += +INCLUDE_COMPONENTS += INCLUDE_COMPONENTS += $(COMPONENTS_NETWORK) INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) INCLUDE_COMPONENTS += $(COMPONENTS_VFS) diff --git a/customer_app/sdk_app_fdt/sdk_app_fdt/main.c b/customer_app/sdk_app_fdt/sdk_app_fdt/main.c old mode 100755 new mode 100644 index 9f036670..3a259657 --- a/customer_app/sdk_app_fdt/sdk_app_fdt/main.c +++ b/customer_app/sdk_app_fdt/sdk_app_fdt/main.c @@ -124,7 +124,7 @@ static void aos_loop_proc(void *pvParameters) { int fd_console; uint32_t fdt = 0, offset = 0; - + vfs_init(); vfs_device_init(); diff --git a/customer_app/sdk_app_fdt/tests/sdk_app_fdt_tc_test.py b/customer_app/sdk_app_fdt/tests/sdk_app_fdt_tc_test.py index 72cd939e..d61d0236 100644 --- a/customer_app/sdk_app_fdt/tests/sdk_app_fdt_tc_test.py +++ b/customer_app/sdk_app_fdt/tests/sdk_app_fdt_tc_test.py @@ -26,7 +26,7 @@ def sdk_app_fdt_tc(env, extra_data): dut.write('fdt') dut.expect("fdt wifi module successed", timeout=2) dut.expect("dump successed", timeout=2) - + dut.halt() except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: BL602 fdt test failed') diff --git a/customer_app/sdk_app_gpio/Makefile b/customer_app/sdk_app_gpio/Makefile index 976492f8..691272f8 100644 --- a/customer_app/sdk_app_gpio/Makefile +++ b/customer_app/sdk_app_gpio/Makefile @@ -20,7 +20,7 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 diff --git a/customer_app/sdk_app_gpio/sdk_app_gpio/demo.c b/customer_app/sdk_app_gpio/sdk_app_gpio/demo.c index d9c49941..4d4201be 100644 --- a/customer_app/sdk_app_gpio/sdk_app_gpio/demo.c +++ b/customer_app/sdk_app_gpio/sdk_app_gpio/demo.c @@ -32,7 +32,7 @@ #include #include "bl_gpio.h" -static void cmd_gpio_func(char *buf, int len, int argc, char **argv) +static void cmd_gpio_func(char *buf, int len, int argc, char **argv) { int ionum = -1, inputmode = -1, pullup = -1, pulldown = -1; @@ -63,7 +63,7 @@ static void cmd_gpio_func(char *buf, int len, int argc, char **argv) } } -static void cmd_gpio_set(char *buf, int len, int argc, char **argv) +static void cmd_gpio_set(char *buf, int len, int argc, char **argv) { int ionum = -1, val = -1; @@ -86,7 +86,7 @@ static void cmd_gpio_set(char *buf, int len, int argc, char **argv) bl_gpio_output_set(ionum, val ? 1 : 0); } -static void cmd_gpio_get(char *buf, int len, int argc, char **argv) +static void cmd_gpio_get(char *buf, int len, int argc, char **argv) { int ionum = -1, ret; uint8_t val; @@ -114,13 +114,13 @@ const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { {"gpio-func", "gpio-func pinnum 0/1[0:output, 1:input] 0/1[pullup] 0/1[pulldown]", cmd_gpio_func}, {"gpio-set", "gpio-set pinnum 0/1", cmd_gpio_set}, {"gpio-get", "gpio-get pinnum", cmd_gpio_get}, -}; +}; int gpio_cli_init(void) { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_gpio/sdk_app_gpio/main.c b/customer_app/sdk_app_gpio/sdk_app_gpio/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_gpio/tests/sdk_app_gpio_tc_test.py b/customer_app/sdk_app_gpio/tests/sdk_app_gpio_tc_test.py index 26ebf642..febd3eac 100644 --- a/customer_app/sdk_app_gpio/tests/sdk_app_gpio_tc_test.py +++ b/customer_app/sdk_app_gpio/tests/sdk_app_gpio_tc_test.py @@ -25,13 +25,13 @@ def sdk_app_gpio_tc(env, extra_data): dut.write('gpio-func 8 0 0 0') dut.expect("GPIO8 is set output with null pullup null pulldown", timeout=1) - + dut.write('gpio-set 8 1') dut.expect("GPIO8 is set to high", timeout=1) dut.write('gpio-set 8 0') dut.expect("GPIO8 is set to lo", timeout=1) - + dut.write('gpio-get 8') dut.expect("GPIO8 val is low", timeout=1) dut.halt() diff --git a/customer_app/sdk_app_hbnram/Makefile b/customer_app/sdk_app_hbnram/Makefile index 110d51c6..eb258c88 100644 --- a/customer_app/sdk_app_hbnram/Makefile +++ b/customer_app/sdk_app_hbnram/Makefile @@ -20,9 +20,9 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := -INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc +INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 INCLUDE_COMPONENTS += $(COMPONENTS_NETWORK) INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) diff --git a/customer_app/sdk_app_hbnram/sdk_app_hbnram/demo.c b/customer_app/sdk_app_hbnram/sdk_app_hbnram/demo.c index 4970936d..b240ae7a 100644 --- a/customer_app/sdk_app_hbnram/sdk_app_hbnram/demo.c +++ b/customer_app/sdk_app_hbnram/sdk_app_hbnram/demo.c @@ -51,10 +51,10 @@ int print_hash128(void) { uint32_t *paddr; - + int i = 0; - paddr = (uint32_t *)(hbnram_address + magic_size); + paddr = (uint32_t *)(hbnram_address + magic_size); printf("hash128 \r\n"); for (i = 0; i < 4; i++) { printf("%lu-", *paddr); @@ -105,11 +105,11 @@ int test_hbnram1(void) printf("test_hbnram1 alloc failed \r\n"); print_mem_map(); return -1; - } + } data_size = 15; hal_hbnram_buffer_set(test_key, test_arr, data_size); - hal_hbnram_buffer_get(test_key, recv_buf, data_size); + hal_hbnram_buffer_get(test_key, recv_buf, data_size); flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data1 correct \r\n"); @@ -120,7 +120,7 @@ int test_hbnram1(void) data_size = 20; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data2 correct \r\n"); @@ -131,7 +131,7 @@ int test_hbnram1(void) data_size = 37; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data3 correct \r\n"); @@ -143,7 +143,7 @@ int test_hbnram1(void) data_size = 1; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data4 correct \r\n"); @@ -154,7 +154,7 @@ int test_hbnram1(void) data_size = 3; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data5 correct \r\n"); @@ -166,7 +166,7 @@ int test_hbnram1(void) data_size = 4; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data5 correct \r\n"); @@ -178,7 +178,7 @@ int test_hbnram1(void) data_size = 73; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data6 correct \r\n"); @@ -190,7 +190,7 @@ int test_hbnram1(void) data_size = 100; hal_hbnram_buffer_set(test_key, test_arr, data_size); hal_hbnram_buffer_get(test_key, recv_buf, data_size); - + flag = memcmp(recv_buf, test_arr, data_size); if (flag == 0) { printf("data7 correct \r\n"); @@ -226,7 +226,7 @@ int test_hbnram2(void) int flag; print_hash128(); - + for (i = 0; i < 1000; i++) { test_buf[i] = i % 255; @@ -283,7 +283,7 @@ int test_hbnram2(void) hal_hbnram_copy_from_stream(&test2_handle, recv_buf + 473, 400); hal_hbnram_copy_from_stream(&test2_handle, recv_buf + 873, 127); - + flag = memcmp(test_buf, recv_buf, 1000); if (flag == 0) { printf("data-02 correct \r\n"); @@ -308,7 +308,7 @@ int test_hbnram2(void) print_hash128(); //print_all_data(); - memset(recv_buf, 0, 1000); + memset(recv_buf, 0, 1000); hal_hbnram_alloc(test4_key, 1000); hal_hbnram_handle_get_fromkey(test4_key, &test4_handle); hal_hbnram_copy_to_stream(&test4_handle, test_buf, 1000); @@ -348,7 +348,7 @@ int test_hbnram2(void) } else if (*(uint32_t *)hbnram_address == (uint32_t)magic_num) { printf("###############################\r\n"); printf("not power down, just reboot \r\n"); - + hal_hbnram_init(); memset(recv_buf, 0, 1000); hal_hbnram_handle_get_fromkey(test2_key, &test2_handle); @@ -362,7 +362,7 @@ int test_hbnram2(void) } printf("reboot hash\r\n"); print_hash128(); - + memset(recv_buf, 0, 1000); hal_hbnram_handle_get_fromkey(test3_key, &test3_handle); hal_hbnram_copy_from_stream(&test3_handle, recv_buf, 1000); @@ -388,7 +388,7 @@ int test_hbnram2(void) } printf("reboot hash\r\n"); print_hash128(); - + memset(recv_buf, 0, 1000); hal_hbnram_handle_get_fromkey(test5_key, &test5_handle); hal_hbnram_copy_from_stream(&test5_handle, recv_buf, 980); diff --git a/customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c b/customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c old mode 100755 new mode 100644 index 388dc195..709ca7b2 --- a/customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c +++ b/customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c @@ -143,7 +143,7 @@ static void aos_loop_proc(void *pvParameters) aos_poll_read_fd(fd_console, aos_cli_event_cb_read_get(), (void*)0x12345678); _cli_init(); } - + test_hbnram2(); test_hbnram1(); diff --git a/customer_app/sdk_app_heap/Makefile b/customer_app/sdk_app_heap/Makefile index 4ebb3885..7dda8c30 100644 --- a/customer_app/sdk_app_heap/Makefile +++ b/customer_app/sdk_app_heap/Makefile @@ -19,7 +19,7 @@ $(info ****** Trying SDK PATH [$(BL60X_SDK_PATH)]) endif COMPONENTS_BLSYS := bltime blfdt bloop loopadc looprt loopset -COMPONENTS_VFS := +COMPONENTS_VFS := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) diff --git a/customer_app/sdk_app_heap/sdk_app_heap/main.c b/customer_app/sdk_app_heap/sdk_app_heap/main.c old mode 100755 new mode 100644 index 41a07f29..af36170c --- a/customer_app/sdk_app_heap/sdk_app_heap/main.c +++ b/customer_app/sdk_app_heap/sdk_app_heap/main.c @@ -284,7 +284,7 @@ static void __heap_test_fun (void *p_arg) p_handle = (TaskHandle_t *)p_arg; vTaskDelete(*p_handle); return; - } + } counts = 0; ptr = NULL; diff --git a/customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c b/customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c old mode 100755 new mode 100644 index dac30ae8..e5e761cb --- a/customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c +++ b/customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c @@ -59,7 +59,7 @@ void user_vApplicationMallocFailedHook(void) { printf("Memory Allocate Failed. Current left size is %d bytes\r\n", xPortGetFreeHeapSize() - ); + ); /*empty*/ } @@ -67,7 +67,7 @@ void user_vApplicationIdleHook(void) { __asm volatile( " wfi " - ); + ); /*empty*/ } @@ -77,7 +77,7 @@ void bfl_main(void) * Init UART using pins 16+7 (TX+RX) * and baudrate of 2M */ - bl_uart_init(0, 16, 7, 255, 255, 2 * 1000 * 1000); + bl_uart_init(0, 16, 7, 255, 255, 2 * 1000 * 1000); helloworld(); } diff --git a/customer_app/sdk_app_http_client_socket/sdk_app_http_client_socket/main.c b/customer_app/sdk_app_http_client_socket/sdk_app_http_client_socket/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_http_client_socket/tests/sdk_app_http_client_socket_tc_test.py b/customer_app/sdk_app_http_client_socket/tests/sdk_app_http_client_socket_tc_test.py index 2a357687..417befdb 100644 --- a/customer_app/sdk_app_http_client_socket/tests/sdk_app_http_client_socket_tc_test.py +++ b/customer_app/sdk_app_http_client_socket/tests/sdk_app_http_client_socket_tc_test.py @@ -30,7 +30,7 @@ def sdk_app_http_client_socket_tc(env, extra_data): pwd = os.getenv('TEST_ROUTER_PASSWORD') cmd = ("wifi_sta_connect", bssid, pwd) cmd_wifi_connect = ' '.join(cmd) - dut.write(cmd_wifi_connect) + dut.write(cmd_wifi_connect) #dut.write('wifi_sta_connect bl_test_013 tester12345678') dut.expect("Entering wifiConnected_IPOK state", timeout=20) @@ -38,7 +38,7 @@ def sdk_app_http_client_socket_tc(env, extra_data): dut.write('http') dut.expect("Server ip Address", timeout=2) dut.expect("Download comlete", timeout=200) - + dut.halt() except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: BL602 http test failed') diff --git a/customer_app/sdk_app_http_client_tcp/sdk_app_http_client_tcp/main.c b/customer_app/sdk_app_http_client_tcp/sdk_app_http_client_tcp/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_http_client_tcp/tests/sdk_app_http_client_tcp_tc_test.py b/customer_app/sdk_app_http_client_tcp/tests/sdk_app_http_client_tcp_tc_test.py index 0e498e78..eddb446e 100644 --- a/customer_app/sdk_app_http_client_tcp/tests/sdk_app_http_client_tcp_tc_test.py +++ b/customer_app/sdk_app_http_client_tcp/tests/sdk_app_http_client_tcp_tc_test.py @@ -30,13 +30,13 @@ def sdk_app_http_client_tcp_tc(env, extra_data): pwd = os.getenv('TEST_ROUTER_PASSWORD') cmd = ("wifi_sta_connect", bssid, pwd) cmd_wifi_connect = ' '.join(cmd) - dut.write(cmd_wifi_connect) + dut.write(cmd_wifi_connect) #dut.write('wifi_sta_connect bl_test_013 tester12345678') dut.expect("Entering wifiConnected_IPOK state", timeout=20) dut.write('httpc') dut.expect("Transfer finished", timeout=200) - + dut.halt() except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: BL602 httpc test failed') diff --git a/customer_app/sdk_app_i2c/Makefile b/customer_app/sdk_app_i2c/Makefile index 884eba12..b670df94 100644 --- a/customer_app/sdk_app_i2c/Makefile +++ b/customer_app/sdk_app_i2c/Makefile @@ -20,7 +20,7 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 diff --git a/customer_app/sdk_app_i2c/sdk_app_i2c/demo.c b/customer_app/sdk_app_i2c/sdk_app_i2c/demo.c index d510d087..83eb0733 100644 --- a/customer_app/sdk_app_i2c/sdk_app_i2c/demo.c +++ b/customer_app/sdk_app_i2c/sdk_app_i2c/demo.c @@ -141,11 +141,11 @@ int i2c_data_test(void) msgs[3].i2cx = 0; - i2c_transfer_msgs_block(&msgs[1], 3, 0); + i2c_transfer_msgs_block(&msgs[1], 3, 0); for(i = 0; i < 31; i++) { printf("test[%d] = %d, recv[%d] = %d \r\n", i, testarr[i], i, recvarr01[i]); - } + } flag = memcmp(testarr, recvarr01, 31); if (flag == 0) { printf("data correct \r\n"); @@ -156,7 +156,7 @@ int i2c_data_test(void) for(i = 0; i < 31; i++) { printf("test[%d] = %d, recv[%d] = %d \r\n", i, testarr[i], i, recvarr02[i]); - } + } flag = memcmp(testarr, recvarr02, data_len); if (flag == 0) { printf("data correct \r\n"); @@ -188,10 +188,10 @@ static void test_i2c_api(char *buf, int len, int argc, char **argv) for (i = 0; i < 32; i++) { test_arr[i] = i + 3 * i; } - + hal_i2c_write_block(0x50, (char *)test_arr, 32, 2, 0x04); vTaskDelay(80 / portTICK_PERIOD_MS);//eeprom, when write ,should be delay ,then it could be read - + hal_i2c_read_block(0x50, (char *)recv_arr, 32, 2, 0x04); for (i = 0; i < 32; i++) { @@ -213,13 +213,13 @@ static void test_i2c_api(char *buf, int len, int argc, char **argv) // STATIC_CLI_CMD_ATTRIBUTE makes this(these) command(s) static const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { {"test_i2c", "test i2c", test_i2c_api}, -}; +}; int i2c_cli_init(void) { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_i2c/sdk_app_i2c/main.c b/customer_app/sdk_app_i2c/sdk_app_i2c/main.c old mode 100755 new mode 100644 index c94aa56c..94608027 --- a/customer_app/sdk_app_i2c/sdk_app_i2c/main.c +++ b/customer_app/sdk_app_i2c/sdk_app_i2c/main.c @@ -151,7 +151,7 @@ static void event_cb_i2c_event(input_event_t *event, void *private_data) default: { printf("[I2C] [EVT] Unknown code %u, %lld\r\n", event->code, aos_now_ms()); - + } } } diff --git a/customer_app/sdk_app_ir/Makefile b/customer_app/sdk_app_ir/Makefile index c54c66c8..d1a53202 100644 --- a/customer_app/sdk_app_ir/Makefile +++ b/customer_app/sdk_app_ir/Makefile @@ -20,7 +20,7 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 diff --git a/customer_app/sdk_app_ir/sdk_app_ir/demo.c b/customer_app/sdk_app_ir/sdk_app_ir/demo.c index d07c831c..350c52c4 100644 --- a/customer_app/sdk_app_ir/sdk_app_ir/demo.c +++ b/customer_app/sdk_app_ir/sdk_app_ir/demo.c @@ -32,9 +32,9 @@ #include #include -/*NOTE: - * The order of IR sending data is LSB, - * but the order required by the chip WS2812B and UCS1903 is MSB, +/*NOTE: + * The order of IR sending data is LSB, + * but the order required by the chip WS2812B and UCS1903 is MSB, * so here needs to be converted. * */ @@ -61,7 +61,7 @@ static void test_irled(char *buf, int len, int argc, char **argv) for (i = 0; i < 13; i++) { data[i] = 0x3f; } - + convert_data(data, 13); hal_irled_init(1);//WS2812B 0, UCS1903 1 @@ -82,6 +82,6 @@ int irled_cli_init(void) // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_ir/sdk_app_ir/main.c b/customer_app/sdk_app_ir/sdk_app_ir/main.c old mode 100755 new mode 100644 index 20efe86e..87414cd1 --- a/customer_app/sdk_app_ir/sdk_app_ir/main.c +++ b/customer_app/sdk_app_ir/sdk_app_ir/main.c @@ -174,7 +174,7 @@ static void aos_loop_proc(void *pvParameters) if (0 == get_dts_addr("ir", &fdt, &offset)) { hal_ir_init_from_dts(fdt, offset); } - + irled_cli_init(); aos_loop_init(); diff --git a/customer_app/sdk_app_mdns/sdk_app_mdns/main.c b/customer_app/sdk_app_mdns/sdk_app_mdns/main.c old mode 100755 new mode 100644 index 0e582d14..67eb7f1b --- a/customer_app/sdk_app_mdns/sdk_app_mdns/main.c +++ b/customer_app/sdk_app_mdns/sdk_app_mdns/main.c @@ -455,7 +455,7 @@ static void cmd_stack_wifi(char *buf, int len, int argc, char **argv) typedef struct mdns { struct netif *netif; - int slot; + int slot; } mdns_t; static mdns_t mdns = {NULL, -1}; @@ -465,14 +465,14 @@ void mdns_task(void *pvParameters) int slot; uint32_t pre_ip, cur_ip; struct netif *netif; - + netif = netif_find("st"); if (netif == NULL) { printf("find failed\r\n"); goto _failed; } - cur_ip = netif->ip_addr.addr; + cur_ip = netif->ip_addr.addr; pre_ip = cur_ip; slot = mdns_responder_start(netif); @@ -500,8 +500,8 @@ static void cmd_mdns_cli(char *buf, int len, int argc, char **argv) static xTaskHandle xHandle; static int start_flag = 1; static int stop_flag = 0; - int ret; - + int ret; + if (argc != 2) { printf("Please Input Parameter!\r\n"); return; @@ -543,7 +543,7 @@ const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { static void _cli_init() { - /*Put CLI which needs to be init here*/ + /*Put CLI which needs to be init here*/ wifi_mgmr_cli_init(); } diff --git a/customer_app/sdk_app_pwm/sdk_app_pwm/main.c b/customer_app/sdk_app_pwm/sdk_app_pwm/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_pwm/tests/sdk_app_pwm_tc_test.py b/customer_app/sdk_app_pwm/tests/sdk_app_pwm_tc_test.py index 076bf866..1455c862 100644 --- a/customer_app/sdk_app_pwm/tests/sdk_app_pwm_tc_test.py +++ b/customer_app/sdk_app_pwm/tests/sdk_app_pwm_tc_test.py @@ -106,7 +106,7 @@ def sdk_app_pwm_tc(env, extra_data): dut.start_app() try: - dut.expect("Booting BL602 Chip...", timeout=0.5) + dut.expect("Booting BL602 Chip...", timeout=0.5) print('BL602 booted') dut.expect('Init CLI with event Driven', timeout=0.5) print('BL602 CLI init done') @@ -118,7 +118,7 @@ def sdk_app_pwm_tc(env, extra_data): time.sleep(0.5) dut.write('hal_pwm_duty_get 2') dut.expect('pwm duty 1000', timeout=1) - + PWM_GPIO = 4 RUN_TIME = 30.0 SAMPLE_TIME = 2.0 diff --git a/customer_app/sdk_app_romfs/sdk_app_romfs/demo.c b/customer_app/sdk_app_romfs/sdk_app_romfs/demo.c index d449b2d1..be428804 100644 --- a/customer_app/sdk_app_romfs/sdk_app_romfs/demo.c +++ b/customer_app/sdk_app_romfs/sdk_app_romfs/demo.c @@ -43,7 +43,7 @@ void cmd_romfs(char *buf, int len, int argc, char **argv) } const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { - {"romfs", "romfs test", cmd_romfs}, + {"romfs", "romfs test", cmd_romfs}, }; int romfs_cli_init(void) { diff --git a/customer_app/sdk_app_romfs/sdk_app_romfs/main.c b/customer_app/sdk_app_romfs/sdk_app_romfs/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_romfs/tests/sdk_app_romfs_tc_test.py b/customer_app/sdk_app_romfs/tests/sdk_app_romfs_tc_test.py index 1e382477..931cc265 100644 --- a/customer_app/sdk_app_romfs/tests/sdk_app_romfs_tc_test.py +++ b/customer_app/sdk_app_romfs/tests/sdk_app_romfs_tc_test.py @@ -34,7 +34,7 @@ def sdk_app_romfs_tc(env, extra_data): dut.expect("49 44 33 03 00 00 00 00 00 3f 54 58 58 58 00 00 00 03 00 00 00 00 00 50 52 49 56 00 00 00 05 00 00 00 7b 04 00 00 54 53 53 45 00 00 00 0f 00 00 00 4c") dut.expect("case5:len = 0", timeout=1) dut.expect("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00") - + dut.halt() except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: BL602 romfs test failed') diff --git a/customer_app/sdk_app_timer/Makefile b/customer_app/sdk_app_timer/Makefile index e89f5e68..a76f0a14 100644 --- a/customer_app/sdk_app_timer/Makefile +++ b/customer_app/sdk_app_timer/Makefile @@ -20,7 +20,7 @@ endif COMPONENTS_BLSYS := bltime blfdt blmtd bloop loopadc looprt loopset COMPONENTS_VFS := romfs -COMPONENTS_BLE := +COMPONENTS_BLE := INCLUDE_COMPONENTS += freertos_riscv_ram bl602 bl602_std hal_drv vfs yloop utils cli blog blog_testc INCLUDE_COMPONENTS += easyflash4 diff --git a/customer_app/sdk_app_timer/sdk_app_timer/demo.c b/customer_app/sdk_app_timer/sdk_app_timer/demo.c index eaa21d43..3131ffc5 100644 --- a/customer_app/sdk_app_timer/sdk_app_timer/demo.c +++ b/customer_app/sdk_app_timer/sdk_app_timer/demo.c @@ -45,7 +45,7 @@ hw_timer_t *handle7; static uint32_t bl_timer_now_us(void) { - uint32_t tick_now; + uint32_t tick_now; tick_now = *(volatile uint32_t*)0x0200BFF8; return MTIMER_TICKS_PER_US * tick_now; } @@ -122,7 +122,7 @@ void cmd_timer_func(char *buf, int len, int argc, char **argv) handle3 = hal_hwtimer_create(1000, testfunc03, 1); handle4 = hal_hwtimer_create(3748, testfunc04, 1); handle5 = hal_hwtimer_create(2312, testfunc05, 1); - + return; } @@ -130,10 +130,10 @@ void cmd_timer_add(char *buf, int len, int argc, char **argv) { hal_hwtimer_create(3301, testfunc06, 0); hal_hwtimer_create(3301, testfunc07, 0); - hal_hwtimer_create(1234, testfunc08, 0); + hal_hwtimer_create(1234, testfunc08, 0); return; } - + void cmd_timer_delete(char *buf, int len, int argc, char **argv) { int id; @@ -171,13 +171,13 @@ void cmd_timer_delete(char *buf, int len, int argc, char **argv) printf("not right id \r\n"); } } - + if (ret == 0) { printf("delete timer success \r\n"); } else { printf("not find node\r\n", id); } - + return; } @@ -186,13 +186,13 @@ const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { {"test_timer", "test timer", cmd_timer_func}, {"add_timer", "add timer", cmd_timer_add}, {"delete_timer", "delete timer by id", cmd_timer_delete}, -}; +}; int timer_cli_init(void) { // static command(s) do NOT need to call aos_cli_register_command(s) to register. // However, calling aos_cli_register_command(s) here is OK but is of no effect as cmds_user are included in cmds list. // XXX NOTE: Calling this *empty* function is necessary to make cmds_user in this file to be kept in the final link. - //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); + //return aos_cli_register_commands(cmds_user, sizeof(cmds_user)/sizeof(cmds_user[0])); return 0; } diff --git a/customer_app/sdk_app_timer/sdk_app_timer/main.c b/customer_app/sdk_app_timer/sdk_app_timer/main.c old mode 100755 new mode 100644 index 654d9547..0b2863ba --- a/customer_app/sdk_app_timer/sdk_app_timer/main.c +++ b/customer_app/sdk_app_timer/sdk_app_timer/main.c @@ -145,7 +145,7 @@ static void aos_loop_proc(void *pvParameters) } hal_hwtimer_init(); - + aos_loop_run(); puts("------------------------------------------\r\n"); diff --git a/customer_app/sdk_app_uart_ctl/sdk_app_uart_ctl/main.c b/customer_app/sdk_app_uart_ctl/sdk_app_uart_ctl/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/demo.c b/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/demo.c index 68031161..3ef0cb2a 100644 --- a/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/demo.c +++ b/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/demo.c @@ -71,8 +71,8 @@ static void uart_echo_task(void *arg) while (1) { length = aos_read(fd, pbuf + total, strlen(send_recv_log)); - total += length; - + total += length; + if (total != strlen(send_recv_log)) { continue; } diff --git a/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/main.c b/customer_app/sdk_app_uart_echo/sdk_app_uart_echo/main.c old mode 100755 new mode 100644 diff --git a/customer_app/sdk_app_uart_echo/tests/sdk_app_uart_echo_tc_test.py b/customer_app/sdk_app_uart_echo/tests/sdk_app_uart_echo_tc_test.py index d00a0d3e..78edb233 100644 --- a/customer_app/sdk_app_uart_echo/tests/sdk_app_uart_echo_tc_test.py +++ b/customer_app/sdk_app_uart_echo/tests/sdk_app_uart_echo_tc_test.py @@ -2,7 +2,7 @@ from __future__ import print_function from __future__ import unicode_literals import time import re -import serial +import serial from tiny_test_fw import DUT, App, TinyFW from ttfw_bl import BL602App, BL602DUT @@ -19,7 +19,7 @@ def sdk_app_uart_echo_tc(env, extra_data): try: - ser = serial.Serial('/dev/ttyUSB2', 115200, timeout=0.5) + ser = serial.Serial('/dev/ttyUSB2', 115200, timeout=0.5) time.sleep(1) #dut.write('reboot') dut.expect("Booting BL602 Chip...", timeout=1)