Memory Layout - Nepetalactone/LightOS GitHub Wiki

Memory Layout

ROM (Page 3435)

Exceptions are redirected to ROM exception vectors. The reset exception is redirected to the public ROM startup code. Other exceptions are redirected to RAM handlers by loading appropriate addresses in the PC register

The fixed location of these dead loops facilitates debugging and testing. The first seven dead loops are default exception handlers linked with RAM exception vectors. Dead loops can be called directly from code, but there is also a special function called from ROM code to execute a dead loop. This function is at address 140C0h. This function is assembly code in ARM mode, which takes the dead loop address from the R0 register. The main purpose of the function is to issue a global software reset before going to a dead loop. In addition the function clears the global cold reset status before issuing the global software reset

##RAM (Page 3437)

The RAM exception vectors provide an easy way to redirect exceptions to the custom handler. Table 25-10 shows the contents of the RAM space reserved for RAM vectors. The first seven addresses are ARM instructions that load into the PC the value in the next seven addresses. These instructions are executed when an exception occurs, because they are called from ROM exception vectors. By default, all exceptions are redirected to the exception dead loops. Users can redirect an exception to another handler by writing its address to the appropriate position from 0x 4020FFE4 to 0x4020FFFC, or by overriding instructions between addresses from 0x4020FFC8 to 0x4020FFE0.