ARM Technical Support Knowledge Articles


Applies to: ARM Development Tools


Information in this knowledgebase article applies to:


I have a section of memory that I do not want to be initialized. In my scatter file I have this region of memory marked as UNINIT. I am using __attribute__((section(""))) to place variables in the UNINIT region.

Scatter file:

LR_IROM1 0x08000000 0x00080000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   .ANY (+RO)
  RW_IRAM1 0x20000000 UNINIT 0x00000100  { ;no init section
  RW_IRAM2 0x20000100 0x0000FFF0  {                ;all other rw data
        .ANY(+RW +ZI)

C Code:

unsigned long NI_longVar __attribute__( ( section( "NoInit")) ) ;

int     main( void )
        while( 1 )

The variable is being placed in the UNINIT region properly, however the memory contents of the variable are still being initialized. It appears as if the UNINIT tag in the scatter file is being ignored. Why is this?


For optimization reasons, global ZI variables of 8 bytes or less are placed into RW data sections.

Only ZI data in UNINIT sections remain un-initialized, however any RW data in the UNINIT section does get initialized. Since the variable in the code sample above is less than 8 bytes, it is being changed from ZI to RW which causes initialization to take place.


Add the zero_init attribute to the variable in order to prevent the optimization. This keeps the variable as ZI data which will not be initialized.

unsigned long NI_longVar __attribute__( ( section( "NoInit"),zero_init) ) ;



The following Discussion Forum threads may provide information related to this topic.


Request the files attached to this knowledgebase article.

Article last edited on: 2012-09-11 06:41:36

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential