RE: Processor Technical Support (SR#: 0706904)

Document created by analog-archivist Employee on Feb 23, 2016
Version 1Show Document
  • View in full screen mode

Is it possible to have multiple initialization options within the
same section?


No. A single memory section cannot have more than one type of initialization.
So the following is not possible.
  #pragma section ("sect1", RUNTIME_INIT)
  #pragma section ("sect1", ZERO_INIT)

For example, if variables a, b and c are defined under the same section
“sect1”, all the three variables will have the same initialization option
that's specified for “sect1”.  So if “sect1” is user-initialized at program
startup by using “RUNTIME_INIT” qualifier,
  #pragma section ("sect1", RUNTIME_INIT)
int a= 0x11;
int b = 0x22;
int c= 0x33;
Variables a, b, c are all initialized with user initialized values at runtime.

In case it is required to zero initialize variable ‘a’ using ZERO_INIT
qualifier it is not possible to do that with variable ‘a’ being defined under
section “sect1”. So the only solution would be place variable ‘a’ in a
different section.
#pragma section ("sect1", RUNTIME_INIT)
int b = 0x22;
int c= 0x33;

#pragma section ("sect2", ZERO_INIT)
int a;

The above code will cause variable 'a' to be zero initialized at run time and
'b' and 'c' to be initialized to specified values at run time.