cc2538: Word-align .data LMA
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>
This commit is contained in:
parent
0d260f61a0
commit
0de729572b
@ -85,7 +85,7 @@ SECTIONS
|
||||
*(.udma_channel_control_table)
|
||||
} > SRAM
|
||||
|
||||
.data :
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data = .;
|
||||
*(.data*)
|
||||
|
Loading…
Reference in New Issue
Block a user