Skip to content
Snippets Groups Projects
Verified Commit 1067d234 authored by rahix's avatar rahix
Browse files

fix(l0dables): Fix vector table alignment

The vector table's alignment requirements depend on the number of
interrupts [1].  In our case, we have 0x6E(=110) interrupts and thus an
alignment requirement of 0x80(=128).

To satisfy this requirement, this commit moves the IVT to the beginning
of .text and enforces a 128 byte alignment.  Please note that the
headers which come before .text will push the IVT to 0x100 instead of
having it directly in the beginning at 0x00.

[1]: https://developer.arm.com/docs/dui0553/a/cortex-m4-peripherals/system-control-block/vector-table-offset-register



Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 69775a15
No related branches found
No related tags found
No related merge requests found
......@@ -18,10 +18,10 @@
*
* All of the following (apart from Reset_Handler, which calls main())
* are backed by weak referenced symbols, which you can override just
* by defining them in C code.
* by defining them in C code.
*/
.section .data
.align 2
.section .text.isr_vector
.align 7
.globl __isr_vector
__isr_vector:
.long 0 /* Top of Stack, overriden by l0der at load time */
......
......@@ -33,6 +33,9 @@ SECTIONS {
.text :
{
/* The vector table needs 128 byte alignment */
. = ALIGN(128);
KEEP(*(.text.isr_vector))
*(.text*)
*(.rodata*)
......
......@@ -3,7 +3,7 @@ l0dable_startup_lib = static_library(
'crt.s',
'hardware.c',
dependencies: [api_caller],
pic: true,
c_args: ['-fpie'],
)
l0dable_startup = declare_dependency(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment