This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/AM3359: Warning about alignment of .bss on 16kb boundary

Part Number: AM3359

Tool/software: TI C/C++ Compiler

Hi,

I'm getting the following warning (ARM compiler 17.6.0 STS):

#10098-D specific address 0x402f0400 overrides alignment of 16384 for ".bss"

I want to put BSS into the SRAM area which starts at 0x402F0400, but I noticed that the linker places it at 0x402F4000.  So I forced the linker to place it at 0x402F0400, now I get the above warning.

Can someone explain where this alignment of 16384 for bss is specified, and if there is any problem with overriding this?

Cmd file:

--stack_size=0x4000
--diag_suppress=10063
-e Entry
MEMORY
{
    SRAM:     o = 0x402F0400  l = 0x0000FC00   /* 64kB internal SRAM */
    L3OCMC0:  o = 0x40300000  l = 0x0000B7E8   /* 64kB L3 OCMC SRAM */
    BOOT_HW_INFO: o = 0x4030B7E8  l = 0x18
    BOOT_PROGRESS_STAT: o = 0x4030FBFC  l = 0x4
    AM335X_VECTOR_BASE: o = 0x4030FC00  l = 0x3F8 /*Section in L3 area for setting vector base address */
    DDR0:     o = 0x80000000  l = 0xFFFFC00   /* 256Mb minus shared area */
 SHARED_DATA (RW): org = 0x8FFFFC00 len = 0x400
}

SECTIONS
{
 /* EXECUTABLE CODE */
    .text: > 0x40300000
    {
     init.obj(.text)
     startup.obj(.text)
     startup.obj(.const)
     *(.data*)
     *(.text*)
     *(.const*)
    }

    .stack  >  SRAM(HIGH)
    .bss:  >  0x402F0400 RUN_START(bss_start) RUN_END(bss_end)
    {
     *(.bss*)
    }
    .sharedHwInfo  > BOOT_HW_INFO
    .sharedResetData: load > SHARED_DATA

}

  • Mat Bennion said:
    Can someone explain where this alignment of 16384 for bss is specified, and if there is any problem with overriding this?

    Some input some section named .bss, from some object file (that is possibly within a library), needs that large alignment.  And the only way to provide it is for the final output section .bss (of which this .bss section is one part) to also be aligned to that same large alignment.  This raises these questions: Where does this .bss input section come from?  Does it really need that alignment?

    Here is how you can see the alignment of a .bss section from one object file ...

    $ armofd --obj_display=none,sections file.obj
    <skip many lines>
         4 .bss                      0x000016a8 0x000016a8  0x1c8     4   Y
    <skip more lines>

    That last number 4 is the alignment of the .bss section from file.obj.  The option --obj_display=none,sections reduces the output of armofd to only information about the input sections in the file.  armofd is a utility that is part of the compiler tools.  It is documented in the ARM assembly tools manual.

    Another way to see the output of this command ...

    $ armofd --obj_display=none,sections file.obj | grep -E 'OBJECT|bss'
    OBJECT FILE:  file.obj
         4 .bss                      0x000016a8 0x000016a8  0x1c8     4   Y

    This sends the output of armofd through the Unix-like command grep.  -E says this is an extended regular expression.  That expression shows any line with the word OBJECT or bss on it.  I use this Unix-like command because of what I recommend next uses more Unix-like commands ...

    $ find . -name '*.obj' -print0 -o -name '*.lib' -print0 | xargs -0 armofd --obj_display=none,sections | grep -E 'OBJECT|bss'
    

    I can give only a high level description of this command.  Execute it in the directory that is the root of where all the object files (extension .obj) and libraries (extension .lib) are located.  It search all those directories, finds the object and library files, and uses armofd to gather section information from them.  The grep at the end filters the output so you only see the names of the files, and the information about the bss input section.  For details on find and xargs, consult your favorite Unix expert, web site, book, or whatever.  

    This will show you which .bss input section from which file or library requires the large alignment.  At that point, I presume it will be clear on why the alignment is required, and whether you must observe it or ignore it.

    Mat Bennion said:
    #10098-D specific address 0x402f0400 overrides alignment of 16384 for ".bss"

    The linker is telling you that, because you allocated the .bss section to a hard-coded address that does not conform to the requested alignment, the alignment is being ignored.  Once you know the source of the alignment, you can decide whether this is a problem or not.

    Thanks and regards,

    -George

  • Thanks.

    I used armofd and found that the MMU page table needed the 16k alignment.