Const struct at a specified Address

Joined
Jul 27, 2022
Messages
1
Reaction score
0
Hey guys ,
how do I create or initialize a constant structure at an address in a microcontroller(in C)?
I want the structure to be at that position it self. so I tried like this
#define ADDRESS (0x7FC)
typedef const struct
{
uint8_t first;
uint8_t second;
uint8_t third;
} structure;
#define REGS ((structure*)ADDRESS)
structure *structname = REGS;

but need to initialize in the main as structname->first=1 . I don't want that. I want the compiler to directly load the values at that address. How can we do that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top