NXT memory layout
Flash and RAM NXT has 256 KB flash memory and 64 KB RAM memory.
Booting process The booting process is a sequence of operations involving downloading a new firmware to NXT, and then resetting NXT such that it starts up running the new firmware.
Memory Locations When NXT downloads a new firmware, it is placed in the flash memory starting at address 0. Upon successful download then NXT is restarted and it will start to execute code from address 0. At address 0 we find the reset vector, which will contain an address of the reset handler. This is code that handles the initial things that happens when NXT restarts such as when it has downloaded new firmware code.
Remapping The flash memory contains the firmware image, and it has the vector table at address 0, but also at address 0x00200000. Remapping is a technique to trick the processor to run two different pieces of code at address 0 at a different points in time. RAM memory is located at memory 0x00100000 all the time. But a remap command in ARM7 enables us to map the RAM memory to address 0 instead of the flash.
What this does is to let us place the vector table in RAM. The reason why this is necessary is that NXT will write flash pages when it runs; for example when a user downloads a file to it. When the flash is being written, then all code that runs has to be in RAM. That is why we see fastrun statements in the code. Those statements tells the linker to put that code in RAM. One example is of course the flash write page code, but also the I2C handler that runs and responds to the ATmega48 every 1 ms.