Skip to content

Commit 6adf981

Browse files
committed
read back full app size for simplicity
1 parent 6094737 commit 6adf981

File tree

3 files changed

+3
-41
lines changed

3 files changed

+3
-41
lines changed

lib/sdk11/components/libraries/bootloader_dfu/bootloader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void bootloader_dfu_update_process(dfu_update_status_t update_status)
196196
{
197197
settings.bank_0_crc = update_status.app_crc;
198198
settings.bank_0_size = update_status.app_size;
199-
settings.bank_0 = (update_status.app_size ? BANK_VALID_APP : BANK_INVALID_APP);
199+
settings.bank_0 = BANK_VALID_APP;
200200
settings.bank_1 = BANK_INVALID_APP;
201201

202202
m_update_status = BOOTLOADER_SETTINGS_SAVING;

src/usb/msc_uf2.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,25 +184,6 @@ void tud_msc_write10_complete_cb(uint8_t lun)
184184
{
185185
// update App
186186
update_status.status_code = DFU_UPDATE_APP_COMPLETE;
187-
update_status.app_crc = 0; // skip CRC checking with uf2 upgrade
188-
update_status.app_size = _wr_state.numBlocks*256;
189-
190-
if ( _wr_state.has_sd && is_sd_existed() )
191-
{
192-
/* Since the Bootloader Setting still needs to know the SD and App size separately
193-
* to stay compatible with DFU CDC interface. We re-calculate it based on written
194-
* address and its contents ( SD_MAGIC matches )
195-
*/
196-
update_status.app_size -= (SD_SIZE_GET(MBR_SIZE) - MBR_SIZE);
197-
}
198-
199-
if ( _wr_state.has_mbr )
200-
{
201-
// MBR write isn't counted app size as well
202-
update_status.app_size -= MBR_SIZE;
203-
}
204-
205-
PRINT_INT(update_status.app_size);
206187
}
207188

208189
bootloader_dfu_update_process(update_status);

src/usb/uf2/ghostfat.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,8 @@ static uint32_t current_flash_size(void)
183183
flash_sz = 256;
184184
}else
185185
{
186-
bootloader_settings_t const * boot_setting;
187-
bootloader_util_settings_get(&boot_setting);
188-
189-
flash_sz = boot_setting->bank_0_size;
190-
191-
// Include SoftDevice (excluding MBR) for current.uf2
192-
if ( is_sd_existed() ) flash_sz += (SD_SIZE_GET(MBR_SIZE) - MBR_SIZE);
193-
194-
// Copy size must be multiple of 256 bytes
195-
// else we will got an issue copying current.uf2
196-
if (flash_sz & 0xff)
197-
{
198-
flash_sz = (flash_sz & ~0xff) + 256;
199-
}
200-
201-
// if bank0 size is not valid, happens when flashed with jlink
202-
// use maximum application size
203-
if ( (flash_sz == 0) || (flash_sz == 0xFFFFFFFFUL) )
204-
{
205-
flash_sz = (USER_FLASH_END-USER_FLASH_START);
206-
}
186+
// Use full application size for simplicity
187+
flash_sz = (USER_FLASH_END-USER_FLASH_START);
207188
}
208189

209190
return flash_sz;

0 commit comments

Comments
 (0)