- Notifications
You must be signed in to change notification settings - Fork1k
Commit57cdf76
Support a .noinit section for variables
This is inspired by the linker sripts on the AVR architecture, whichsupport a .noinit section (or any section starting with .noinit,actually) for variables that should be allocated an address in RAM, butnot be initialized to any particular value (not even zero) on startup.These can then be used to remember values across resets.From the sketch perspective, this works exactly the same as on AVR: Justannote a global variable with `__attribute__((__section__(".noinit")))`and it will have an unpredictable value on power-up and retain its valueduring resets.To implement this without having to change all board-specific linkerscripts, the linker commandline is changed to pass the board-specificlinker script to the `--default-script` linker script, and change themain linker script (passed to `--script`, previously `-T`) to a generic"override" linker script. This new generic linker script contains an`INSERT BEFORE` command, which causes the linker to load it *in additionto* the default linker script, while adding an extra `.noinit` outputsection in the right place.Because these new variables take up RAM but have their own section inthe .elf file, they should be accounted for in the size summary aftercompilation. This is done by adapting the `recipe.size.regex.data` entryto include this new section.1 parent6889728 commit57cdf76
2 files changed
+46
-2
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 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments
Comments
(0)