Comment by pantalaimon
3 years ago
There are many MCUs where flash is mapped to 0x0 but NULL is still 0.
It’s not really a problem in practice unless you want to dump the whole flash and some != NULL check somewhere
3 years ago
There are many MCUs where flash is mapped to 0x0 but NULL is still 0.
It’s not really a problem in practice unless you want to dump the whole flash and some != NULL check somewhere
For an older CPU example, x86 (in 16 bit mode) maps the interrupt table at the physical address 0. So to tell the CPU what handler to use for the 0th interrupt, you have to do:
Granted, most 16 bit OSs were written in assembly, not C, but if you were to write one in C, you’d have this problem.
IIRC, the M68k (which was a popular C target with official Linux support) did the same thing.
For a more recent example, AVR (popularized by Arduino) maps it’s registers into RAM starting at address 0. So, if you wanted to write to r0, you could write to NULL instead. Although one would be using assembly for this, not C.