I am trying to migrate an existing project from armcc to armclang using Keil. Most of the new errors generated by simply switching the compiler have been easily cleaned up with help from their migration guides. But I cannot seem to fix the following error:
armcc
armclang
Display/icons.c(54): error: 'iconBitMapArray' causes a section type conflict with 'pNULL' XRAM_VAR GUI_CONST_STORAGE GUI_BITMAP *iconBitMapArray[] = // bitmaps for icons ^ Display/icons.c(44): note: declared here XRAM_VAR GUI_CONST_STORAGE GUI_BITMAP pNULL = // used for returning a pointer to a NULL image
Here is the relevant code:
#define XRAM_VAR __attribute__((section("XRAM_DATA"))) XRAM_VAR uint32_t icon_status_internal; XRAM_VAR GUI_CONST_STORAGE GUI_BITMAP pNULL = // used for returning a pointer to a NULL image { 0, /* XSize */ 0, /* YSize */ 0, /* BytesPerLine */ 0, /* BitsPerPixel */ 0, /* Pointer to picture data (indices) */ 0 /* Pointer to palette */ }; XRAM_VAR GUI_CONST_STORAGE GUI_BITMAP *iconBitMapArray[] = // bitmaps for icons { &pNULL, &bmIcon1, &bmIcon2, // ...etc. };
The variable icon_status_internal also causes the same error.
icon_status_internal
The error seems to come from trying to place zero initialized data into the same section as data that is initialized to non-zero values. The flag, -fno-zero-initialized-in-bss is mentioned a lot as a fix when searching. I tried adding that to the compiler string and the linker string but that did not help.
-fno-zero-initialized-in-bss
On page 8 of the migration guide, there are two possible solutions they suggest when using Link-Time Optimization (LTO). We are not using LTO but I tried them both anyways. I tried changing the memory assignment from default to our external RAM.
This also did not help. The other suggestion was to add the section name to the scatter file which was already there.
; Just the variables declared using __attribute__((section("XRAM_DATA"))) RW_XRAM1 0x70000000 0x00010000 { ; External Ram *.o(XRAM_DATA) }
When using armcc the variables are placed in a Data type section in the section labeled "XRAM_DATA" without any special compiler options as can be seen in the .map file:
Data
.map
pNULL 0x70000000 Data 20 icons.o(XRAM_DATA) icon_status_internal 0x70000014 Data 4 icons.o(XRAM_DATA) iconBitMapArray 0x70000018 Data 352 icons.o(XRAM_DATA)
How do I get all of these variables to be placed in a Data type section in my external RAM when using armclang like armcc did? Are there any other workarounds that I can try? Do I need to create seperate bss and data sections in my external RAM? What else can I try?
bss
data
Hi,
I'm Paul - Product Manager, Compilers. Good to see that most of your migration has gone fairly smoothly, sorry to hear you're stuck on this point! Let me discuss with a technical expert, we'll get back to you.
Paul.
Thanks Paul. Most of the issues are just due to inline assembly. But we're using CMSIS so migration is very easy.
However, we would like to store all of our bitmaps, including our "NULL" bitmap, in our external RAM. If I remove the XRAM_VAR section attribute definition, the error goes away. I'm still working on migrating the rest of the code so I can get a .map file and see where it is putting out pNULL bitmap.
NULL
XRAM_VAR
pNULL
Please let me know if there is anything else I can try. Thanks again.
What if you explicitly initialise all the variables in XRAM_DATA? For example XRAM_VAR uint32_t icon_status_internal = 0;
XRAM_DATA?
XRAM_VAR uint32_t icon_status_internal = 0;
I have been able to migrate all my projects from ARMCC to armclang, since AC 6.10.
Can you provide the .map of the XRAM_DATA too?
Regards,
Seng Tak
Did you ever figure this out? In the same situation myself
Hi embedded.kyle are you still looking for an answer to this question?