[update][ble] update ble stack, build controllerlib with t-head toolchain as default

This commit is contained in:
jzlv 2022-04-26 14:40:51 +08:00
parent 7d24956433
commit 08beed1826
56 changed files with 1978 additions and 859 deletions

46
examples/ble/bl_irq.c Normal file
View file

@ -0,0 +1,46 @@
#include "bl_irq.h"
extern pFunc __Interrupt_Handlers[IRQn_LAST];
void bl_irq_enable(unsigned int source)
{
*(volatile uint8_t*)(CLIC_HART0_ADDR + CLIC_INTIE + source) = 1;
}
void bl_irq_disable(unsigned int source)
{
*(volatile uint8_t*)(CLIC_HART0_ADDR + CLIC_INTIE + source) = 0;
}
void bl_irq_pending_set(unsigned int source)
{
*(volatile uint8_t*)(CLIC_HART0_ADDR + CLIC_INTIP + source) = 1;
}
void bl_irq_pending_clear(unsigned int source)
{
*(volatile uint8_t*)(CLIC_HART0_ADDR + CLIC_INTIP + source) = 0;
}
void bl_irq_register(int irqnum, void *handler)
{
if(irqnum<IRQn_LAST){
__Interrupt_Handlers[irqnum] = handler;
}
}
void bl_irq_unregister(int irqnum, void *handler)
{
if(irqnum<IRQn_LAST){
__Interrupt_Handlers[irqnum] = NULL;
}
}
void bl_irq_handler_get(int irqnum, void **handler)
{
if(irqnum<IRQn_LAST){
*handler = __Interrupt_Handlers[irqnum];
}
}

19
examples/ble/bl_irq.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef __BL_IRQ_H__
#define __BL_IRQ_H__
#include "bl702_glb.h"
#include "risc-v/Core/Include/clic.h"
#include "risc-v/Core/Include/riscv_encoding.h"
void bl_irq_enable(unsigned int source);
void bl_irq_disable(unsigned int source);
void bl_irq_pending_set(unsigned int source);
void bl_irq_pending_clear(unsigned int source);
void bl_irq_register(int irqnum, void *handler);
void bl_irq_unregister(int irqnum, void *handler);
void bl_irq_handler_get(int irqnum, void **handler);
#endif

View file

@ -1,5 +1,7 @@
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
set(TARGET_REQUIRED_SRCS ${CMAKE_CURRENT_LIST_DIR}/ble_central_tp_client.c)
set(TARGET_REQUIRED_SRCS
${CMAKE_CURRENT_LIST_DIR}/ble_central_tp_client.c
${CMAKE_CURRENT_LIST_DIR}/../bl_irq.c)
set(TARGET_REQUIRED_LIBS freertos ble mbedtls)
set(mains main.c)
set(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/../bl702_flash_ble.ld)

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,5 @@
请使用 10.2 版本以上 T-head 工具链编译该 demo
```bash
$ make APP=ble_central BOARD=bl706_iot SUPPORT_FLOAT=y

View file

@ -1,5 +1,7 @@
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
set(TARGET_REQUIRED_SRCS ${CMAKE_CURRENT_LIST_DIR}/ble_peripheral_tp_server.c)
set(TARGET_REQUIRED_SRCS
${CMAKE_CURRENT_LIST_DIR}/ble_peripheral_tp_server.c
${CMAKE_CURRENT_LIST_DIR}/../bl_irq.c)
set(TARGET_REQUIRED_LIBS freertos ble mbedtls)
set(mains main.c)
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/examples/ble/bl702_flash_ble_pds.ld)

View file

@ -0,0 +1,7 @@
请使用 10.2 版本以上 T-head 工具链编译该 demo
```bash
$ make APP=ble_pds BOARD=bl706_iot SUPPORT_FLOAT=y
```

View file

@ -1,5 +1,7 @@
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
set(TARGET_REQUIRED_SRCS ${CMAKE_CURRENT_LIST_DIR}/ble_peripheral_tp_server.c)
set(TARGET_REQUIRED_SRCS
${CMAKE_CURRENT_LIST_DIR}/ble_peripheral_tp_server.c
${CMAKE_CURRENT_LIST_DIR}/../bl_irq.c)
set(TARGET_REQUIRED_LIBS freertos ble mbedtls)
set(mains main.c)
set(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/../bl702_flash_ble.ld)

View file

@ -12,6 +12,7 @@ Board: bl70x_iot
<File Name="../ble_peripheral_tp_server.c">
<FileOption/>
</File>
<File Name="../../bl_irq.c"/>
</VirtualDirectory>
<VirtualDirectory Name="chip">
<VirtualDirectory Name="riscv">
@ -503,200 +504,6 @@ Board: bl70x_iot
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
<BuildConfigs>
<BuildConfig Name="CK_Link_Debug">
<Target>
<ROMBank Selected="1">
<ROM1>
<InUse>no</InUse>
<Start>0x23000000</Start>
<Size>0x100000</Size>
</ROM1>
<ROM2>
<InUse>no</InUse>
<Start>0x22014000</Start>
<Size>0x4000</Size>
</ROM2>
<ROM3>
<InUse>no</InUse>
<Start>0x42018000</Start>
<Size>0x8000</Size>
</ROM3>
<ROM4>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM4>
<ROM5>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM5>
</ROMBank>
<RAMBank>
<RAM1>
<InUse>yes</InUse>
<Start>0x42020000</Start>
<Size>0xc000</Size>
<Init>yes</Init>
</RAM1>
<RAM2>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM2>
<RAM3>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM3>
<RAM4>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM4>
<RAM5>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM5>
</RAMBank>
<CPU>rv32imafc</CPU>
<UseMiniLib>yes</UseMiniLib>
<Endian>little</Endian>
<UseHardFloat>no</UseHardFloat>
<UseEnhancedLRW>no</UseEnhancedLRW>
<UseContinueBuild>no</UseContinueBuild>
<UseSemiHost>no</UseSemiHost>
</Target>
<Output>
<OutputName>$(ProjectName)</OutputName>
<Type>Executable</Type>
<CreateHexFile>no</CreateHexFile>
<CreateBinFile>yes</CreateBinFile>
<Preprocessor>no</Preprocessor>
<Disassmeble>yes</Disassmeble>
<CallGraph>no</CallGraph>
<Map>yes</Map>
</Output>
<User>
<BeforeCompile>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeCompile>
<BeforeMake>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeMake>
<AfterMake>
<RunUserProg>no</RunUserProg>
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
</AfterMake>
</User>
<Compiler>
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;CFG_FREERTOS;BL702;CFG_BLE_ENABLE;BFLB_BLE;CFG_BLE;CFG_SLEEP;OPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER;BL_MCU_SDK;CFG_CON=2;CFG_BLE_TX_BUFF_DATA=2;CONFIG_BT_ALLROLES;CONFIG_BT_CENTRAL;CONFIG_BT_OBSERVER;CONFIG_BT_PERIPHERAL;CONFIG_BT_BROADCASTER;CONFIG_BT_L2CAP_DYNAMIC_CHANNEL;CONFIG_BT_GATT_CLIENT;CONFIG_BT_CONN;CONFIG_BT_GATT_DIS_PNP;CONFIG_BT_GATT_DIS_SERIAL_NUMBER;CONFIG_BT_GATT_DIS_FW_REV;CONFIG_BT_GATT_DIS_HW_REV;CONFIG_BT_GATT_DIS_SW_REV;CONFIG_BT_ECC;CONFIG_BT_GATT_DYNAMIC_DB;CONFIG_BT_GATT_SERVICE_CHANGED;CONFIG_BT_KEYS_OVERWRITE_OLDEST;CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING;CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS;CONFIG_BT_BONDABLE;CONFIG_BT_HCI_VS_EVT_USER;CONFIG_BT_ASSERT;CONFIG_BT_SMP;CONFIG_BT_SIGNING;CONFIG_BT_SETTINGS_CCC_LAZY_LOADING;CONFIG_BT_SETTINGS_USE_PRINTK;CFG_BLE_STACK_DBG_PRINT;bl706_iot;MBEDTLS_CONFIG_FILE=\"mbedtls_bflb_config.h\"</Define>
<Undefine/>
<Optim>Optimize more (-O2)</Optim>
<DebugLevel>Default (-g)</DebugLevel>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/include;$(ProjectPath)../../../../components/freertos/portable/gcc/risc-v/bl702;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/ble/ble_stack/bl_hci_wrapper;$(ProjectPath)../../../../components/ble/ble_stack/cli_cmds;$(ProjectPath)../../../../components/ble/ble_stack/common;$(ProjectPath)../../../../components/ble/ble_stack/common/include;$(ProjectPath)../../../../components/ble/ble_stack/common/include/misc;$(ProjectPath)../../../../components/ble/ble_stack/common/include/toolchain;$(ProjectPath)../../../../components/ble/ble_stack/common/include/zephyr;$(ProjectPath)../../../../components/ble/ble_stack/common/tinycrypt/include/tinycrypt;$(ProjectPath)../../../../components/ble/ble_stack/port/include;$(ProjectPath)../../../../components/ble/ble_stack/hci_onchip;$(ProjectPath)../../../../components/ble/ble_stack/host;$(ProjectPath)../../../../components/ble/ble_stack/include/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/include/drivers/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/services;$(ProjectPath)../../../../components/ble/blecontroller/ble_inc;$(ProjectPath)../../../../components/ble/ble_stack/services/oad;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../components/mbedtls/library;$(ProjectPath)../../../../components/mbedtls/include/psa;$(ProjectPath)../../../../components/mbedtls/include;$(ProjectPath)../../../../components/mbedtls/bflb_port/inc</IncludePath>
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wunused -Wundef -msmall-data-limit=4 -std=c99</OtherFlags>
<Verbose>no</Verbose>
<Ansi>no</Ansi>
<Syntax>no</Syntax>
<Pedantic>no</Pedantic>
<PedanticErr>no</PedanticErr>
<InhibitWarn>no</InhibitWarn>
<AllWarn>yes</AllWarn>
<WarnErr>no</WarnErr>
<OneElfS>yes</OneElfS>
<OneElfSPerData>no</OneElfSPerData>
<Fstrict>no</Fstrict>
</Compiler>
<Asm>
<Define>portasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler;</Define>
<Undefine/>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/include;$(ProjectPath)../../../../components/freertos/portable/gcc/risc-v/bl702;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/ble/ble_stack/bl_hci_wrapper;$(ProjectPath)../../../../components/ble/ble_stack/cli_cmds;$(ProjectPath)../../../../components/ble/ble_stack/common;$(ProjectPath)../../../../components/ble/ble_stack/common/include;$(ProjectPath)../../../../components/ble/ble_stack/common/include/misc;$(ProjectPath)../../../../components/ble/ble_stack/common/include/toolchain;$(ProjectPath)../../../../components/ble/ble_stack/common/include/zephyr;$(ProjectPath)../../../../components/ble/ble_stack/common/tinycrypt/include/tinycrypt;$(ProjectPath)../../../../components/ble/ble_stack/port/include;$(ProjectPath)../../../../components/ble/ble_stack/hci_onchip;$(ProjectPath)../../../../components/ble/ble_stack/host;$(ProjectPath)../../../../components/ble/ble_stack/include/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/include/drivers/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/services;$(ProjectPath)../../../../components/ble/blecontroller/ble_inc;$(ProjectPath)../../../../components/ble/ble_stack/services/oad;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
<OtherFlags/>
<DebugLevel>gdwarf2</DebugLevel>
</Asm>
<Linker>
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)/../../bl702_flash_ble.ld</LDFile>
<LibName>blecontroller;bl702_rf;c;</LibName>
<LibPath>$(ProjectPath)../../../../components/ble/bl702_rf/lib;$(ProjectPath)../../../../components/ble/blecontroller/lib;</LibPath>
<OtherFlags>--specs=nano.specs</OtherFlags>
<AutoLDFile>no</AutoLDFile>
<LinkType/>
</Linker>
<Debug>
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
<Connector>ICE</Connector>
<StopAt>yes</StopAt>
<StopAtText>main</StopAtText>
<InitFile/>
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
<AutoRun>yes</AutoRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>23000000</SoftResetVal>
<ResetAfterLoad>no</ResetAfterLoad>
<AfterResetFile/>
<Dumpcore>no</Dumpcore>
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
<ConfigICE>
<IP>localhost</IP>
<PORT>1025</PORT>
<CPUNumber>0</CPUNumber>
<Clock>2000</Clock>
<Delay>10</Delay>
<WaitReset>50</WaitReset>
<DDC>yes</DDC>
<TRST>no</TRST>
<DebugPrint>no</DebugPrint>
<Connect>Normal</Connect>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<RTOSType>Bare Metal</RTOSType>
<DownloadToFlash>yes</DownloadToFlash>
<ResetAfterConnect>yes</ResetAfterConnect>
<GDBName/>
<GDBServerType>Local</GDBServerType>
<OtherFlags>-arch riscv</OtherFlags>
</ConfigICE>
<ConfigSIM>
<SIMTarget/>
<OtherFlags/>
<NoGraphic>yes</NoGraphic>
<Log>no</Log>
<SimTrace>no</SimTrace>
</ConfigSIM>
<ConfigOpenOCD>
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
<OpenOCDTclPort>6666</OpenOCDTclPort>
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
<OpenOCDTimeout>5000</OpenOCDTimeout>
</ConfigOpenOCD>
</Debug>
<Flash>
<InitFile/>
<Erase>Erase Sectors</Erase>
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
<Program>yes</Program>
<Verify>yes</Verify>
<ResetAndRun>no</ResetAndRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal/>
<External>no</External>
<Command>$(ProjectPath)/../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe</Command>
<Arguments>--chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </Arguments>
</Flash>
</BuildConfig>
<BuildConfig Name="OpenOCD_Debug">
<Target>
<ROMBank Selected="1">
@ -820,7 +627,7 @@ Board: bl70x_iot
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)/../../bl702_flash_ble.ld</LDFile>
<LibName>blecontroller;bl702_rf;c;</LibName>
<LibName>blecontroller_702_std;bl702_rf;c;</LibName>
<LibPath>$(ProjectPath)../../../../components/ble/bl702_rf/lib;$(ProjectPath)../../../../components/ble/blecontroller/lib;</LibPath>
<OtherFlags>--specs=nano.specs </OtherFlags>
<AutoLDFile>no</AutoLDFile>
@ -891,5 +698,199 @@ Board: bl70x_iot
<Arguments>--chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin"</Arguments>
</Flash>
</BuildConfig>
<BuildConfig Name="CK_Link_Debug">
<Target>
<ROMBank Selected="1">
<ROM1>
<InUse>no</InUse>
<Start>0x23000000</Start>
<Size>0x100000</Size>
</ROM1>
<ROM2>
<InUse>no</InUse>
<Start>0x22014000</Start>
<Size>0x4000</Size>
</ROM2>
<ROM3>
<InUse>no</InUse>
<Start>0x42018000</Start>
<Size>0x8000</Size>
</ROM3>
<ROM4>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM4>
<ROM5>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM5>
</ROMBank>
<RAMBank>
<RAM1>
<InUse>yes</InUse>
<Start>0x42020000</Start>
<Size>0xc000</Size>
<Init>yes</Init>
</RAM1>
<RAM2>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM2>
<RAM3>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM3>
<RAM4>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM4>
<RAM5>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM5>
</RAMBank>
<CPU>rv32imafc</CPU>
<UseMiniLib>yes</UseMiniLib>
<Endian>little</Endian>
<UseHardFloat>no</UseHardFloat>
<UseEnhancedLRW>no</UseEnhancedLRW>
<UseContinueBuild>no</UseContinueBuild>
<UseSemiHost>no</UseSemiHost>
</Target>
<Output>
<OutputName>$(ProjectName)</OutputName>
<Type>Executable</Type>
<CreateHexFile>no</CreateHexFile>
<CreateBinFile>yes</CreateBinFile>
<Preprocessor>no</Preprocessor>
<Disassmeble>yes</Disassmeble>
<CallGraph>no</CallGraph>
<Map>yes</Map>
</Output>
<User>
<BeforeCompile>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeCompile>
<BeforeMake>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeMake>
<AfterMake>
<RunUserProg>no</RunUserProg>
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
</AfterMake>
</User>
<Compiler>
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;CFG_FREERTOS;BL702;CFG_BLE_ENABLE;BFLB_BLE;CFG_BLE;CFG_SLEEP;OPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER;BL_MCU_SDK;CFG_CON=2;CFG_BLE_TX_BUFF_DATA=2;CONFIG_BT_ALLROLES;CONFIG_BT_CENTRAL;CONFIG_BT_OBSERVER;CONFIG_BT_PERIPHERAL;CONFIG_BT_BROADCASTER;CONFIG_BT_L2CAP_DYNAMIC_CHANNEL;CONFIG_BT_GATT_CLIENT;CONFIG_BT_CONN;CONFIG_BT_GATT_DIS_PNP;CONFIG_BT_GATT_DIS_SERIAL_NUMBER;CONFIG_BT_GATT_DIS_FW_REV;CONFIG_BT_GATT_DIS_HW_REV;CONFIG_BT_GATT_DIS_SW_REV;CONFIG_BT_ECC;CONFIG_BT_GATT_DYNAMIC_DB;CONFIG_BT_GATT_SERVICE_CHANGED;CONFIG_BT_KEYS_OVERWRITE_OLDEST;CONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING;CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS;CONFIG_BT_BONDABLE;CONFIG_BT_HCI_VS_EVT_USER;CONFIG_BT_ASSERT;CONFIG_BT_SMP;CONFIG_BT_SIGNING;CONFIG_BT_SETTINGS_CCC_LAZY_LOADING;CONFIG_BT_SETTINGS_USE_PRINTK;CFG_BLE_STACK_DBG_PRINT;bl706_iot;MBEDTLS_CONFIG_FILE=\"mbedtls_bflb_config.h\"</Define>
<Undefine/>
<Optim>Optimize more (-O2)</Optim>
<DebugLevel>Default (-g)</DebugLevel>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/include;$(ProjectPath)../../../../components/freertos/portable/gcc/risc-v/bl702;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/ble/ble_stack/bl_hci_wrapper;$(ProjectPath)../../../../components/ble/ble_stack/cli_cmds;$(ProjectPath)../../../../components/ble/ble_stack/common;$(ProjectPath)../../../../components/ble/ble_stack/common/include;$(ProjectPath)../../../../components/ble/ble_stack/common/include/misc;$(ProjectPath)../../../../components/ble/ble_stack/common/include/toolchain;$(ProjectPath)../../../../components/ble/ble_stack/common/include/zephyr;$(ProjectPath)../../../../components/ble/ble_stack/common/tinycrypt/include/tinycrypt;$(ProjectPath)../../../../components/ble/ble_stack/port/include;$(ProjectPath)../../../../components/ble/ble_stack/hci_onchip;$(ProjectPath)../../../../components/ble/ble_stack/host;$(ProjectPath)../../../../components/ble/ble_stack/include/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/include/drivers/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/services;$(ProjectPath)../../../../components/ble/blecontroller/ble_inc;$(ProjectPath)../../../../components/ble/ble_stack/services/oad;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../components/mbedtls/library;$(ProjectPath)../../../../components/mbedtls/include/psa;$(ProjectPath)../../../../components/mbedtls/include;$(ProjectPath)../../../../components/mbedtls/bflb_port/inc</IncludePath>
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wunused -Wundef -msmall-data-limit=4 -std=c99</OtherFlags>
<Verbose>no</Verbose>
<Ansi>no</Ansi>
<Syntax>no</Syntax>
<Pedantic>no</Pedantic>
<PedanticErr>no</PedanticErr>
<InhibitWarn>no</InhibitWarn>
<AllWarn>yes</AllWarn>
<WarnErr>no</WarnErr>
<OneElfS>yes</OneElfS>
<OneElfSPerData>no</OneElfSPerData>
<Fstrict>no</Fstrict>
</Compiler>
<Asm>
<Define>portasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler;</Define>
<Undefine/>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/include;$(ProjectPath)../../../../components/freertos/portable/gcc/risc-v/bl702;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/ble/ble_stack/bl_hci_wrapper;$(ProjectPath)../../../../components/ble/ble_stack/cli_cmds;$(ProjectPath)../../../../components/ble/ble_stack/common;$(ProjectPath)../../../../components/ble/ble_stack/common/include;$(ProjectPath)../../../../components/ble/ble_stack/common/include/misc;$(ProjectPath)../../../../components/ble/ble_stack/common/include/toolchain;$(ProjectPath)../../../../components/ble/ble_stack/common/include/zephyr;$(ProjectPath)../../../../components/ble/ble_stack/common/tinycrypt/include/tinycrypt;$(ProjectPath)../../../../components/ble/ble_stack/port/include;$(ProjectPath)../../../../components/ble/ble_stack/hci_onchip;$(ProjectPath)../../../../components/ble/ble_stack/host;$(ProjectPath)../../../../components/ble/ble_stack/include/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/include/drivers/bluetooth;$(ProjectPath)../../../../components/ble/ble_stack/services;$(ProjectPath)../../../../components/ble/blecontroller/ble_inc;$(ProjectPath)../../../../components/ble/ble_stack/services/oad;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
<OtherFlags/>
<DebugLevel>gdwarf2</DebugLevel>
</Asm>
<Linker>
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)/../../bl702_flash_ble.ld</LDFile>
<LibName>blecontroller_702_std;bl702_rf;c;</LibName>
<LibPath>$(ProjectPath)../../../../components/ble/bl702_rf/lib;$(ProjectPath)../../../../components/ble/blecontroller/lib;</LibPath>
<OtherFlags>--specs=nano.specs</OtherFlags>
<AutoLDFile>no</AutoLDFile>
<LinkType/>
</Linker>
<Debug>
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
<Connector>ICE</Connector>
<StopAt>yes</StopAt>
<StopAtText>main</StopAtText>
<InitFile/>
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
<AutoRun>yes</AutoRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>23000000</SoftResetVal>
<ResetAfterLoad>no</ResetAfterLoad>
<AfterResetFile/>
<Dumpcore>no</Dumpcore>
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
<ConfigICE>
<IP>localhost</IP>
<PORT>1025</PORT>
<CPUNumber>0</CPUNumber>
<Clock>2000</Clock>
<Delay>10</Delay>
<WaitReset>50</WaitReset>
<DDC>yes</DDC>
<TRST>no</TRST>
<DebugPrint>no</DebugPrint>
<Connect>Normal</Connect>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<RTOSType>Bare Metal</RTOSType>
<DownloadToFlash>yes</DownloadToFlash>
<ResetAfterConnect>yes</ResetAfterConnect>
<GDBName/>
<GDBServerType>Local</GDBServerType>
<OtherFlags>-arch riscv</OtherFlags>
</ConfigICE>
<ConfigSIM>
<SIMTarget/>
<OtherFlags/>
<NoGraphic>yes</NoGraphic>
<Log>no</Log>
<SimTrace>no</SimTrace>
</ConfigSIM>
<ConfigOpenOCD>
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
<OpenOCDTclPort>6666</OpenOCDTclPort>
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
<OpenOCDTimeout>5000</OpenOCDTimeout>
</ConfigOpenOCD>
</Debug>
<Flash>
<InitFile/>
<Erase>Erase Sectors</Erase>
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
<Program>yes</Program>
<Verify>yes</Verify>
<ResetAndRun>no</ResetAndRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal/>
<External>no</External>
<Command>$(ProjectPath)/../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe</Command>
<Arguments>--chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </Arguments>
</Flash>
</BuildConfig>
</BuildConfigs>
</Project>

View file

@ -128,18 +128,18 @@ int ble_start_adv(void)
{
struct bt_le_adv_param adv_param = {
//options:3, connectable undirected, adv one time
.options = 3,
.options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_ONE_TIME),
.interval_min = BT_GAP_ADV_FAST_INT_MIN_3,
.interval_max = BT_GAP_ADV_FAST_INT_MAX_3,
};
char *adv_name = "BL_TEST_01"; // This name must be the same as adv_name in ble_central
struct bt_data adv_data[2] = {
//char *adv_name = "BL_TEST_01"; // This name must be the same as adv_name in ble_central
struct bt_data adv_data[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_NO_BREDR | BT_LE_AD_GENERAL)),
BT_DATA(BT_DATA_NAME_COMPLETE, adv_name, strlen(adv_name)),
//BT_DATA(BT_DATA_NAME_COMPLETE, adv_name, strlen(adv_name)),
};
return bt_le_adv_start(&adv_param, adv_data, ARRAY_SIZE(adv_data), &adv_data[1], 1);
return bt_le_adv_start(&adv_param, adv_data, ARRAY_SIZE(adv_data), NULL, 0);
}
#if defined(CONFIG_BT_OAD_SERVER)

View file

@ -1,3 +1,5 @@
请使用 10.2 版本以上 T-head 工具链编译该 demo
```bash
$ make APP=ble_peripheral BOARD=bl706_iot SUPPORT_FLOAT=y