Commit 988562e
committed
riscv: Fix initialized data
Startup script has only one loop that copies initialized data and
code that should execute from RAM.
It implies that variables in .data .ram_text .srodata .sdata and such
has same layout in flash and in RAM.
Those data are packed by default in flash so output sections
(.data .srodata .sdata) if they start with something that requires
alignment change may end up with wrong data being copied to
statically initialized data.
One way to prevent such case is to copy each output section in separate
loop. But it is also possibly to add output section attribute ALIGN_WITH_INPUT
and then linker will fill necessary space in flash image.1 parent 532a643 commit 988562e
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
0 commit comments