cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent variables from being initialized

Peter Simpson
Associate II

Hi ,

I am using an STM33L072 with the Keil uVision environment.

I want to prevent a couple of variables from being initialized on startup

The manual says to use

#pragma arm section zidata = "non_initialized" 

uint8_t reset_pos;

RtcCalendar_t Current_Time;   // Current time is updated from the server when the base station connects 

                // it is incremented by RTC_AlarmB which is set to 1 minute so ingnore seconds

#pragma arm section zidata // back to default (.bss section)

The map shows them non_initialized

Global Symbols

Symbol Name               Value   Ov Type    Size Object(Section)

reset_pos                 0x200036f0  Data      1  mainbase.o(non_initialized)

Current_Time               0x200036f4  Data     28 mainbase.o(non_initialized)

but they are still returning to zero on reset in debug mode

Is there something else I need to do to stop them being set to zero?

Thank You

Regards

1 REPLY 1

This is a Keil-specific question, so probably better asked at their forum.

JW