micropython/ports/stm32/mboot/stm32_memory.ld
Damien George 771c16f3d9 stm32/mboot: Make all mboot sectors erase/write protected.
Prior to this commit, only sector 0 was erase/write protected, which may
not be enough to protect all of mboot (especially if mboot lives at a
higher address than the start of flash).

This commit makes sure all internal flash sectors that mboot lives in are
protected from erasing and writing.  The linker script must define
_mboot_writable_flash_start for this to work.

Signed-off-by: Damien George <damien@micropython.org>
2022-11-30 17:19:36 +11:00

15 lines
428 B
Plaintext

/*
Linker script fragment for mboot on an STM32xxx MCU.
This defines the memory sections for the bootloader to use.
*/
MEMORY
{
FLASH_BL (rx) : ORIGIN = 0x08000000, LENGTH = 32K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 120K
}
/* Location from which mboot is allowed to write to flash.
Must be the start of a flash erase sector. */
_mboot_writable_flash_start = ORIGIN(FLASH_BL) + LENGTH(FLASH_BL);