error: initializer element is not constant

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

AxGxP
Posts: 1
Joined: Sun Jan 12, 2020 9:35 am

error: initializer element is not constant

Postby AxGxP » Sun Jan 12, 2020 9:47 am

#define RAM 0x20000000
#define BB 0x22000000

volatile uint64_t ID=0;
uint32_t * pID=(uint32_t*)(((uint32_t)&ID - RAM)*32 + BB); // bit banding

Declaring it as global variable, I receiving error:
error: initializer element is not constant

How it can be solved?

The strangest that:
uint32_t * pID=(uint32_t*)(((uint32_t)&ID - RAM) + BB);
without *32 compiles without errors.

Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 1 guest