I tried to access memory address 0, which is defined as the start address of my ROM, to check that my configuration is correct and such region is accessible. But when I compile the code, the resulting disassembly shows that such operation is undefined.
It's true that 0 is NULL and might be treated as undefined, but is there any workaround for accessing the content at memory address 0?
Here is the test code:
#include <stdio.h>
int main ()
{
printf("%08X", *(unsigned int*)(0));
}
When compiled with arm gcc and option -Os, the resulting disassembly is got.
main:
mov r3, #0
ldr r3, [r3]
.inst 0xe7f000f0
It can be seen that the code ends at .inst 0xe7f000f0 and printf is not called.
The code can also be found Compiler Explorer.