arm: cortex-m: Implement CONFIG_TEXT_SECTION_OFFSET

On other targets, CONFIG_TEXT_SECTION_OFFSET allows the entire image to
be moved in memory to allow space for some type of header.  The Mynewt
project bootloader prepends a small header, and this config needs to be
supported for this to work.

The specific alignment requirements of the vector table are chip
specific, and generally will be a power of two larger than the size of
the vector table.

Change-Id: I631a42ff64fb8ab86bd177659f2eac5208527653
Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2016-12-12 11:44:50 -07:00 committed by Kumar Gala
commit dee8ef6f4f
2 changed files with 3 additions and 1 deletions

View file

@ -29,7 +29,8 @@ static inline void relocate_vector_table(void) { /* do nothing */ }
static inline void relocate_vector_table(void) static inline void relocate_vector_table(void)
{ {
/* vector table is located at the the beginning of the flash */ /* vector table is located at the the beginning of the flash */
_scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); _scs_relocate_vector_table((void *)(CONFIG_FLASH_BASE_ADDRESS +
CONFIG_TEXT_SECTION_OFFSET));
} }
#else #else
static inline void relocate_vector_table(void) static inline void relocate_vector_table(void)

View file

@ -72,6 +72,7 @@ SECTIONS
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,) SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
{ {
. = CONFIG_TEXT_SECTION_OFFSET;
KEEP(*(.exc_vector_table)) KEEP(*(.exc_vector_table))
KEEP(*(".exc_vector_table.*")) KEEP(*(".exc_vector_table.*"))