Skip to main content
Peter Simpson
Associate
October 12, 2018
Question

How to prevent variables from being initialized

  • October 12, 2018
  • 1 reply
  • 829 views

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

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
October 12, 2018

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

JW