Zephyr linker command edit?

I'm new to Zephyr and have inherited a project that uses the stm32 h747 disco board. The last build shows: 

Memory region         Used Size  Region Size  %age Used

           FLASH:      363268 B         1 MB     34.64%

             RAM:      441160 B       512 KB     84.14%

          EXTMEM:          0 GB       256 MB      0.00%

           SRAM1:          0 GB       128 KB      0.00%

           SRAM2:          0 GB       128 KB      0.00%

           SRAM3:         16 KB        32 KB     50.00%

           SRAM4:         48 KB        64 KB     75.00%

          SDRAM2:       3000 KB        32 MB      9.16%

        IDT_LIST:          0 GB        32 KB      0.00%

Since RAM is approaching its limit, I would like to move the data in some specific source files to SRAM1 or SRAM2.

So, I modified the source code to move some large buffers to SRAM1 by using the __attribute__ to assign the buffers to SRAM1. After which, the build result is:

Memory region         Used Size  Region Size  %age Used

           FLASH:      363268 B         1 MB     34.64%

             RAM:      441160 B       512 KB     84.14%

          EXTMEM:          0 GB       256 MB      0.00%

           SRAM1:          128KB    128 KB      100.00%

           SRAM2:          0 GB       128 KB      0.00%

           SRAM3:         16 KB        32 KB     50.00%

           SRAM4:         48 KB        64 KB     75.00%

          SDRAM2:       3000 KB        32 MB      9.16%

        IDT_LIST:          0 GB        32 KB      0.00%

I was very surprised to see that although the buffers now occupy 100% of SRAM1, the RAM usage did not decrease from the prior 84%.  I did an objdump and it appears that the buffers are also in the bss section, which is I think perhaps why the 84% did not decrease.

However, I do not know how to tell the compiler/linker that the buffers do not need to be initialized.

I suspect that I need to modify the linker command to do this, but it appears that the west build process auto-generates the linker script command. I don't know which file(s) I need to modify to remove the buffers from bss section.  Is the auto-generated linker script dependent on the source code? 

I *think* that what I need is for the resulting linker.cmd file to add a new section like

xy_stm32 (NOLOAD) : ALIGN_WITH_INPUT

{

. = ABSOLUTE(sram1-starting-address);

*(.variable_x) . = ABSOLUTE(starting-address) + size-of-x;

*(.variable_y) . = ABSOLUTE(starting-addresss) + size-of-y;

} > "SRAM1" AT > "SRAM1"

Is this correct?

How do I make the auto-gen liinker.cmd file add this? (if correct) And is this how to preclude the buffers from being in the bss section?

Parents Reply Children
No Data
Related