mirror of
https://github.com/pine64/bl_iot_sdk.git
synced 2024-07-03 03:28:46 +00:00
Merge pull request #13 from robertlipe/clean_ca
Clean whitespace in customer_apps
This commit is contained in:
commit
fef645af6c
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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 $@)
|
||||
|
|
4
customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c
Executable file → Normal file
4
customer_app/bl602_boot2/bl602_boot2/blsp_boot2.c
Executable file → Normal file
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
2
customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c
Executable file → Normal file
2
customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.c
Executable file → Normal file
|
@ -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);
|
||||
|
|
0
customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.h
Executable file → Normal file
0
customer_app/bl602_boot2/bl602_boot2/blsp_boot_decompress.h
Executable file → Normal file
52
customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c
Executable file → Normal file
52
customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.c
Executable file → Normal file
|
@ -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;i<BFLB_BOOT2_CPU_MAX;i++){
|
||||
if(0==memcmp((void *)&header->magicCode,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 ,
|
||||
|
|
0
customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.h
Executable file → Normal file
0
customer_app/bl602_boot2/bl602_boot2/blsp_boot_parser.h
Executable file → Normal file
30
customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h
Executable file → Normal file
30
customer_app/bl602_boot2/bl602_boot2/blsp_bootinfo.h
Executable file → Normal file
|
@ -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
|
||||
|
||||
|
|
32
customer_app/bl602_boot2/bl602_boot2/blsp_common.c
Executable file → Normal file
32
customer_app/bl602_boot2/bl602_boot2/blsp_common.c
Executable file → Normal file
|
@ -100,7 +100,7 @@ void BLSP_Dump_Data(void *datain,int len)
|
|||
{
|
||||
int i=0;
|
||||
uint8_t *data=(uint8_t *)datain;
|
||||
|
||||
|
||||
for(i=0;i<len;i++){
|
||||
if(i%16==0&&i!=0){
|
||||
MSG("\r\n");
|
||||
|
@ -122,13 +122,13 @@ int32_t BLSP_MediaBoot_Pre_Jump(void)
|
|||
{
|
||||
/* Sec eng deinit*/
|
||||
BLSP_Boot2_Reset_Sec_Eng();
|
||||
|
||||
|
||||
/* Platform deinit */
|
||||
bflb_platform_deinit();
|
||||
|
||||
bflb_platform_deinit();
|
||||
|
||||
/* Jump to entry */
|
||||
BLSP_Boot2_Jump_Entry();
|
||||
|
||||
|
||||
return BFLB_BOOT2_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -141,20 +141,20 @@ int32_t BLSP_MediaBoot_Pre_Jump(void)
|
|||
*
|
||||
*******************************************************************************/
|
||||
void BLSP_Boot2_Exit(void)
|
||||
{
|
||||
{
|
||||
uint32_t i=0;
|
||||
|
||||
|
||||
BLSP_Sboot_Finish();
|
||||
/* Prepare release Other CPUs anyway */
|
||||
/* Deal Other CPU's entry point */
|
||||
for(i=1;i<cpuCount;i++){
|
||||
BL_WR_WORD(bootCpuCfg[i].mspStoreAddr,0);
|
||||
BL_WR_WORD(bootCpuCfg[i].pcStoreAddr,0);
|
||||
}
|
||||
}
|
||||
/* Release other CPUs*/
|
||||
if(cpuCount!=1&&!bootImgCfg[0].haltCPU1){
|
||||
BLSP_Boot2_Release_Other_CPU();
|
||||
}
|
||||
}
|
||||
/* Stay here */
|
||||
while(1){
|
||||
/* Use soft delay only */
|
||||
|
@ -175,9 +175,9 @@ void ATTR_TCM_SECTION BLSP_Boot2_Jump_Entry(void)
|
|||
pentry_t pentry;
|
||||
uint32_t i=0;
|
||||
int32_t ret;
|
||||
|
||||
BLSP_Sboot_Finish();
|
||||
|
||||
|
||||
BLSP_Sboot_Finish();
|
||||
|
||||
/*Note:enable cache with flash offset, after this, should be no flash directl read,
|
||||
If need read, should take flash offset into consideration */
|
||||
if(0!=efuseCfg.encrypted[0]){
|
||||
|
@ -190,7 +190,7 @@ void ATTR_TCM_SECTION BLSP_Boot2_Jump_Entry(void)
|
|||
if(ret!=BFLB_BOOT2_SUCCESS){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Set decryption before read MSP and PC*/
|
||||
if(0!=efuseCfg.encrypted[0]){
|
||||
BLSP_Boot2_Set_Encrypt(0,&bootImgCfg[0]);
|
||||
|
@ -218,7 +218,7 @@ void ATTR_TCM_SECTION BLSP_Boot2_Jump_Entry(void)
|
|||
bootImgCfg[1].cacheWayDisable=0xf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Deal Other CPUs' entry point */
|
||||
/* Prepare release CPU1 anyway */
|
||||
for(i=1;i<cpuCount;i++){
|
||||
|
@ -230,7 +230,7 @@ void ATTR_TCM_SECTION BLSP_Boot2_Jump_Entry(void)
|
|||
BL_WR_WORD(bootCpuCfg[i].pcStoreAddr,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Deal CPU0's entry point */
|
||||
if(bootImgCfg[0].imgValid){
|
||||
pentry=(pentry_t)bootImgCfg[0].entryPoint;
|
||||
|
@ -244,7 +244,7 @@ void ATTR_TCM_SECTION BLSP_Boot2_Jump_Entry(void)
|
|||
if(pentry!=NULL){
|
||||
pentry();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Release other CPUs unless user halt it */
|
||||
if(cpuCount!=1&&!bootImgCfg[0].haltCPU1){
|
||||
BLSP_Boot2_Release_Other_CPU();
|
||||
|
|
0
customer_app/bl602_boot2/bl602_boot2/blsp_common.h
Executable file → Normal file
0
customer_app/bl602_boot2/bl602_boot2/blsp_common.h
Executable file → Normal file
50
customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.c
Executable file → Normal file
50
customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.c
Executable file → Normal file
|
@ -103,14 +103,14 @@ static int32_t BLSP_MediaBot_Cal_Hash(uint32_t startAddr,uint32_t totalLen)
|
|||
uint32_t addr=startAddr;
|
||||
int32_t ret;
|
||||
uint32_t dumpCnt=0;
|
||||
|
||||
|
||||
while(dealLen<totalLen){
|
||||
|
||||
readLen=totalLen-dealLen;
|
||||
if(readLen>BFLB_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<BFLB_BOOT2_CPU_MAX;i++){
|
||||
memset(&bootImgCfg[i],0,sizeof(bootImgCfg[i]));
|
||||
|
@ -360,7 +360,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
cpuRollBack[i]=0;
|
||||
}
|
||||
bootImgCfg[0].haltCPU1=0;
|
||||
|
||||
|
||||
/* Try to boot from flash */
|
||||
for(i=0;i<cpuCount;i++){
|
||||
if(bootHeaderAddr[i]==0){
|
||||
|
@ -379,7 +379,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
if(validImgFound!=cpuCount && 1==rollBack){
|
||||
/* For CP and DP, found CPU0 image is taken as correct when the other not found, others as wrong and try to rollback */
|
||||
if(bootHeaderAddr[1]==0 && validImgFound==1){
|
||||
MSG_DBG("Found One img Only\r\n");
|
||||
MSG_DBG("Found One img Only\r\n");
|
||||
}else{
|
||||
MSG_ERR("Image roll back\r\n");
|
||||
return BFLB_BOOT2_IMG_Roll_Back;
|
||||
|
@ -389,7 +389,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
MSG_ERR("no valid img found\r\n");
|
||||
return BFLB_BOOT2_IMG_ALL_INVALID_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Get msp and pc value */
|
||||
for(i=0;i<cpuCount;i++){
|
||||
|
@ -422,13 +422,13 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
MSG_DBG("%08x,%08x\r\n",bootImgCfg[1].imgStart.flashOffset,bootImgCfg[1].cacheWayDisable);
|
||||
MSG_DBG("CPU Count %d,%d\r\n",cpuCount,bootImgCfg[0].haltCPU1);
|
||||
BLSP_Boot2_Show_Timer();
|
||||
|
||||
|
||||
/* Fix invalid pc and msp */
|
||||
BLSP_Fix_Invalid_MSP_PC();
|
||||
|
||||
BLSP_Fix_Invalid_MSP_PC();
|
||||
|
||||
/* Prepare jump to entry*/
|
||||
BLSP_MediaBoot_Pre_Jump();
|
||||
|
||||
|
||||
/* We should never get here unless something is wrong */
|
||||
return BFLB_BOOT2_FAIL;
|
||||
}
|
||||
|
|
0
customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.h
Executable file → Normal file
0
customer_app/bl602_boot2/bl602_boot2/blsp_media_boot.h
Executable file → Normal file
56
customer_app/bl602_boot2/bl602_boot2/blsp_port.c
Executable file → Normal file
56
customer_app/bl602_boot2/bl602_boot2/blsp_port.c
Executable file → Normal file
|
@ -279,7 +279,7 @@ void BLSP_Boot2_Pass_Parameter(void *data,uint32_t len)
|
|||
{
|
||||
static uint8_t *pParameter=NULL;
|
||||
if(len==0){
|
||||
GLB_Set_EM_Sel(0);
|
||||
GLB_Set_EM_Sel(0);
|
||||
pParameter=(uint8_t *)(0x42030000+103*1024);
|
||||
return;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void ATTR_TCM_SECTION BLSP_Sboot_Finish(void)
|
|||
void BLSP_Fix_Invalid_MSP_PC(void)
|
||||
{
|
||||
uint32_t i=0;
|
||||
|
||||
|
||||
for(i=0;i<BFLB_BOOT2_CPU_MAX;i++){
|
||||
if(!BLSP_Is_MSP_Valid(bootImgCfg[i].mspVal)){
|
||||
bootImgCfg[i].mspVal=0;
|
||||
|
@ -628,7 +628,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Feature_Flag(void)
|
|||
{
|
||||
static uint8_t boot2Flag=0xff;
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+0);
|
||||
|
||||
|
||||
if(boot2Flag==0xff){
|
||||
boot2Flag=*p;
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Feature_Flag(void)
|
|||
uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Log_Disable_Flag(void)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+1);
|
||||
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Log_Disable_Flag(void)
|
|||
uint8_t ATTR_TCM_SECTION BLSP_Boot2_8M_Support_Flag(void)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+2);
|
||||
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
@ -705,22 +705,22 @@ uint32_t ATTR_TCM_SECTION BLSP_Boot2_Get_Baudrate(void)
|
|||
*******************************************************************************/
|
||||
void bflb_platform_init_uart_debug_gpio()
|
||||
{
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
|
||||
uint8_t gpio=BLSP_Boot2_Get_TX_GPIO();
|
||||
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
|
||||
/*set GPIO as UART0 TX */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=7;
|
||||
cfg.gpioMode=GPIO_MODE_OUTPUT;
|
||||
cfg.pullType=GPIO_PULL_UP;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
/*set GPIO as UART0 TX */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=7;
|
||||
cfg.gpioMode=GPIO_MODE_OUTPUT;
|
||||
cfg.pullType=GPIO_PULL_UP;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
|
||||
/* select uart gpio function */
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),GLB_UART_SIG_FUN_UART0_TXD);
|
||||
/* select uart gpio function */
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),GLB_UART_SIG_FUN_UART0_TXD);
|
||||
}
|
||||
|
||||
/****************************************************************************//**
|
||||
|
@ -733,21 +733,21 @@ void bflb_platform_init_uart_debug_gpio()
|
|||
*******************************************************************************/
|
||||
void bflb_platform_deinit_uart_debug_gpio()
|
||||
{
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
uint8_t gpio=BLSP_Boot2_Get_TX_GPIO();
|
||||
|
||||
cfg.gpioMode=GPIO_MODE_INPUT;
|
||||
cfg.pullType=GPIO_PULL_NONE;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
cfg.gpioMode=GPIO_MODE_INPUT;
|
||||
cfg.pullType=GPIO_PULL_NONE;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
|
||||
/*set GPIO as input */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=11;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
/*set GPIO as input */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=11;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
|
||||
/* restore uart function sel*/
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),
|
||||
/* restore uart function sel*/
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),
|
||||
(GLB_UART_SIG_FUN_Type)(GLB_UART_SIG_0+(GLB_UART_SIG_Type)(gpio%12)));
|
||||
}
|
||||
|
||||
|
|
0
customer_app/bl602_boot2/bl602_boot2/blsp_port.h
Executable file → Normal file
0
customer_app/bl602_boot2/bl602_boot2/blsp_port.h
Executable file → Normal file
|
@ -12,5 +12,5 @@ LINKER_SCRIPTS := blsp_boot2_flash.ld
|
|||
|
||||
COMPONENT_ADD_LDFLAGS += -L $(BL60X_SDK_PATH)/customer_app/bl602_boot2/bl602_boot2 \
|
||||
$(addprefix -T ,$(LINKER_SCRIPTS))
|
||||
##
|
||||
##
|
||||
COMPONENT_ADD_LINKER_DEPS := $(addprefix ,$(LINKER_SCRIPTS))
|
||||
|
|
|
@ -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 $@)
|
||||
|
|
|
@ -492,9 +492,9 @@ int main(void)
|
|||
if(0==entry){
|
||||
BLSP_Boot2_On_Error("No valid FW Entry\r\n");
|
||||
}
|
||||
|
||||
|
||||
HBN_Set_XCLK_CLK_Sel(HBN_XCLK_CLK_XTAL);
|
||||
|
||||
|
||||
MSG("jump entry:%08x\r\n",(unsigned int)entry);
|
||||
BLSP_Boot2_Jump_Entry(entry);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;i<BFLB_BOOT2_CPU_MAX;i++){
|
||||
if(0==memcmp((void *)&header->magicCode,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 ,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ void BLSP_Dump_Data(void *datain,int len)
|
|||
{
|
||||
int i=0;
|
||||
uint8_t *data=(uint8_t *)datain;
|
||||
|
||||
|
||||
for(i=0;i<len;i++){
|
||||
if(i%16==0&&i!=0){
|
||||
MSG("\r\n");
|
||||
|
@ -122,13 +122,13 @@ int32_t BLSP_MediaBoot_Pre_Jump(void)
|
|||
{
|
||||
/* Sec eng deinit*/
|
||||
BLSP_Boot2_Reset_Sec_Eng();
|
||||
|
||||
|
||||
/* Platform deinit */
|
||||
bflb_platform_deinit();
|
||||
|
||||
bflb_platform_deinit();
|
||||
|
||||
/* Jump to entry */
|
||||
BLSP_Boot2_Jump_Entry(0x00011000);
|
||||
|
||||
|
||||
return BFLB_BOOT2_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -141,20 +141,20 @@ int32_t BLSP_MediaBoot_Pre_Jump(void)
|
|||
*
|
||||
*******************************************************************************/
|
||||
void BLSP_Boot2_Exit(void)
|
||||
{
|
||||
{
|
||||
uint32_t i=0;
|
||||
|
||||
|
||||
BLSP_Sboot_Finish();
|
||||
/* Prepare release Other CPUs anyway */
|
||||
/* Deal Other CPU's entry point */
|
||||
for(i=1;i<cpuCount;i++){
|
||||
BL_WR_WORD(bootCpuCfg[i].mspStoreAddr,0);
|
||||
BL_WR_WORD(bootCpuCfg[i].pcStoreAddr,0);
|
||||
}
|
||||
}
|
||||
/* Release other CPUs*/
|
||||
if(cpuCount!=1&&!bootImgCfg[0].haltCPU1){
|
||||
BLSP_Boot2_Release_Other_CPU();
|
||||
}
|
||||
}
|
||||
/* Stay here */
|
||||
while(1){
|
||||
/* Use soft delay only */
|
||||
|
|
|
@ -103,14 +103,14 @@ static int32_t BLSP_MediaBot_Cal_Hash(uint32_t startAddr,uint32_t totalLen)
|
|||
uint32_t addr=startAddr;
|
||||
int32_t ret;
|
||||
uint32_t dumpCnt=0;
|
||||
|
||||
|
||||
while(dealLen<totalLen){
|
||||
|
||||
readLen=totalLen-dealLen;
|
||||
if(readLen>BFLB_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<BFLB_BOOT2_CPU_MAX;i++){
|
||||
memset(&bootImgCfg[i],0,sizeof(bootImgCfg[i]));
|
||||
|
@ -360,7 +360,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
cpuRollBack[i]=0;
|
||||
}
|
||||
bootImgCfg[0].haltCPU1=0;
|
||||
|
||||
|
||||
/* Try to boot from flash */
|
||||
for(i=0;i<cpuCount;i++){
|
||||
if(bootHeaderAddr[i]==0){
|
||||
|
@ -379,7 +379,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
if(validImgFound!=cpuCount && 1==rollBack){
|
||||
/* For CP and DP, found CPU0 image is taken as correct when the other not found, others as wrong and try to rollback */
|
||||
if(bootHeaderAddr[1]==0 && validImgFound==1){
|
||||
MSG_DBG("Found One img Only\r\n");
|
||||
MSG_DBG("Found One img Only\r\n");
|
||||
}else{
|
||||
MSG_ERR("Image roll back\r\n");
|
||||
return BFLB_BOOT2_IMG_Roll_Back;
|
||||
|
@ -389,7 +389,7 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
MSG_ERR("no valid img found\r\n");
|
||||
return BFLB_BOOT2_IMG_ALL_INVALID_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Get msp and pc value */
|
||||
for(i=0;i<cpuCount;i++){
|
||||
|
@ -422,13 +422,13 @@ int32_t BLSP_MediaBoot_Main(uint32_t cpuBootheaderAddr[BFLB_BOOT2_CPU_MAX],uint8
|
|||
MSG_DBG("%08x,%08x\r\n",bootImgCfg[1].imgStart.flashOffset,bootImgCfg[1].cacheWayDisable);
|
||||
MSG_DBG("CPU Count %d,%d\r\n",cpuCount,bootImgCfg[0].haltCPU1);
|
||||
BLSP_Boot2_Show_Timer();
|
||||
|
||||
|
||||
/* Fix invalid pc and msp */
|
||||
BLSP_Fix_Invalid_MSP_PC();
|
||||
|
||||
BLSP_Fix_Invalid_MSP_PC();
|
||||
|
||||
/* Prepare jump to entry*/
|
||||
BLSP_MediaBoot_Pre_Jump();
|
||||
|
||||
|
||||
/* We should never get here unless something is wrong */
|
||||
return BFLB_BOOT2_FAIL;
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ void BLSP_Boot2_Pass_Parameter(void *data,uint32_t len)
|
|||
{
|
||||
static uint8_t *pParameter=NULL;
|
||||
if(len==0){
|
||||
GLB_Set_EM_Sel(0);
|
||||
GLB_Set_EM_Sel(0);
|
||||
pParameter=(uint8_t *)(0x42030000+103*1024);
|
||||
return;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void ATTR_TCM_SECTION BLSP_Sboot_Finish(void)
|
|||
void BLSP_Fix_Invalid_MSP_PC(void)
|
||||
{
|
||||
uint32_t i=0;
|
||||
|
||||
|
||||
for(i=0;i<BFLB_BOOT2_CPU_MAX;i++){
|
||||
if(!BLSP_Is_MSP_Valid(bootImgCfg[i].mspVal)){
|
||||
bootImgCfg[i].mspVal=0;
|
||||
|
@ -628,7 +628,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Feature_Flag(void)
|
|||
{
|
||||
static uint8_t boot2Flag=0xff;
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+0);
|
||||
|
||||
|
||||
if(boot2Flag==0xff){
|
||||
boot2Flag=*p;
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Feature_Flag(void)
|
|||
uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Log_Disable_Flag(void)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+1);
|
||||
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ uint8_t ATTR_TCM_SECTION BLSP_Boot2_Get_Log_Disable_Flag(void)
|
|||
uint8_t ATTR_TCM_SECTION BLSP_Boot2_8M_Support_Flag(void)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)&__Vectors[10]+2);
|
||||
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
@ -709,22 +709,22 @@ void bflb_platform_init_uart_debug_gpio_delete()
|
|||
void bflb_platform_init_uart_debug_gpio()
|
||||
#endif
|
||||
{
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
|
||||
uint8_t gpio=BLSP_Boot2_Get_TX_GPIO();
|
||||
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
|
||||
/*set GPIO as UART0 TX */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=7;
|
||||
cfg.gpioMode=GPIO_MODE_OUTPUT;
|
||||
cfg.pullType=GPIO_PULL_UP;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
/*set GPIO as UART0 TX */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=7;
|
||||
cfg.gpioMode=GPIO_MODE_OUTPUT;
|
||||
cfg.pullType=GPIO_PULL_UP;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
|
||||
/* select uart gpio function */
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),GLB_UART_SIG_FUN_UART0_TXD);
|
||||
/* select uart gpio function */
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),GLB_UART_SIG_FUN_UART0_TXD);
|
||||
}
|
||||
|
||||
/****************************************************************************//**
|
||||
|
@ -737,21 +737,21 @@ void bflb_platform_init_uart_debug_gpio()
|
|||
*******************************************************************************/
|
||||
void bflb_platform_deinit_uart_debug_gpio()
|
||||
{
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
GLB_GPIO_Cfg_Type cfg;
|
||||
uint8_t gpio=BLSP_Boot2_Get_TX_GPIO();
|
||||
|
||||
cfg.gpioMode=GPIO_MODE_INPUT;
|
||||
cfg.pullType=GPIO_PULL_NONE;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
cfg.gpioMode=GPIO_MODE_INPUT;
|
||||
cfg.pullType=GPIO_PULL_NONE;
|
||||
cfg.drive=0;
|
||||
cfg.smtCtrl=1;
|
||||
|
||||
/*set GPIO as input */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=11;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
/*set GPIO as input */
|
||||
cfg.gpioPin=GLB_GPIO_PIN_0+(GLB_GPIO_Type)(gpio);
|
||||
cfg.gpioFun=11;
|
||||
GLB_GPIO_Init(&cfg);
|
||||
|
||||
/* restore uart function sel*/
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),
|
||||
/* restore uart function sel*/
|
||||
GLB_UART_Fun_Sel((GLB_UART_SIG_Type)(GLB_UART_SIG_0+(gpio%8)),
|
||||
(GLB_UART_SIG_FUN_Type)(GLB_UART_SIG_0+(GLB_UART_SIG_Type)(gpio%12)));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@ LINKER_SCRIPTS := blsp_boot2_flash.ld
|
|||
|
||||
COMPONENT_ADD_LDFLAGS += -L $(BL60X_SDK_PATH)/customer_app/bl602_boot2_mini/bl602_boot2_mini \
|
||||
$(addprefix -T ,$(LINKER_SCRIPTS))
|
||||
##
|
||||
##
|
||||
COMPONENT_ADD_LINKER_DEPS := $(addprefix ,$(LINKER_SCRIPTS))
|
||||
|
|
0
customer_app/bl602_demo_at/bl602_demo_at/at_cmd_usr.c
Executable file → Normal file
0
customer_app/bl602_demo_at/bl602_demo_at/at_cmd_usr.c
Executable file → Normal file
|
@ -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;
|
||||
|
|
|
@ -53,7 +53,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();
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,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));
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,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
|
||||
|
||||
|
@ -99,13 +99,13 @@ 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
void bt_enable_cb(int err)
|
||||
{
|
||||
if (!err) {
|
||||
if (!err) {
|
||||
ble_cli_register();
|
||||
#if defined(CONFIG_BT_STACK_PTS)
|
||||
pts_cli_register();
|
||||
|
@ -115,7 +115,7 @@ void bt_enable_cb(int err)
|
|||
blemesh_cli_register();
|
||||
#if defined(CONFIG_BT_MESH_MODEL_GEN_SRV)
|
||||
bl_gpio_enable_output(LED_PIN, LED_PIN_PULLUP, LED_PIN_PULDONW);
|
||||
mesh_gen_srv_callback_register(model_gen_cb);
|
||||
mesh_gen_srv_callback_register(model_gen_cb);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -46,7 +46,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);
|
||||
}
|
||||
|
||||
|
@ -74,10 +74,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 app_delayed_action_bleadv(void *arg)
|
||||
|
@ -111,7 +111,7 @@ static struct bt_conn_cb blsync_cb = {
|
|||
void blsync_ble_start(void)
|
||||
{
|
||||
static uint8_t inited = 0;
|
||||
|
||||
|
||||
if (inited == 0) {
|
||||
inited = 1;
|
||||
bt_conn_cb_register(&blsync_cb);
|
||||
|
|
|
@ -34,4 +34,4 @@ void blsync_ble_start (void);
|
|||
|
||||
void blsync_ble_stop (void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
4
customer_app/bl602_demo_at/bl602_demo_at/main.c
Executable file → Normal file
4
customer_app/bl602_demo_at/bl602_demo_at/main.c
Executable file → Normal file
|
@ -378,7 +378,7 @@ static void wifi_sta_connect(char *ssid, char *password)
|
|||
|
||||
wifi_interface = wifi_mgmr_sta_enable();
|
||||
wifi_mgmr_sta_connect(wifi_interface, ssid, password, NULL, NULL, 0, 0);
|
||||
|
||||
|
||||
at_key_value_get(SAVE_KEY_WIFI_AUTO, &auto_conn);
|
||||
if (auto_conn) {
|
||||
wifi_mgmr_sta_autoconnect_enable();
|
||||
|
@ -464,7 +464,7 @@ static void event_cb_wifi_event(input_event_t *event, void *private_data)
|
|||
case CODE_WIFI_ON_CONNECTED:
|
||||
{
|
||||
printf("[APP] [EVT] connected %lld\r\n", aos_now_ms());
|
||||
|
||||
|
||||
// notify AT server
|
||||
at_server_notify(AT_ASYNC_WIFI_CONNECTED);
|
||||
}
|
||||
|
|
|
@ -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 0080 0080')
|
||||
dut.expect("Advertising started", timeout=1)
|
||||
|
||||
|
||||
dut.write('ble_read_local_address')
|
||||
local_addr = dut.expect(re.compile(r"Local addr : (.*) "), timeout=2)
|
||||
print(f'local_addr is {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 0080 0080')
|
||||
dut.expect("Advertising started", timeout=1)
|
||||
|
||||
|
||||
dut.write('ble_read_local_address')
|
||||
local_addr = dut.expect(re.compile(r"Local addr : (.*) "), timeout=2)
|
||||
print(f'local_addr is {local_addr[0]}')
|
||||
|
@ -104,7 +104,7 @@ def bl602_demo_event_RPI_ble_wifi_tc(env, extra_data):
|
|||
raise
|
||||
|
||||
def scan_device(mac):
|
||||
|
||||
|
||||
result = os.popen('timeout -s INT 10s hcitool lescan').read()
|
||||
device_list = result.split('\n')
|
||||
device_dict = {}
|
||||
|
@ -121,7 +121,7 @@ def scan_device(mac):
|
|||
return False
|
||||
|
||||
def connect_device(mac):
|
||||
|
||||
|
||||
conn = btle.Peripheral(mac, "random")
|
||||
print("BLE is connected")
|
||||
conn.disconnect()
|
||||
|
|
|
@ -35,7 +35,7 @@ def bl602_demo_event_RPI_wifi_ap_tc(env, extra_data):
|
|||
connect_device(ap_ssid[0])
|
||||
time.sleep(1)
|
||||
dut.expect('ap mode: add sta mac', timeout=10)
|
||||
|
||||
|
||||
dut.halt()
|
||||
except Exception:
|
||||
print('ENV_TEST_FAILURE: BL602 ble_wifi test failed')
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -69,7 +69,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();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,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));
|
||||
}
|
||||
|
||||
|
@ -98,11 +98,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
|
||||
|
||||
|
@ -115,40 +115,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
14
customer_app/bl602_demo_event/bl602_demo_event/main.c
Executable file → Normal file
14
customer_app/bl602_demo_event/bl602_demo_event/main.c
Executable file → Normal file
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
0
customer_app/bl602_demo_nano/bl602_demo_nano/main.c
Executable file → Normal file
0
customer_app/bl602_demo_nano/bl602_demo_nano/main.c
Executable file → Normal file
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
0
customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/main.c
Executable file → Normal file
0
customer_app/bl602_demo_noconnectivity/bl602_demo_noconnectivity/main.c
Executable file → Normal file
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
0
customer_app/bl602_demo_wifi/bl602_demo_wifi/main.c
Executable file → Normal file
0
customer_app/bl602_demo_wifi/bl602_demo_wifi/main.c
Executable file → Normal file
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -34,4 +34,4 @@ void blsync_ble_start (void);
|
|||
|
||||
void blsync_ble_stop (void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
0
customer_app/sdk_app_ble_sync/sdk_app_ble_sync/main.c
Executable file → Normal file
0
customer_app/sdk_app_ble_sync/sdk_app_ble_sync/main.c
Executable file → Normal file
0
customer_app/sdk_app_blog/sdk_app_blog/main.c
Executable file → Normal file
0
customer_app/sdk_app_blog/sdk_app_blog/main.c
Executable file → Normal file
|
@ -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)
|
||||
|
|
0
customer_app/sdk_app_cli/sdk_app_cli/main.c
Executable file → Normal file
0
customer_app/sdk_app_cli/sdk_app_cli/main.c
Executable file → Normal file
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
0
customer_app/sdk_app_cronalarm/sdk_app_cronalarm/main.c
Executable file → Normal file
0
customer_app/sdk_app_cronalarm/sdk_app_cronalarm/main.c
Executable file → Normal file
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <cli.h>
|
||||
#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;
|
||||
}
|
||||
|
|
14
customer_app/sdk_app_dac/sdk_app_dac/main.c
Executable file → Normal file
14
customer_app/sdk_app_dac/sdk_app_dac/main.c
Executable file → Normal file
|
@ -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");
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
0
customer_app/sdk_app_easyflash/sdk_app_easyflash/main.c
Executable file → Normal file
0
customer_app/sdk_app_easyflash/sdk_app_easyflash/main.c
Executable file → Normal file
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
4
customer_app/sdk_app_event/sdk_app_event/main.c
Executable file → Normal file
4
customer_app/sdk_app_event/sdk_app_event/main.c
Executable file → Normal file
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
2
customer_app/sdk_app_fdt/sdk_app_fdt/main.c
Executable file → Normal file
2
customer_app/sdk_app_fdt/sdk_app_fdt/main.c
Executable file → Normal file
|
@ -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();
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <cli.h>
|
||||
#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;
|
||||
}
|
||||
|
|
0
customer_app/sdk_app_gpio/sdk_app_gpio/main.c
Executable file → Normal file
0
customer_app/sdk_app_gpio/sdk_app_gpio/main.c
Executable file → Normal file
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
2
customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c
Executable file → Normal file
2
customer_app/sdk_app_hbnram/sdk_app_hbnram/main.c
Executable file → Normal file
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
2
customer_app/sdk_app_heap/sdk_app_heap/main.c
Executable file → Normal file
2
customer_app/sdk_app_heap/sdk_app_heap/main.c
Executable file → Normal file
|
@ -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;
|
||||
|
|
6
customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c
Executable file → Normal file
6
customer_app/sdk_app_helloworld/sdk_app_helloworld/main.c
Executable file → Normal file
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
0
customer_app/sdk_app_http_client_socket/sdk_app_http_client_socket/main.c
Executable file → Normal file
0
customer_app/sdk_app_http_client_socket/sdk_app_http_client_socket/main.c
Executable file → Normal file
|
@ -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')
|
||||
|
|
0
customer_app/sdk_app_http_client_tcp/sdk_app_http_client_tcp/main.c
Executable file → Normal file
0
customer_app/sdk_app_http_client_tcp/sdk_app_http_client_tcp/main.c
Executable file → Normal file
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
2
customer_app/sdk_app_i2c/sdk_app_i2c/main.c
Executable file → Normal file
2
customer_app/sdk_app_i2c/sdk_app_i2c/main.c
Executable file → Normal file
|
@ -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());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
#include <cli.h>
|
||||
#include <hal_ir.h>
|
||||
|
||||
/*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;
|
||||
}
|
||||
|
|
2
customer_app/sdk_app_ir/sdk_app_ir/main.c
Executable file → Normal file
2
customer_app/sdk_app_ir/sdk_app_ir/main.c
Executable file → Normal file
|
@ -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();
|
||||
|
||||
|
|
12
customer_app/sdk_app_mdns/sdk_app_mdns/main.c
Executable file → Normal file
12
customer_app/sdk_app_mdns/sdk_app_mdns/main.c
Executable file → Normal file
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
0
customer_app/sdk_app_pwm/sdk_app_pwm/main.c
Executable file → Normal file
0
customer_app/sdk_app_pwm/sdk_app_pwm/main.c
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user