This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Scatter file for Cortex-M0 LPC11xx

Hi everybody,

My question is regarding a Cortex-M0 NXP's LPC1114/301.

I am having trouble with the initialization sections that sets the initial values of variables. For example:

int x = 20;

int main(void)
{ if(x==20) do_something();

.....

}

When I run this code, the value of x is undefined and has actually a random value. I know I have to copy the etext section to edata, and also initialize the bss section to 0. But how do I do this in Keil with a scatter file + startup file in assembler? The default startup file from Keil for the LCP1114 doesn't do it...

Thanks in advance,

R.

Parents
  • -> I know I have to copy the etext section to edata, and also initialize the bss section to 0. But how do I do this in Keil with a scatter file + startup file in assembler? <-

    (I think/guess) You don't have to do anything, it is done by KEIL's __main automagically.

    I don't know much about this, but maybe:

    http://www.keil.com/support/man/docs/armlib/armlib_cihfddfg.htm


    How C and C++ programs use the library functions

    This section describes:

    * specific library functions that are used to initialize the execution environment and application

    * library exit functions

    * target-dependent library functions that the application itself might call during its execution.

Reply
  • -> I know I have to copy the etext section to edata, and also initialize the bss section to 0. But how do I do this in Keil with a scatter file + startup file in assembler? <-

    (I think/guess) You don't have to do anything, it is done by KEIL's __main automagically.

    I don't know much about this, but maybe:

    http://www.keil.com/support/man/docs/armlib/armlib_cihfddfg.htm


    How C and C++ programs use the library functions

    This section describes:

    * specific library functions that are used to initialize the execution environment and application

    * library exit functions

    * target-dependent library functions that the application itself might call during its execution.

Children