mirror of https://github.com/wolfSSL/wolfBoot.git
Added DISABLE_BACKUP option
parent
f6252917d4
commit
b0fbafe014
|
@ -120,6 +120,15 @@ stage, or on these platform that do not support interrupt vector relocation.
|
|||
To disable interrupt vector table relocation, compile with `VTOR=0`. By default, wolfBoot will relocate the
|
||||
interrupt vector by setting the offset in the vector relocation offset register (VTOR).
|
||||
|
||||
### Disable Backup of current running firmware
|
||||
|
||||
Optionally, it is possible to disable the backup copy of the current running firmware upon the installation of the
|
||||
update. This implies that no fall-back mechanism is protecting the target from a faulty firmware installation, but may be useful
|
||||
in some cases where it is not possible to write on the update partition from the bootloader.
|
||||
The associated compile-time option is
|
||||
|
||||
`DISABLE_BACKUP=1`
|
||||
|
||||
### Enable workaround for 'write once' flash memories
|
||||
|
||||
On some microcontrollers, the internal flash memory does not allow subsequent writes (adding zeroes) to a
|
||||
|
|
|
@ -138,6 +138,9 @@ ifeq ($(NVM_FLASH_WRITEONCE),1)
|
|||
CFLAGS+= -DNVM_FLASH_WRITEONCE
|
||||
endif
|
||||
|
||||
ifeq ($(DISABLE_BACKUP),1)
|
||||
CFLAGS+= -DDISABLE_BACKUP
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
|
|
25
src/loader.c
25
src/loader.c
|
@ -119,6 +119,8 @@ static int wolfBoot_update(int fallback_allowed)
|
|||
ext_flash_unlock();
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DISABLE_BACKUP
|
||||
/* Interruptible swap
|
||||
* The status is saved in the sector flags of the update partition.
|
||||
* If something goes wrong, the operation will be resumed upon reboot.
|
||||
|
@ -158,6 +160,29 @@ static int wolfBoot_update(int fallback_allowed)
|
|||
wb_flash_erase(&swap, 0, WOLFBOOT_SECTOR_SIZE);
|
||||
st = IMG_STATE_TESTING;
|
||||
wolfBoot_set_partition_state(PART_BOOT, st);
|
||||
|
||||
#else /* DISABLE_BACKUP */
|
||||
#warning "Backup mechanism disabled! Update installation will not be interruptible"
|
||||
/* Directly copy the content of the UPDATE partition into the BOOT partition.
|
||||
* This mechanism is not fail-safe, and will brick your device if interrupted
|
||||
* before the copy is finished.
|
||||
*/
|
||||
while ((sector * sector_size) < total_size) {
|
||||
if ((wolfBoot_get_sector_flag(PART_UPDATE, sector, &flag) != 0) || (flag == SECT_FLAG_NEW)) {
|
||||
flag = SECT_FLAG_SWAPPING;
|
||||
wolfBoot_copy_sector(&update, &boot, sector);
|
||||
if (((sector + 1) * sector_size) < WOLFBOOT_PARTITION_SIZE)
|
||||
wolfBoot_set_sector_flag(PART_UPDATE, sector, flag);
|
||||
}
|
||||
}
|
||||
while((sector * sector_size) < WOLFBOOT_PARTITION_SIZE) {
|
||||
wb_flash_erase(&boot, sector * sector_size, sector_size);
|
||||
sector++;
|
||||
}
|
||||
st = IMG_STATE_SUCCESS;
|
||||
wolfBoot_set_partition_state(PART_BOOT, st);
|
||||
#endif
|
||||
|
||||
#ifdef EXT_FLASH
|
||||
ext_flash_lock();
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@ ifeq ($(ARCH),)
|
|||
UART_FLASH?=0
|
||||
ALLOW_DOWNGRADE?=0
|
||||
NVM_FLASH_WRITEONCE?=0
|
||||
DISABLE_BACKUP?=0
|
||||
WOLFBOOT_VERSION?=0
|
||||
V?=0
|
||||
NO_MPU?=0
|
||||
|
@ -50,7 +51,7 @@ endif
|
|||
CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO_DRIVERS \
|
||||
MCUXPRESSO_CMSIS FREEDOM_E_SDK STM32CUBE CYPRESS_PDL CYPRESS_CORE_LIB CYPRESS_TARGET_LIB DEBUG VTOR \
|
||||
CORTEX_M0 NO_ASM EXT_FLASH SPI_FLASH NO_XIP UART_FLASH ALLOW_DOWNGRADE NVM_FLASH_WRITEONCE \
|
||||
WOLFBOOT_VERSION V NO_MPU ENCRYPT FLAGS_HOME \
|
||||
DISABLE_BACKUP WOLFBOOT_VERSION V NO_MPU ENCRYPT FLAGS_HOME \
|
||||
SPMATH RAM_CODE DUALBANK_SWAP IMAGE_HEADER_SIZE PKA PSOC6_CRYPTO WOLFTPM \
|
||||
WOLFBOOT_PARTITION_SIZE WOLFBOOT_SECTOR_SIZE \
|
||||
WOLFBOOT_PARTITION_BOOT_ADDRESS WOLFBOOT_PARTITION_UPDATE_ADDRESS \
|
||||
|
|
Loading…
Reference in New Issue