Loading...
 
Skip to main content

System Workbench for STM32


Incorrect binary size after compilation.

Post-build steps are default:
arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin" && arm-none-eabi-size "${BuildArtifactFileName}"

It looks like it is related with variable declarations
ETH_DMADescTypeDef DMARxDscrTabETH_RXBUFNB attribute((section(".RxDecripSection")));
I changed it to :
extern ETH_DMADescTypeDef DMARxDscrTabETH_RXBUFNB;
and in linker file I add
DMARxDscrTab = 0x20010000;
and now bin size is correct. When I debug app I can see that array DMARxDscrTab is on the right place (0x20010000).
Im not expert in linker files so not sure if this is correct way to do that.

There is a magic word in linker command file : NOLOAD

look here for more details :

https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_21.html

excerpt
(NOLOAD)
The `(NOLOAD)' directive will mark a section to not be loaded at run time. The linker will process the section normally, but will mark it so that a program loader will not load it into memory. For example, in the script sample below, the ROM section is addressed at memory location `0' and does not need to be loaded when the program is run. The contents of the ROM section will appear in the linker output file as usual.

SECTIONS {
ROM 0 (NOLOAD) : { ... }
...
}


 
Collapse/expand modules below