Andes Workshop
http://forum.andestech.com/

Andes C Language Extension for ISR
http://forum.andestech.com/viewtopic.php?f=25&t=786
Page 1 of 1

Author:  cindy [ Tue Jan 21, 2014 6:15 pm ]
Post subject:  Andes C Language Extension for ISR

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.

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/