0de729572b
In order to be fast, the reset_handler() function uses word accesses to initialize the .data output section. However, most toolchains do not automatically force the alignment of an output section LMA to use the maximum alignment of all its input sections. Because of that, assuming that .data contains some words, the LMA of the .data output section was not word-aligned in some cases, resulting in an initialization performed using slow unaligned word accesses. This commit forces the alignment of the LMA of the .data output section with a word boundary in order to always use fast aligned word accesses to read the .data load area. Note that this solution is better than using ALIGN_WITH_INPUT, both because the latter is a new feature incompatible with older toolchains, and because it could create a big gap between _etext and the LMA of .data if strongly-aligned data were added to .data, although only a word alignment is required here. The same considerations apply to the VMA of .data. However, it is already automatically word-aligned, both because .data contains words, and because the end VMA of the previous output section (.socdata) is word-aligned. Moreover, if the VMA of .data were forcibly word-aligned, then a filled gap could appear at the beginning of this section if strongly-aligned data were added to it, thus wasting flash memory. Consequently, it's better not to change anything for the VMA of .data, all the more it's very unlikely that it does not contain any word and that the end VMA of .socdata becomes non-word-aligned, and this would only result in a slower initialization. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com> |
||
---|---|---|
.. | ||
dev | ||
usb | ||
cc2538.lds | ||
clock.c | ||
cpu.c | ||
cpu.h | ||
dbg.c | ||
dbg.h | ||
debug-uart.h | ||
ieee-addr.c | ||
ieee-addr.h | ||
lpm.c | ||
lpm.h | ||
Makefile.cc2538 | ||
mtarch.h | ||
reg.h | ||
rtimer-arch.c | ||
rtimer-arch.h | ||
slip-arch.c | ||
spi-arch.h | ||
startup-gcc.c |