[En-Nut-Discussion] branches/devnut_m3n: _vtable needs 512 Byte alignment
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sun Jul 17 15:49:21 CEST 2011
Hello,
_vtable in the linker script needs 512 Byte alignement
(from pm0056.pdf:)
4.4.4 Vector table offset register (SCB_VTOR)
Bits 31:30 Reserved, must be kept cleared
Bits 29:11 TBLOFF[29:9]: Vector table base offset field.
It contains bits [29:9] of the offset of the table
base from memory address 0x00000000. When
setting TBLOFF, you must align the offset to the
number of exception entries in the vector table.
The minimum alignment is 128 words. Table alignment
requirements mean that bits[8:0] of the
table offset are always zero.
For the original linker script one doesn't notice, as _vtable is the first
item in SRAM0. However if you want to run from SRAM, like with the linker
script modified like below, _vtable may get placed inappropriate.
To not waste RAM space however, probably best is to place the _vtable
definition first. The alignement directive should be changed however.
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: nut/arch/cm3/ldscripts/stm32f10x_flash.ld
===================================================================
--- nut/arch/cm3/ldscripts/stm32f10x_flash.ld (Revision 3518)
+++ nut/arch/cm3/ldscripts/stm32f10x_flash.ld (Arbeitskopie)
@@ -4,8 +4,6 @@
*
***********************************************************************************/
-PROVIDE (__heap_start = _sheap);
-
_ramend = ORIGIN(SRAM0) + LENGTH(SRAM0);
SECTIONS
@@ -23,11 +21,11 @@
*(.gcc_except_table)
. = ALIGN(4);
_etext = .;
- } > FLASH0
+ } > SRAM0
.vtable (NOLOAD):
{
- . = ALIGN(4);
+ . = ALIGN(512);
_vtable = .;
*(.vtable*)
. = ALIGN(4);
@@ -67,16 +65,9 @@
_pspstack_start = .;
KEEP(*(.psp_stack .psp_stack.*));
_pspstack_end = .;
- } > SRAM0
+ PROVIDE (__heap_start = .);
+ } > SRAM0
- .heap (NOLOAD):
- {
- . = ALIGN(4);
- _sheap = .;
- . = _ramend - .;
- _eheap = .;
- } > SRAM0
-
end = .;
/*
DISCARD :
More information about the En-Nut-Discussion
mailing list