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

Globals not initilized

Hi,
I have some global variables declared in a module and initilized to some values.
When I start debugging I've noticed that those globals have random values.
I've checked the "Use Memory Layout from Target Dialog" in linker options.

/* Globals */
int counter = 0x550;
int slack = 0;
int timeout = 0;
static uint32_t button = (uint32_t)0x00000000;
static int init_val = 0;
static uint16_t buffer[BUFFER_SIZE];
volatile uint32_t num = 0U;


Thanks for your support.

IDE-Version:
µVision V5.10.0.2
Copyright (C) 2014 ARM Ltd and ARM Germany GmbH. All rights reserved.

Tool Version Numbers:
Toolchain: MDK-ARM Professional Version: 5.10.0.0
Toolchain Path: C:\Keil_v5\ARM\ARMCC\bin\
C Compiler: Armcc.Exe V5.04.0.49
Assembler: Armasm.Exe V5.04.0.49
Linker/Locator: ArmLink.Exe V5.04.0.49
Librarian: ArmAr.Exe V5.04.0.49
Hex Converter: FromElf.Exe V5.04.0.49
CPU DLL: SARMCM3.DLL V5.10.0.0
Dialog DLL: DCM.DLL V1.10.0.0
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll
Dialog DLL: TCM.DLL V1.14.1.0

Parents
  • You don't mention what processor you use.
    And you don't mention if you have been playing with the startup file.

    1) If using external memory, then the startup file must initialize the memory controller so this external memory can be reached.

    2) The startup file must call the normal CRTL initialization code, so that initialized variables gets these values, and the rest of the memory gets zeroed.

Reply
  • You don't mention what processor you use.
    And you don't mention if you have been playing with the startup file.

    1) If using external memory, then the startup file must initialize the memory controller so this external memory can be reached.

    2) The startup file must call the normal CRTL initialization code, so that initialized variables gets these values, and the rest of the memory gets zeroed.

Children