- 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?
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?