I want to create an array at specific address with fixed size to access some physical memory in an embedded system using RISC-V. I have already used pointers to access memory regions, like
volatile int* mem1 = (volatile int*) SOME_ADDRESS ;
mem1[0] = 1;
However, as I am accessing memory that is used also by core for its own local data I want it to avoid using that region of memory without modifying any linker script or starup code.
I tried to use malloc
, but that does not seem to be supported yet.
Is there a way in C code to make this work?
mmap()
might be an option.