uf2 does not depend on softdevice

This commit is contained in:
hathach
2018-08-11 11:43:57 +07:00
parent b1f3772364
commit e946aabd6d
2 changed files with 35 additions and 16 deletions

View File

@ -182,14 +182,26 @@ bool bootloader_app_is_valid(uint32_t app_addr)
static void bootloader_settings_save(bootloader_settings_t * p_settings)
{
uint8_t sd_en = false;
sd_softdevice_is_enabled(&sd_en);
if ( sd_en )
{
uint32_t err_code = pstorage_clear(&m_bootsettings_handle, sizeof(bootloader_settings_t));
APP_ERROR_CHECK(err_code);
err_code = pstorage_store(&m_bootsettings_handle,
(uint8_t *)p_settings,
(uint8_t *) p_settings,
sizeof(bootloader_settings_t),
0);
APP_ERROR_CHECK(err_code);
}
else
{
flash_write(BOOTLOADER_SETTINGS_ADDRESS, p_settings, sizeof(bootloader_settings_t));
flash_flush();
m_update_status = BOOTLOADER_COMPLETE;
}
}
@ -373,13 +385,11 @@ void bootloader_app_start(uint32_t app_addr)
{
// If the applications CRC has been checked and passed, the magic number will be written and we
// can start the application safely.
uint32_t err_code = sd_softdevice_disable();
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK ( sd_softdevice_disable() );
interrupts_disable();
err_code = sd_softdevice_vector_table_base_set(CODE_REGION_1_START);
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK( sd_softdevice_vector_table_base_set(CODE_REGION_1_START) );
bootloader_util_app_start(CODE_REGION_1_START);
}