misc: Allow flash image size to be constrained
The CONFIG_FLASH_LOAD_OFFSET allows the zephyr image to be placed at an offset from the start of flash. This is useful for situations, such as with a bootloader, to allow the image to not occupy the very beginning of flash. Complement this by adding a CONFIG_FLASH_LOAD_SIZE config, that can constrain the size of the flash image. With the default of zero, the behavior is as before, with the image allowed to occupy the rest of the flash. It can also be defined to a non-zero value which will constrain the image to occupy that many bytes of flash. Although this is defined generally, it is currently only supported on cortex-m targets. Change-Id: I6e4a0e79c8459f931cd4757c932d20dac740f5f6 Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
parent
0c476a58b7
commit
fe7aa3f4fa
2 changed files with 19 additions and 2 deletions
|
@ -41,7 +41,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET)
|
#define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET)
|
||||||
#define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET)
|
#if CONFIG_FLASH_LOAD_SIZE > 0
|
||||||
|
#define ROM_SIZE CONFIG_FLASH_LOAD_SIZE
|
||||||
|
#else
|
||||||
|
#define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_XIP)
|
#if defined(CONFIG_XIP)
|
||||||
#if defined(CONFIG_IS_BOOTLOADER)
|
#if defined(CONFIG_IS_BOOTLOADER)
|
||||||
|
|
15
misc/Kconfig
15
misc/Kconfig
|
@ -12,7 +12,8 @@ menu "Linker Options"
|
||||||
config HAS_FLASH_LOAD_OFFSET
|
config HAS_FLASH_LOAD_OFFSET
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
This option is selected by targets having a FLASH_LOAD_OFFSET.
|
This option is selected by targets having a FLASH_LOAD_OFFSET
|
||||||
|
and FLASH_LOAD_SIZE.
|
||||||
|
|
||||||
config FLASH_LOAD_OFFSET
|
config FLASH_LOAD_OFFSET
|
||||||
hex "Kernel load offset"
|
hex "Kernel load offset"
|
||||||
|
@ -26,6 +27,18 @@ config FLASH_LOAD_OFFSET
|
||||||
|
|
||||||
If unsure, leave at the default value 0.
|
If unsure, leave at the default value 0.
|
||||||
|
|
||||||
|
config FLASH_LOAD_SIZE
|
||||||
|
hex "Kernel load size"
|
||||||
|
default 0
|
||||||
|
depends on HAS_FLASH_LOAD_OFFSET
|
||||||
|
help
|
||||||
|
If non-zero, this option specifies the size, in bytes, of the flash
|
||||||
|
area that the Zephyr image will be allowed to occupy. If zero, the
|
||||||
|
image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
|
||||||
|
the device.
|
||||||
|
|
||||||
|
If unsure, leave at the default value 0.
|
||||||
|
|
||||||
config TEXT_SECTION_OFFSET
|
config TEXT_SECTION_OFFSET
|
||||||
hex "TEXT section offset"
|
hex "TEXT section offset"
|
||||||
default 0
|
default 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue