How to enable DLM when reset?
----------- Please reference the note of "Andes Programming Guide" 10.1.
_nds32_init_mem(): the name of memory initialization function; called by 1st level reset handler. User must implement this callback function if the memory in the target system needs to be initialized by software. One of the examples of such memory is DRAM.
Prototype: void _nds32_init_mem(void) __attribute__((no_prologue))
Example: void _nds32_init_mem(void) __attribute__((no_prologue, optimize("Os"))); void _nds32_init_mem(void) //The function is weak (optional) { __nds32__mtsr((0x10000|0x01), NDS32_SR_DLMB); //enable DLM base address & size=32K __nds32__dsb();
}
Note: After boot, the $sp is zero, it can work well. (If $sp is not equal to zero, it doesn't go to initialize steps)
In AndeSight user manual, it mentions: 3.2.3.7 C-extension for ISR This demo program (demo-int-c-ext) not only demonstrates interrupt service routine as demo-int does but also serves as an example of how to write ISR with C-extension. In the program, crto.S and interrupt.h in interrupt-c-ext.c are written in C language. NOTE: When this program is built with load mode, users need to set $sp to 0 through debugger before running it.
|