Migrating from armcc to armclang causes section type conflict

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:

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.

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.

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:

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?

Parents
  • Hi,

    What if you explicitly initialise all the variables in XRAM_DATA? For example 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 

Reply
  • Hi,

    What if you explicitly initialise all the variables in XRAM_DATA? For example 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 

Children
No data
More questions in this forum