mirror of https://github.com/wolfSSL/wolfBoot.git
Peer review fixes. Added new WOLFBOOT_RESTORE_CLOCK option
parent
3a85a27fb9
commit
ecf1cb8a92
2
arch.mk
2
arch.mk
|
|
@ -267,7 +267,7 @@ ifeq ($(ARCH),ARM)
|
|||
endif
|
||||
|
||||
ifeq ($(TARGET),va416x0)
|
||||
CFLAGS+=-I$(WOLFBOOT_ROOT)/include/vorago/ \
|
||||
CFLAGS+=-I$(WOLFBOOT_ROOT)/hal/vorago/ \
|
||||
-I$(VORAGO_SDK_DIR)/common/drivers/hdr/ \
|
||||
-I$(VORAGO_SDK_DIR)/common/mcu/hdr/ \
|
||||
-I$(VORAGO_SDK_DIR)/common/utils/hdr/
|
||||
|
|
|
|||
|
|
@ -75,5 +75,5 @@ USE_HAL_SPI_FRAM=1
|
|||
#CFLAGS_EXTRA+=-DWOLFBOOT_EDAC_RAM_SCRUB=1000
|
||||
#CFLAGS_EXTRA+=-DWOLFBOOT_EDAC_ROM_SCRUB=125
|
||||
|
||||
# Optionally restore clock to heart-beat oscillator after boot
|
||||
#CFLAGS_EXTRA+=-DWOLFBOOT_RESTORE_CLOCK
|
||||
# Leave clock at 100MHz (to restore clock to heart beat oscillator use =1)
|
||||
WOLFBOOT_RESTORE_CLOCK?=0
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ the geometry of the flash sectors, and erase all the sectors in between.
|
|||
|
||||
This function is called by the bootloader at a very late stage, before chain-loading the firmware
|
||||
in the next stage. This can be used to revert all the changes made to the clock settings, to ensure
|
||||
that the state of the microcontroller is restored to its original settings.
|
||||
that the state of the microcontroller is restored to its original settings. By default most targets will restore the
|
||||
clock settings. Use the `WOLFBOOT_RESTORE_CLOCK=0` option to disable clock restoration.
|
||||
|
||||
### Optional support for external flash memory
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
TASKS_HFCLKSTOP = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* TARGET_nrf52 */
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifndef TZEN
|
||||
#if !defined(TZEN) && defined(WOLFBOOT_RESTORE_CLOCK)
|
||||
pic32_clock_reset();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,5 +104,7 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
pic32_clock_reset();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ void RAMFUNCTION hal_flash_dualbank_swap(void)
|
|||
|
||||
void RAMFUNCTION hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
/* Reset clock controller */
|
||||
GCLK_CTRLA |= CTRLA_SWRST;
|
||||
|
||||
|
|
@ -332,6 +333,7 @@ void RAMFUNCTION hal_prepare_boot(void)
|
|||
|
||||
/* Clear PLL options */
|
||||
OSCCTRL_DPLL0CTRLB = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __WOLFBOOT */
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
/* Reset NVM wait states */
|
||||
APBBMASK_REG |= APBBMASK_NVM_EN;
|
||||
NVMCTRLB_REG &= ~((WAITSTATES & 0x0f) << 1);
|
||||
|
|
@ -152,6 +153,7 @@ void hal_prepare_boot(void)
|
|||
/* Reset clock controller */
|
||||
GCLK_CTRL = GCLK_CTRL_RESET;
|
||||
GCLK_WAITBUSY();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -301,7 +301,9 @@ void RAMFUNCTION hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
#ifdef FLASH_SECURABLE_MEMORY_SUPPORT
|
||||
do_secure_boot();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -330,5 +330,7 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,8 @@ void hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -423,8 +423,9 @@ void RAMFUNCTION hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
void RAMFUNCTION hal_erase_bank2(void)
|
||||
|
|
|
|||
|
|
@ -333,7 +333,9 @@ void RAMFUNCTION hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
#ifdef FLASH_SECURABLE_MEMORY_SUPPORT
|
||||
do_secure_boot();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -608,7 +608,9 @@ void hal_prepare_boot(void)
|
|||
#if (TZ_SECURE())
|
||||
periph_unsecure();
|
||||
#else
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -510,7 +510,9 @@ void hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FLASH_OTP_KEYSTORE
|
||||
|
|
|
|||
|
|
@ -262,8 +262,10 @@ void hal_prepare_boot(void)
|
|||
spi_flash_release();
|
||||
#endif
|
||||
hal_flash_lock();
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
if ((FLASH_PECR & FLASH_PECR_PELOCK) == 0)
|
||||
FLASH_PECR |= FLASH_PECR_PELOCK;
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,8 +279,9 @@ void hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This value is unused, the function is never called
|
||||
|
|
|
|||
|
|
@ -409,7 +409,9 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
|
||||
periph_unsecure();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -520,8 +520,9 @@ void hal_init(void)
|
|||
|
||||
void hal_prepare_boot(void)
|
||||
{
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
|
||||
#endif
|
||||
#if TZ_SECURE()
|
||||
led_unsecure();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -325,7 +325,9 @@ void hal_prepare_boot(void)
|
|||
#ifdef SPI_FLASH
|
||||
spi_flash_release();
|
||||
#endif
|
||||
#ifdef WOLFBOOT_RESTORE_CLOCK
|
||||
clock_pll_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_STM32_PKA
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
_Min_Heap_Size = 0x00000200; /* required amount of heap */
|
||||
# no heap
|
||||
_Min_Stack_Size = 0x00006000; /* required amount of stack */
|
||||
|
||||
/* Memory areas */
|
||||
|
|
@ -140,14 +140,12 @@ SECTIONS
|
|||
*(dma_blk)
|
||||
} >RAM1
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
._user_heap_stack :
|
||||
/* User_stack section, used to check that there is enough RAM left */
|
||||
._user_stack :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
PROVIDE ( _start_heap = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( END_STACK = . );
|
||||
|
|
|
|||
|
|
@ -1040,3 +1040,8 @@ endif
|
|||
ifneq ($(WOLFBOOT_PARTITION_FILENAME),)
|
||||
CFLAGS += -DWOLFBOOT_PARTITION_FILENAME=$(WOLFBOOT_PARTITION_FILENAME)
|
||||
endif
|
||||
|
||||
# Clock Restore Option (default on)
|
||||
ifneq ($(WOLFBOOT_RESTORE_CLOCK),0)
|
||||
CFLAGS += -DWOLFBOOT_RESTORE_CLOCK
|
||||
endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue