I am working with PPC microcontroller (e200z4 specifically) using GCC based compiler. The PPC EABI support small data allocation if we define a variable whose size less than defined number (my case is 8). I understand that:
What I dont know is that the significance of sbss2 and sdata2, by reading the PPC EABI specification? Will they be small variables on RAM or Flash and if they are difference from sdata and sbss?
From the EABI
External variables that are scalars of 8 or fewer bytes, whose values might be changed by the program, and whose values will not be changed outside of the program, shall be accessed as .sdata or .sbss entries...
When the object file is not to be part of a shared object file, external variables that are scalars of 8 or fewer bytes, whose values cannot be changed by the program, and whose values will not be changed outside of the program, shall be accessed as .sdata2 or .sbss2 entries...
The special section .sdata2 is intended to hold initialized read-only small data that contribute to the program memory image. The section can, however, be used to hold writable data. The special section .sbss2 is intended to hold writable small data that contribute to the program memory image and whose initial values are 0.
My previous e200 projects were setup like that:
ROM
+----------+
| |
| .text | code
| |
- +----------+
^ | |
| | .sdata2 | constant small initialized data (max 32k)
| | |
max 64k +----------+ <~~ _SDA2_BASE_ (r2)
| | |
| | .sbss2 | constant small not (or zero) initialized data (max 32k)
v | | ALWAYS EMPTY!
- +----------+
RAM
+----------+
| |
| .data | normal initialized data
| |
- +----------+
^ | |
| | .sdata | normal small initialized data (max 32k)
| | |
max 64k +----------+ <~~ _SDA_BASE_ (r13)
| | |
| | .sbss | normal small not (or zero) initialized data (max 32k)
v | |
- +----------+
| |
| .bss | normal not (or zero) initialized data
| |
+----------+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With