-
Type:
Bug
-
Resolution: Fixed
-
Priority:
High
-
Code Generation Tools
-
CODEGEN-15667
-
-
-
default
The attached source file defines two global variables in a user named section ...
uint8_t VRM_StatusForUDS __attribute__((section(".porstram")));
uint8_t VRM_StatusForUDS1 __attribute__((section(".porstram")));
Build it ...
% tiarmclang @options.txt -save-temps -c file.c
Search the compiler generated assembly for the section name ...
% findstr porstram file.s
.section .porstram,"aw",%progbits
The %progbits syntax means the section is initialized.
The section is expected to contain uninitialized variables and is typically allocated to RAM. Most embedded systems require that initialized sections be allocated to flash, and never RAM.
This happens as part of a compiler optimization called merging of global variables.
A workaround is to disable the optimization with the compiler option -mno-global-merge.