Keil Logo

global variables are not initialized

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Folkert van Heusden
Posted
8-Oct-2018 10:00 GMT
Toolset
ARM
New! global variables are not initialized

Hi,

For the last couple of years we've been working on an embedded ARM project.
This worked fine all until suddenly out of nowhere global variables are no longer initialized.
The problem happens in C99 code. The C99 project runs in non-protected mode (UM10562 rev.3, page 882).
The program is not doing anything special, it has an "int main(void)" from where everything is happening, no special startup-code.
The code started to fail when a malloc+free was introduced which was removed later on, and then it kept(!) failing (so no more mallocs/frees where in the code!).

What is the cause of this? And how can I resolve it?

regards

Read-Only
Author
Andrew Neil
Posted
8-Oct-2018 10:19 GMT
Toolset
ARM
New! RE: global variables are not initialized

How do you determine that the globals are not initialised?

Post a minimum, but complete, example which illustrated this.

What is "UM10562" ?

Read-Only
Author
Folkert van Heusden
Posted
8-Oct-2018 10:29 GMT
Toolset
ARM
New! RE: global variables are not initialized

A simple example would be:

int a = 3;

int main(void)
{ printf("%d\n", a);
}

One would expect "3" to be emitted. In our situation garbage was emitted (some random value).

UM10562.pdf is the documentation of the ARM processor we use. I was pointing to the section which describes how to protected mode (the 0x12345678 in CRP1 thing).

regards

Read-Only
Author
Andrew Neil
Posted
8-Oct-2018 11:34 GMT
Toolset
ARM
New! RE: In our situation garbage was emitted (some random value).

and you're sure that's not just down to a baud rate error or some other comms issue?

What does the debugger show?

Would be more helpful to give a link to the document - and name the maker & model.

Read-Only
Author
Tamir Michael
Posted
10-Oct-2018 10:02 GMT
Toolset
ARM
New! RE: In our situation garbage was emitted (some random value).

And what happens if you add an infinite loop in your main?

Read-Only
Posted
8-Apr-2019 13:08 GMT
Toolset
ARM
New! RE: global variables are not initialized

There are many essay writing services that think they are on top. This service houses the best custom papers and samples your professor needs. essay writer will help you in all your tasks.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.