mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
add buttonless dfu support
This commit is contained in:
@@ -301,8 +301,8 @@
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20001fe8</StartAddress>
|
||||
<Size>0x2018</Size>
|
||||
<StartAddress>0x20001ff8</StartAddress>
|
||||
<Size>0x2008</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
@@ -338,9 +338,9 @@
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--locale=english</MiscControls>
|
||||
<Define>BLE_STACK_SUPPORT_REQD NRF51822 NRF_SD_BLE_API_VERSION=2 S130 NRF51 SOFTDEVICE_PRESENT SWI_DISABLE0 __HEAP_SIZE=4096 __STACK_SIZE=2048</Define>
|
||||
<Define>BLE_STACK_SUPPORT_REQD NRF51822 NRF_SD_BLE_API_VERSION=2 S130 NRF51 SOFTDEVICE_PRESENT NRF_DFU_SETTINGS_VERSION=1 SWI_DISABLE0 __HEAP_SIZE=4096 __STACK_SIZE=1200</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\12.3.0_d7731ad;..\SDK\12.3.0_d7731ad\components\toolchain;..\SDK\12.3.0_d7731ad\components\toolchain\cmsis\include;..\SDK\12.3.0_d7731ad\components\drivers_nrf\clock;..\SDK\12.3.0_d7731ad\components\drivers_nrf\common;..\SDK\12.3.0_d7731ad\components\drivers_nrf\delay;..\SDK\12.3.0_d7731ad\components\drivers_nrf\gpiote;..\SDK\12.3.0_d7731ad\components\drivers_nrf\hal;..\SDK\12.3.0_d7731ad\components\drivers_nrf\spi_master;..\SDK\12.3.0_d7731ad\components\drivers_nrf\twi_master;..\SDK\12.3.0_d7731ad\external\segger_rtt;..\SDK\12.3.0_d7731ad\components\libraries\fds;..\SDK\12.3.0_d7731ad\components\libraries\fstorage;..\SDK\12.3.0_d7731ad\components\libraries\experimental_section_vars;..\SDK\12.3.0_d7731ad\components\libraries\log;..\SDK\12.3.0_d7731ad\components\libraries\log\src;..\SDK\12.3.0_d7731ad\components\libraries\pwr_mgmt;..\SDK\12.3.0_d7731ad\components\libraries\scheduler;..\SDK\12.3.0_d7731ad\components\libraries\trace;..\SDK\12.3.0_d7731ad\components\libraries\timer;..\SDK\12.3.0_d7731ad\components\libraries\util;..\SDK\12.3.0_d7731ad\components\ble\common;..\SDK\12.3.0_d7731ad\components\ble\ble_advertising;..\SDK\12.3.0_d7731ad\components\softdevice\common\softdevice_handler;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers\nrf51</IncludePath>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\12.3.0_d7731ad;..\SDK\12.3.0_d7731ad\components\toolchain;..\SDK\12.3.0_d7731ad\components\toolchain\cmsis\include;..\SDK\12.3.0_d7731ad\components\drivers_nrf\clock;..\SDK\12.3.0_d7731ad\components\drivers_nrf\common;..\SDK\12.3.0_d7731ad\components\drivers_nrf\delay;..\SDK\12.3.0_d7731ad\components\drivers_nrf\gpiote;..\SDK\12.3.0_d7731ad\components\drivers_nrf\hal;..\SDK\12.3.0_d7731ad\components\drivers_nrf\spi_master;..\SDK\12.3.0_d7731ad\components\drivers_nrf\twi_master;..\SDK\12.3.0_d7731ad\external\segger_rtt;..\SDK\12.3.0_d7731ad\components\libraries\bootloader\dfu;..\SDK\12.3.0_d7731ad\components\libraries\crc32;..\SDK\12.3.0_d7731ad\components\libraries\fds;..\SDK\12.3.0_d7731ad\components\libraries\fstorage;..\SDK\12.3.0_d7731ad\components\libraries\experimental_section_vars;..\SDK\12.3.0_d7731ad\components\libraries\log;..\SDK\12.3.0_d7731ad\components\libraries\log\src;..\SDK\12.3.0_d7731ad\components\libraries\pwr_mgmt;..\SDK\12.3.0_d7731ad\components\libraries\scheduler;..\SDK\12.3.0_d7731ad\components\libraries\trace;..\SDK\12.3.0_d7731ad\components\libraries\timer;..\SDK\12.3.0_d7731ad\components\libraries\util;..\SDK\12.3.0_d7731ad\components\ble\common;..\SDK\12.3.0_d7731ad\components\ble\ble_advertising;..\SDK\12.3.0_d7731ad\components\ble\ble_services\ble_dfu;..\SDK\12.3.0_d7731ad\components\softdevice\common\softdevice_handler;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers\nrf51</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -356,7 +356,7 @@
|
||||
<ClangAsOpt>1</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>BLE_STACK_SUPPORT_REQD NRF51822 NRF_SD_BLE_API_VERSION=2 S130 NRF51 SOFTDEVICE_PRESENT SWI_DISABLE0 __HEAP_SIZE=4096 __STACK_SIZE=2048</Define>
|
||||
<Define>BLE_STACK_SUPPORT_REQD NRF51822 NRF_SD_BLE_API_VERSION=2 S130 NRF51 SOFTDEVICE_PRESENT NRF_DFU_SETTINGS_VERSION=1 SWI_DISABLE0 __HEAP_SIZE=4096 __STACK_SIZE=1200</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\12.3.0_d7731ad;..\SDK\12.3.0_d7731ad\components\toolchain;..\SDK\12.3.0_d7731ad\components\toolchain\cmsis\include;..\SDK\12.3.0_d7731ad\components\drivers_nrf\clock;..\SDK\12.3.0_d7731ad\components\drivers_nrf\common;..\SDK\12.3.0_d7731ad\components\drivers_nrf\delay;..\SDK\12.3.0_d7731ad\components\drivers_nrf\gpiote;..\SDK\12.3.0_d7731ad\components\drivers_nrf\hal;..\SDK\12.3.0_d7731ad\components\drivers_nrf\spi_master;..\SDK\12.3.0_d7731ad\components\drivers_nrf\twi_master;..\SDK\12.3.0_d7731ad\external\segger_rtt;..\SDK\12.3.0_d7731ad\components\libraries\fds;..\SDK\12.3.0_d7731ad\components\libraries\fstorage;..\SDK\12.3.0_d7731ad\components\libraries\experimental_section_vars;..\SDK\12.3.0_d7731ad\components\libraries\log;..\SDK\12.3.0_d7731ad\components\libraries\log\src;..\SDK\12.3.0_d7731ad\components\libraries\pwr_mgmt;..\SDK\12.3.0_d7731ad\components\libraries\scheduler;..\SDK\12.3.0_d7731ad\components\libraries\trace;..\SDK\12.3.0_d7731ad\components\libraries\timer;..\SDK\12.3.0_d7731ad\components\libraries\util;..\SDK\12.3.0_d7731ad\components\ble\common;..\SDK\12.3.0_d7731ad\components\ble\ble_advertising;..\SDK\12.3.0_d7731ad\components\softdevice\common\softdevice_handler;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers;..\SDK\12.3.0_d7731ad\components\softdevice\s130\headers\nrf51</IncludePath>
|
||||
</VariousControls>
|
||||
@@ -479,6 +479,26 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\ble\common\ble_srv_common.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ble_dfu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\ble\ble_services\ble_dfu\ble_dfu.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_Bootloader</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>nrf_dfu_settings.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\bootloader\dfu\nrf_dfu_settings.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_dfu_flash_buttonless.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\dfu\nrf_dfu_flash_buttonless.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -534,6 +554,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\util\app_util_platform.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>crc32.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\crc32\crc32.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fstorage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -1086,6 +1111,26 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\ble\common\ble_srv_common.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ble_dfu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\ble\ble_services\ble_dfu\ble_dfu.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_Bootloader</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>nrf_dfu_settings.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\bootloader\dfu\nrf_dfu_settings.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_dfu_flash_buttonless.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\dfu\nrf_dfu_flash_buttonless.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -1141,6 +1186,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\util\app_util_platform.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>crc32.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\12.3.0_d7731ad\components\libraries\crc32\crc32.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fstorage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
@@ -301,8 +301,8 @@
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x200022c8</StartAddress>
|
||||
<Size>0x3d38</Size>
|
||||
<StartAddress>0x200022d8</StartAddress>
|
||||
<Size>0x3d28</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
@@ -338,9 +338,9 @@
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--locale=english --reduce_paths</MiscControls>
|
||||
<Define>APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED CONFIG_GPIO_AS_PINRESET DEVELOP_IN_NRF52840 FLOAT_ABI_SOFT NRF52811_XXAA NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 NRF_SD_BLE_API_VERSION=7 S112 SOFTDEVICE_PRESENT __HEAP_SIZE=8192 __STACK_SIZE=2048</Define>
|
||||
<Define>APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED CONFIG_GPIO_AS_PINRESET DEVELOP_IN_NRF52840 FLOAT_ABI_SOFT NRF52811_XXAA NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 NRF_DFU_SVCI_ENABLED NRF_DFU_TRANSPORT_BLE=1 NRF_SD_BLE_API_VERSION=7 S112 SOFTDEVICE_PRESENT __HEAP_SIZE=8192 __STACK_SIZE=2048</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\17.1.0_ddde560;..\SDK\17.1.0_ddde560\components\ble\common;..\SDK\17.1.0_ddde560\components\ble\ble_advertising;..\SDK\17.1.0_ddde560\components\ble\nrf_ble_gatt;..\SDK\17.1.0_ddde560\components\libraries\atomic;..\SDK\17.1.0_ddde560\components\libraries\atomic_fifo;..\SDK\17.1.0_ddde560\components\libraries\atomic_flags;..\SDK\17.1.0_ddde560\components\libraries\balloc;..\SDK\17.1.0_ddde560\components\libraries\delay;..\SDK\17.1.0_ddde560\components\libraries\fstorage;..\SDK\17.1.0_ddde560\components\libraries\fds;..\SDK\17.1.0_ddde560\components\libraries\experimental_section_vars;..\SDK\17.1.0_ddde560\components\libraries\log;..\SDK\17.1.0_ddde560\components\libraries\log\src;..\SDK\17.1.0_ddde560\components\libraries\memobj;..\SDK\17.1.0_ddde560\components\libraries\mutex;..\SDK\17.1.0_ddde560\components\libraries\pwr_mgmt;..\SDK\17.1.0_ddde560\components\libraries\ringbuf;..\SDK\17.1.0_ddde560\components\libraries\sortlist;..\SDK\17.1.0_ddde560\components\libraries\scheduler;..\SDK\17.1.0_ddde560\components\libraries\strerror;..\SDK\17.1.0_ddde560\components\libraries\timer;..\SDK\17.1.0_ddde560\components\libraries\util;..\SDK\17.1.0_ddde560\components\softdevice\common;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers\nrf52;..\SDK\17.1.0_ddde560\components\toolchain\cmsis\include;..\SDK\17.1.0_ddde560\external\fprintf;..\SDK\17.1.0_ddde560\external\segger_rtt;..\SDK\17.1.0_ddde560\integration\nrfx;..\SDK\17.1.0_ddde560\integration\nrfx\legacy;..\SDK\17.1.0_ddde560\modules\nrfx;..\SDK\17.1.0_ddde560\modules\nrfx\mdk;..\SDK\17.1.0_ddde560\modules\nrfx\drivers\include;..\SDK\17.1.0_ddde560\modules\nrfx\hal</IncludePath>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\17.1.0_ddde560;..\SDK\17.1.0_ddde560\components\ble\common;..\SDK\17.1.0_ddde560\components\ble\ble_advertising;..\SDK\17.1.0_ddde560\components\ble\nrf_ble_gatt;..\SDK\17.1.0_ddde560\components\ble\ble_services\ble_dfu;..\SDK\17.1.0_ddde560\components\libraries\atomic;..\SDK\17.1.0_ddde560\components\libraries\atomic_fifo;..\SDK\17.1.0_ddde560\components\libraries\atomic_flags;..\SDK\17.1.0_ddde560\components\libraries\balloc;..\SDK\17.1.0_ddde560\components\libraries\bootloader;..\SDK\17.1.0_ddde560\components\libraries\bootloader\ble_dfu;..\SDK\17.1.0_ddde560\components\libraries\bootloader\dfu;..\SDK\17.1.0_ddde560\components\libraries\delay;..\SDK\17.1.0_ddde560\components\libraries\fstorage;..\SDK\17.1.0_ddde560\components\libraries\fds;..\SDK\17.1.0_ddde560\components\libraries\experimental_section_vars;..\SDK\17.1.0_ddde560\components\libraries\log;..\SDK\17.1.0_ddde560\components\libraries\log\src;..\SDK\17.1.0_ddde560\components\libraries\memobj;..\SDK\17.1.0_ddde560\components\libraries\mutex;..\SDK\17.1.0_ddde560\components\libraries\pwr_mgmt;..\SDK\17.1.0_ddde560\components\libraries\ringbuf;..\SDK\17.1.0_ddde560\components\libraries\sortlist;..\SDK\17.1.0_ddde560\components\libraries\scheduler;..\SDK\17.1.0_ddde560\components\libraries\strerror;..\SDK\17.1.0_ddde560\components\libraries\svc;..\SDK\17.1.0_ddde560\components\libraries\timer;..\SDK\17.1.0_ddde560\components\libraries\util;..\SDK\17.1.0_ddde560\components\softdevice\common;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers\nrf52;..\SDK\17.1.0_ddde560\components\toolchain\cmsis\include;..\SDK\17.1.0_ddde560\external\fprintf;..\SDK\17.1.0_ddde560\external\segger_rtt;..\SDK\17.1.0_ddde560\integration\nrfx;..\SDK\17.1.0_ddde560\integration\nrfx\legacy;..\SDK\17.1.0_ddde560\modules\nrfx;..\SDK\17.1.0_ddde560\modules\nrfx\mdk;..\SDK\17.1.0_ddde560\modules\nrfx\drivers\include;..\SDK\17.1.0_ddde560\modules\nrfx\hal</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -356,7 +356,7 @@
|
||||
<ClangAsOpt>1</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls>--cpreproc_opts=-DAPP_TIMER_V2,-DAPP_TIMER_V2_RTC1_ENABLED,-DCONFIG_GPIO_AS_PINRESET,-DDEVELOP_IN_NRF52840,-DFLOAT_ABI_SOFT,-DNRF52811_XXAA,-DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3,-DNRF_SD_BLE_API_VERSION=7,-DS112,-DSOFTDEVICE_PRESENT,-D__HEAP_SIZE=8192,-D__STACK_SIZE=2048</MiscControls>
|
||||
<Define>APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED CONFIG_GPIO_AS_PINRESET DEVELOP_IN_NRF52840 FLOAT_ABI_SOFT NRF52811_XXAA NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 NRF_SD_BLE_API_VERSION=7 S112 SOFTDEVICE_PRESENT __HEAP_SIZE=8192 __STACK_SIZE=2048</Define>
|
||||
<Define>APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED CONFIG_GPIO_AS_PINRESET DEVELOP_IN_NRF52840 FLOAT_ABI_SOFT NRF52811_XXAA NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 NRF_DFU_SVCI_ENABLED NRF_DFU_TRANSPORT_BLE=1 NRF_SD_BLE_API_VERSION=7 S112 SOFTDEVICE_PRESENT __HEAP_SIZE=8192 __STACK_SIZE=2048</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\config;..\EPD;..\GUI;..\SDK\17.1.0_ddde560;..\SDK\17.1.0_ddde560\components\ble\common;..\SDK\17.1.0_ddde560\components\ble\ble_advertising;..\SDK\17.1.0_ddde560\components\ble\nrf_ble_gatt;..\SDK\17.1.0_ddde560\components\libraries\atomic;..\SDK\17.1.0_ddde560\components\libraries\atomic_fifo;..\SDK\17.1.0_ddde560\components\libraries\atomic_flags;..\SDK\17.1.0_ddde560\components\libraries\balloc;..\SDK\17.1.0_ddde560\components\libraries\delay;..\SDK\17.1.0_ddde560\components\libraries\fstorage;..\SDK\17.1.0_ddde560\components\libraries\fds;..\SDK\17.1.0_ddde560\components\libraries\experimental_section_vars;..\SDK\17.1.0_ddde560\components\libraries\log;..\SDK\17.1.0_ddde560\components\libraries\log\src;..\SDK\17.1.0_ddde560\components\libraries\memobj;..\SDK\17.1.0_ddde560\components\libraries\mutex;..\SDK\17.1.0_ddde560\components\libraries\pwr_mgmt;..\SDK\17.1.0_ddde560\components\libraries\ringbuf;..\SDK\17.1.0_ddde560\components\libraries\sortlist;..\SDK\17.1.0_ddde560\components\libraries\scheduler;..\SDK\17.1.0_ddde560\components\libraries\strerror;..\SDK\17.1.0_ddde560\components\libraries\timer;..\SDK\17.1.0_ddde560\components\libraries\util;..\SDK\17.1.0_ddde560\components\softdevice\common;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers;..\SDK\17.1.0_ddde560\components\softdevice\s112\headers\nrf52;..\SDK\17.1.0_ddde560\components\toolchain\cmsis\include;..\SDK\17.1.0_ddde560\external\fprintf;..\SDK\17.1.0_ddde560\external\segger_rtt;..\SDK\17.1.0_ddde560\integration\nrfx;..\SDK\17.1.0_ddde560\integration\nrfx\legacy;..\SDK\17.1.0_ddde560\modules\nrfx;..\SDK\17.1.0_ddde560\modules\nrfx\mdk;..\SDK\17.1.0_ddde560\modules\nrfx\drivers\include;..\SDK\17.1.0_ddde560\modules\nrfx\hal</IncludePath>
|
||||
</VariousControls>
|
||||
@@ -486,6 +486,21 @@
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_DFU</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ble_dfu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\ble\ble_services\ble_dfu\ble_dfu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ble_dfu_unbonded.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_Drivers</GroupName>
|
||||
<Files>
|
||||
@@ -599,6 +614,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\libraries\balloc\nrf_balloc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_dfu_svci.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\libraries\bootloader\dfu\nrf_dfu_svci.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_fprintf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -1218,6 +1238,21 @@
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_DFU</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ble_dfu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\ble\ble_services\ble_dfu\ble_dfu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ble_dfu_unbonded.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>nRF_Drivers</GroupName>
|
||||
<Files>
|
||||
@@ -1331,6 +1366,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\libraries\balloc\nrf_balloc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_dfu_svci.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\SDK\17.1.0_ddde560\components\libraries\bootloader\dfu\nrf_dfu_svci.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nrf_fprintf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
@@ -15,7 +15,10 @@ SRC_FILES += \
|
||||
$(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \
|
||||
$(SDK_ROOT)/components/ble/common/ble_conn_params.c \
|
||||
$(SDK_ROOT)/components/ble/common/ble_srv_common.c \
|
||||
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu.c \
|
||||
$(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_settings.c \
|
||||
$(SDK_ROOT)/components/libraries/fds/fds.c \
|
||||
$(SDK_ROOT)/components/libraries/crc32/crc32.c \
|
||||
$(SDK_ROOT)/components/libraries/fstorage/fstorage.c \
|
||||
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \
|
||||
$(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
|
||||
@@ -35,6 +38,7 @@ SRC_FILES += \
|
||||
$(SDK_ROOT)/external/segger_rtt/RTT_Syscalls_GCC.c \
|
||||
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \
|
||||
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \
|
||||
$(SDK_ROOT)/dfu/nrf_dfu_flash_buttonless.c \
|
||||
$(PROJ_DIR)/main.c \
|
||||
$(PROJ_DIR)/EPD/EPD_config.c \
|
||||
$(PROJ_DIR)/EPD/EPD_driver.c \
|
||||
@@ -61,6 +65,8 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/drivers_nrf/spi_master \
|
||||
$(SDK_ROOT)/components/libraries/fstorage \
|
||||
$(SDK_ROOT)/components/libraries/experimental_section_vars \
|
||||
$(SDK_ROOT)/components/libraries/bootloader/dfu \
|
||||
$(SDK_ROOT)/components/libraries/crc32 \
|
||||
$(SDK_ROOT)/components/libraries/fds \
|
||||
$(SDK_ROOT)/components/libraries/log \
|
||||
$(SDK_ROOT)/components/libraries/log/src \
|
||||
@@ -70,6 +76,7 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/libraries/util \
|
||||
$(SDK_ROOT)/components/ble/common \
|
||||
$(SDK_ROOT)/components/ble/ble_advertising \
|
||||
$(SDK_ROOT)/components/ble/ble_services/ble_dfu \
|
||||
$(SDK_ROOT)/components/softdevice/common/softdevice_handler \
|
||||
$(SDK_ROOT)/components/softdevice/s130/headers \
|
||||
$(SDK_ROOT)/components/softdevice/s130/headers/nrf51 \
|
||||
@@ -87,6 +94,7 @@ CFLAGS += -DNRF51
|
||||
CFLAGS += -DS130
|
||||
CFLAGS += -DBLE_STACK_SUPPORT_REQD
|
||||
CFLAGS += -DSWI_DISABLE0
|
||||
CFLAGS += -DNRF_DFU_SETTINGS_VERSION=1
|
||||
CFLAGS += -DNRF51822
|
||||
CFLAGS += -DNRF_SD_BLE_API_VERSION=2
|
||||
CFLAGS += -mcpu=cortex-m0
|
||||
@@ -107,6 +115,7 @@ ASMFLAGS += -DNRF51
|
||||
ASMFLAGS += -DS130
|
||||
ASMFLAGS += -DBLE_STACK_SUPPORT_REQD
|
||||
ASMFLAGS += -DSWI_DISABLE0
|
||||
ASMFLAGS += -DNRF_DFU_SETTINGS_VERSION=1
|
||||
ASMFLAGS += -DNRF51822
|
||||
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=2
|
||||
|
||||
@@ -118,9 +127,9 @@ LDFLAGS += -Wl,--gc-sections
|
||||
# use newlib in nano version
|
||||
LDFLAGS += --specs=nano.specs -lc -lnosys
|
||||
|
||||
nrf51822_xxaa: CFLAGS += -D__HEAP_SIZE=4096
|
||||
nrf51822_xxaa: CFLAGS += -D__HEAP_SIZE=2048
|
||||
nrf51822_xxaa: CFLAGS += -D__STACK_SIZE=2048
|
||||
nrf51822_xxaa: ASMFLAGS += -D__HEAP_SIZE=4096
|
||||
nrf51822_xxaa: ASMFLAGS += -D__HEAP_SIZE=2048
|
||||
nrf51822_xxaa: ASMFLAGS += -D__STACK_SIZE=2048
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,13 @@ SRC_FILES += \
|
||||
$(SDK_ROOT)/components/ble/common/ble_srv_common.c \
|
||||
$(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \
|
||||
$(SDK_ROOT)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c \
|
||||
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu.c \
|
||||
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c \
|
||||
$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
|
||||
$(SDK_ROOT)/components/libraries/atomic_flags/nrf_atflags.c \
|
||||
$(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \
|
||||
$(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \
|
||||
$(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_svci.c \
|
||||
$(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c \
|
||||
$(SDK_ROOT)/components/libraries/fds/fds.c \
|
||||
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage.c \
|
||||
@@ -82,6 +85,9 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/libraries/atomic_fifo \
|
||||
$(SDK_ROOT)/components/libraries/atomic_flags \
|
||||
$(SDK_ROOT)/components/libraries/balloc \
|
||||
$(SDK_ROOT)/components/libraries/bootloader \
|
||||
$(SDK_ROOT)/components/libraries/bootloader/ble_dfu \
|
||||
$(SDK_ROOT)/components/libraries/bootloader/dfu \
|
||||
$(SDK_ROOT)/components/libraries/delay \
|
||||
$(SDK_ROOT)/components/libraries/fstorage \
|
||||
$(SDK_ROOT)/components/libraries/fds \
|
||||
@@ -95,11 +101,13 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/libraries/sortlist \
|
||||
$(SDK_ROOT)/components/libraries/scheduler \
|
||||
$(SDK_ROOT)/components/libraries/strerror \
|
||||
$(SDK_ROOT)/components/libraries/svc \
|
||||
$(SDK_ROOT)/components/libraries/timer \
|
||||
$(SDK_ROOT)/components/libraries/util \
|
||||
$(SDK_ROOT)/components/ble/common \
|
||||
$(SDK_ROOT)/components/ble/ble_advertising \
|
||||
$(SDK_ROOT)/components/ble/nrf_ble_gatt \
|
||||
$(SDK_ROOT)/components/ble/ble_services/ble_dfu \
|
||||
$(SDK_ROOT)/external/fprintf \
|
||||
$(SDK_ROOT)/external/segger_rtt \
|
||||
$(SDK_ROOT)/integration/nrfx \
|
||||
@@ -129,6 +137,8 @@ CFLAGS += -DDEVELOP_IN_NRF52840
|
||||
CFLAGS += -DFLOAT_ABI_SOFT
|
||||
CFLAGS += -DNRF52811_XXAA
|
||||
CFLAGS += -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3
|
||||
CFLAGS += -DNRF_DFU_SVCI_ENABLED
|
||||
CFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
|
||||
CFLAGS += -DNRF_SD_BLE_API_VERSION=7
|
||||
CFLAGS += -DS112
|
||||
CFLAGS += -DSOFTDEVICE_PRESENT
|
||||
@@ -155,6 +165,8 @@ ASMFLAGS += -DDEVELOP_IN_NRF52840
|
||||
ASMFLAGS += -DFLOAT_ABI_SOFT
|
||||
ASMFLAGS += -DNRF52811_XXAA
|
||||
ASMFLAGS += -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3
|
||||
ASMFLAGS += -DNRF_DFU_SVCI_ENABLED
|
||||
ASMFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
|
||||
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=7
|
||||
ASMFLAGS += -DS112
|
||||
ASMFLAGS += -DSOFTDEVICE_PRESENT
|
||||
|
||||
198
SDK/12.3.0_d7731ad/dfu/nrf_dfu_flash_buttonless.c
Normal file
198
SDK/12.3.0_d7731ad/dfu/nrf_dfu_flash_buttonless.c
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nrf_dfu_flash.h"
|
||||
#include "nrf_dfu_types.h"
|
||||
#include "softdevice_handler.h"
|
||||
#include "nrf_log.h"
|
||||
|
||||
#ifdef SOFTDEVICE_PRESENT
|
||||
// Only include fstorage if SD interaction is required
|
||||
#include "fstorage.h"
|
||||
#endif
|
||||
|
||||
#define FLASH_FLAG_NONE (0)
|
||||
#define FLASH_FLAG_OPER (1<<0)
|
||||
#define FLASH_FLAG_FAILURE_SINCE_LAST (1<<1)
|
||||
#define FLASH_FLAG_SD_ENABLED (1<<2)
|
||||
|
||||
static uint32_t m_flags;
|
||||
|
||||
#ifdef BLE_STACK_SUPPORT_REQD
|
||||
|
||||
// Function prototypes
|
||||
static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result);
|
||||
|
||||
FS_REGISTER_CFG(fs_config_t fs_dfu_config) =
|
||||
{
|
||||
.callback = fs_evt_handler, // Function for event callbacks.
|
||||
.p_start_addr = (uint32_t*)MBR_SIZE,
|
||||
.p_end_addr = (uint32_t*)BOOTLOADER_SETTINGS_ADDRESS + CODE_PAGE_SIZE
|
||||
};
|
||||
|
||||
|
||||
static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result)
|
||||
{
|
||||
// Clear the operation flag
|
||||
m_flags &= ~FLASH_FLAG_OPER;
|
||||
|
||||
if (result == FS_SUCCESS)
|
||||
{
|
||||
// Clear flag for ongoing operation and failure since last
|
||||
m_flags &= ~FLASH_FLAG_FAILURE_SINCE_LAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
NRF_LOG_INFO("Generating failure\r\n");
|
||||
m_flags |= FLASH_FLAG_FAILURE_SINCE_LAST;
|
||||
}
|
||||
|
||||
if (evt->p_context)
|
||||
{
|
||||
//lint -e611
|
||||
((dfu_flash_callback_t)evt->p_context)(evt, result);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
uint32_t nrf_dfu_flash_init(bool sd_enabled)
|
||||
{
|
||||
m_flags = FLASH_FLAG_SD_ENABLED;
|
||||
return NRF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
fs_ret_t nrf_dfu_flash_store(uint32_t const * p_dest, uint32_t const * const p_src, uint32_t len_words, dfu_flash_callback_t callback)
|
||||
{
|
||||
fs_ret_t ret_val = FS_SUCCESS;
|
||||
|
||||
if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0)
|
||||
{
|
||||
// Check if there is a pending error
|
||||
if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0)
|
||||
{
|
||||
NRF_LOG_INFO("Flash: Failure since last\r\n");
|
||||
return FS_ERR_FAILURE_SINCE_LAST;
|
||||
}
|
||||
|
||||
// Set the flag to indicate ongoing operation
|
||||
m_flags |= FLASH_FLAG_OPER;
|
||||
//lint -e611
|
||||
ret_val = fs_store(&fs_dfu_config, p_dest, p_src, len_words, (void*)callback);
|
||||
|
||||
if (ret_val != FS_SUCCESS)
|
||||
{
|
||||
NRF_LOG_INFO("Flash: failed %d\r\n", ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
// Set the flag to indicate ongoing operation
|
||||
m_flags |= FLASH_FLAG_OPER;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
/** @brief Internal function to initialize DFU BLE transport
|
||||
*/
|
||||
fs_ret_t nrf_dfu_flash_erase(uint32_t const * p_dest, uint32_t num_pages, dfu_flash_callback_t callback)
|
||||
{
|
||||
fs_ret_t ret_val = FS_SUCCESS;
|
||||
NRF_LOG_INFO("Erasing: 0x%08x, num: %d\r\n", (uint32_t)p_dest, num_pages);
|
||||
|
||||
if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0)
|
||||
{
|
||||
// Check if there is a pending error
|
||||
if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0)
|
||||
{
|
||||
NRF_LOG_INFO("Erase: Failure since last\r\n");
|
||||
return FS_ERR_FAILURE_SINCE_LAST;
|
||||
}
|
||||
|
||||
m_flags |= FLASH_FLAG_OPER;
|
||||
ret_val = fs_erase(&fs_dfu_config, p_dest, num_pages, (void*)callback);
|
||||
|
||||
if (ret_val != FS_SUCCESS)
|
||||
{
|
||||
NRF_LOG_INFO("Erase failed: %d\r\n", ret_val);
|
||||
m_flags &= ~FLASH_FLAG_OPER;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
// Set the flag to indicate ongoing operation
|
||||
m_flags |= FLASH_FLAG_OPER;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
void nrf_dfu_flash_error_clear(void)
|
||||
{
|
||||
m_flags &= ~FLASH_FLAG_FAILURE_SINCE_LAST;
|
||||
}
|
||||
|
||||
|
||||
fs_ret_t nrf_dfu_flash_wait(void)
|
||||
{
|
||||
NRF_LOG_INFO("Waiting for finished...\r\n");
|
||||
|
||||
#ifdef BLE_STACK_SUPPORT_REQD
|
||||
if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0)
|
||||
{
|
||||
while ((m_flags & FLASH_FLAG_OPER) != 0)
|
||||
{
|
||||
(void)sd_app_evt_wait();
|
||||
}
|
||||
|
||||
if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0)
|
||||
{
|
||||
NRF_LOG_INFO("Failure since last\r\n");
|
||||
return FS_ERR_FAILURE_SINCE_LAST;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NRF_LOG_INFO("After wait!\r\n");
|
||||
return FS_SUCCESS;
|
||||
}
|
||||
@@ -5,8 +5,8 @@ GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
|
||||
RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x6018
|
||||
FLASH (rx) : ORIGIN = 0x1B000, LENGTH = 0x25000
|
||||
RAM (rwx) : ORIGIN = 0x20001FF8, LENGTH = 0x2008
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
||||
@@ -3072,7 +3072,7 @@
|
||||
|
||||
|
||||
#ifndef CRC32_ENABLED
|
||||
#define CRC32_ENABLED 0
|
||||
#define CRC32_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <q> ECC_ENABLED - ecc - Elliptic Curve Cryptography Library
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
#include "nrf_bootloader_info.h"
|
||||
#include "nrf_svci_async_function.h"
|
||||
#include "nrf_pwr_mgmt.h"
|
||||
#include "peer_manager.h"
|
||||
#include "gatts_cache_manager.h"
|
||||
#include "peer_id.h"
|
||||
//#include "peer_manager.h"
|
||||
//#include "gatts_cache_manager.h"
|
||||
//#include "peer_id.h"
|
||||
|
||||
#define MAX_CTRL_POINT_RESP_PARAM_LEN 3 /**< Max length of the responses. */
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ GROUP(-lgcc -lc -lnosys)
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x19000, LENGTH = 0x17000
|
||||
RAM (rwx) : ORIGIN = 0x200022c8, LENGTH = 0x3d38
|
||||
RAM (rwx) : ORIGIN = 0x200022d8, LENGTH = 0x3d28
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
||||
@@ -10090,7 +10090,7 @@
|
||||
|
||||
// <o> NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs.
|
||||
#ifndef NRF_SDH_BLE_VS_UUID_COUNT
|
||||
#define NRF_SDH_BLE_VS_UUID_COUNT 1
|
||||
#define NRF_SDH_BLE_VS_UUID_COUNT 2
|
||||
#endif
|
||||
|
||||
// <q> NRF_SDH_BLE_SERVICE_CHANGED - Include the Service Changed characteristic in the Attribute Table.
|
||||
|
||||
113
main.c
113
main.c
@@ -20,11 +20,13 @@
|
||||
#include "ble_advdata.h"
|
||||
#include "ble_advertising.h"
|
||||
#include "ble_conn_params.h"
|
||||
#include "ble_dfu.h"
|
||||
#if defined(S112)
|
||||
#include "nrf_sdh.h"
|
||||
#include "nrf_sdh_soc.h"
|
||||
#include "nrf_sdh_ble.h"
|
||||
#include "nrf_ble_gatt.h"
|
||||
#include "nrf_bootloader_info.h"
|
||||
#else
|
||||
#include "fstorage.h"
|
||||
#include "softdevice_handler.h"
|
||||
@@ -83,6 +85,8 @@
|
||||
#if defined(S112)
|
||||
NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */
|
||||
BLE_ADVERTISING_DEF(m_advertising); /**< Advertising module instance. */
|
||||
#else
|
||||
static ble_dfu_t m_dfus; /**< Structure used to identify the DFU service. */
|
||||
#endif
|
||||
static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */
|
||||
static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_EPD_SVC, \
|
||||
@@ -108,6 +112,97 @@ void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
|
||||
app_error_handler(DEAD_BEEF, line_num, p_file_name);
|
||||
}
|
||||
|
||||
#if defined(S112)
|
||||
static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context)
|
||||
{
|
||||
if (state == NRF_SDH_EVT_STATE_DISABLED)
|
||||
{
|
||||
// Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
|
||||
nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);
|
||||
|
||||
//Go to system off.
|
||||
nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
|
||||
}
|
||||
}
|
||||
|
||||
/* nrf_sdh state observer. */
|
||||
NRF_SDH_STATE_OBSERVER(m_buttonless_dfu_state_obs, 0) =
|
||||
{
|
||||
.handler = buttonless_dfu_sdh_state_observer,
|
||||
};
|
||||
|
||||
static void advertising_config_get(ble_adv_modes_config_t * p_config)
|
||||
{
|
||||
memset(p_config, 0, sizeof(ble_adv_modes_config_t));
|
||||
|
||||
p_config->ble_adv_fast_enabled = true;
|
||||
p_config->ble_adv_fast_interval = APP_ADV_INTERVAL;
|
||||
p_config->ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS * 100;
|
||||
}
|
||||
|
||||
static void ble_dfu_evt_handler(ble_dfu_buttonless_evt_type_t event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE:
|
||||
{
|
||||
NRF_LOG_INFO("Device is preparing to enter bootloader mode.");
|
||||
|
||||
// Prevent device from advertising on disconnect.
|
||||
ble_adv_modes_config_t config;
|
||||
advertising_config_get(&config);
|
||||
config.ble_adv_on_disconnect_disabled = true;
|
||||
ble_advertising_modes_config_set(&m_advertising, &config);
|
||||
|
||||
// Disconnect all other bonded devices that currently are connected.
|
||||
// This is required to receive a service changed indication
|
||||
// on bootup after a successful (or aborted) Device Firmware Update.
|
||||
APP_ERROR_CHECK(sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION));
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_DFU_EVT_BOOTLOADER_ENTER:
|
||||
NRF_LOG_INFO("Device will enter bootloader mode.");
|
||||
break;
|
||||
|
||||
case BLE_DFU_EVT_BOOTLOADER_ENTER_FAILED:
|
||||
NRF_LOG_ERROR("Request to enter bootloader mode failed asynchroneously.");
|
||||
APP_ERROR_CHECK(false);
|
||||
break;
|
||||
|
||||
case BLE_DFU_EVT_RESPONSE_SEND_ERROR:
|
||||
NRF_LOG_ERROR("Request to send a response to client failed.");
|
||||
APP_ERROR_CHECK(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
NRF_LOG_ERROR("Unknown event from ble_dfu_buttonless.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void ble_dfu_evt_handler(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
|
||||
{
|
||||
switch (p_evt->type)
|
||||
{
|
||||
case BLE_DFU_EVT_INDICATION_DISABLED:
|
||||
NRF_LOG_INFO("Indication for BLE_DFU is disabled\r\n");
|
||||
break;
|
||||
|
||||
case BLE_DFU_EVT_INDICATION_ENABLED:
|
||||
NRF_LOG_INFO("Indication for BLE_DFU is enabled\r\n");
|
||||
break;
|
||||
|
||||
case BLE_DFU_EVT_ENTERING_BOOTLOADER:
|
||||
NRF_LOG_INFO("Device is entering bootloader mode!\r\n");
|
||||
break;
|
||||
default:
|
||||
NRF_LOG_INFO("Unknown event from ble_dfu\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void clock_timer_timeout_handler(void * p_context)
|
||||
{
|
||||
UNUSED_PARAMETER(p_context);
|
||||
@@ -166,8 +261,23 @@ void sleep_mode_enter(void)
|
||||
*/
|
||||
static void services_init(void)
|
||||
{
|
||||
// Initialize EPD Service.
|
||||
memset(&m_epd, 0, sizeof(ble_epd_t));
|
||||
APP_ERROR_CHECK(ble_epd_init(&m_epd));
|
||||
|
||||
#if defined(S112)
|
||||
ble_dfu_buttonless_init_t dfus_init = {0};
|
||||
dfus_init.evt_handler = ble_dfu_evt_handler;
|
||||
APP_ERROR_CHECK(ble_dfu_buttonless_init(&dfus_init));
|
||||
#else
|
||||
// Initialize the Device Firmware Update Service.
|
||||
ble_dfu_init_t dfus_init;
|
||||
memset(&dfus_init, 0, sizeof(dfus_init));
|
||||
dfus_init.evt_handler = ble_dfu_evt_handler;
|
||||
dfus_init.ctrl_point_security_req_write_perm = SEC_SIGNED;
|
||||
dfus_init.ctrl_point_security_req_cccd_write_perm = SEC_SIGNED;
|
||||
APP_ERROR_CHECK(ble_dfu_init(&m_dfus, &dfus_init));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**@brief Function for the GAP initialization.
|
||||
@@ -407,6 +517,7 @@ static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
|
||||
ble_epd_on_ble_evt(&m_epd, p_ble_evt);
|
||||
on_ble_evt(p_ble_evt);
|
||||
ble_advertising_on_ble_evt(p_ble_evt);
|
||||
ble_dfu_on_ble_evt(&m_dfus, p_ble_evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -459,6 +570,7 @@ static void ble_stack_init(void)
|
||||
APP_ERROR_CHECK(softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
|
||||
PERIPHERAL_LINK_COUNT,
|
||||
&ble_enable_params));
|
||||
ble_enable_params.common_enable_params.vs_uuid_count = 2;
|
||||
|
||||
// Check the ram settings against the used number of links
|
||||
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
|
||||
@@ -618,6 +730,7 @@ int main(void)
|
||||
gap_params_init();
|
||||
#if defined(S112)
|
||||
gatt_init();
|
||||
ble_dfu_buttonless_async_svci_init();
|
||||
#else
|
||||
ble_options_set();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user