For XIP mode
We put common_ISR_wrapper to a section ".nds32_aa".
.section .nds32_aa, "ax"
(The file is crt0.S)
Code:
.section .nds32_aa, "ax"
.align 2
common_ISR_wrapper:
SAVE_ALL_HW
la $r1, ISR_TABLE
lw $r1, [$r1+$r0<<2]
jral $r1
RESTORE_ALL_HW
iret
Then we modify the sag file, add the following lines:
Code:
QEXEC 0x00800000
{
LOADADDR lma_QEXEC_S
ADDR vma_QEXEC
* (.nds32_aa)
LOADADDR lma_QEXEC_e
}
copy the data to .nds32_aa
(file init-default.c)
Code:
extern char lma_QEXEC_S;
extern char lma_QEXEC_e;
extern char vma_QEXEC;
/* Copy data section to RAM */
size = &lma_QEXEC_e - &lma_QEXEC_S;
MEMCPY(&vma_QEXEC, &lma_QEXEC_S, size);
Out file
Code:
.section .nds32_aa, "ax"
common_ISR_wrapper:
SAVE_ALL_HW
80000000: 3a 1f 94 3c smw.adm $r1,[$sp],$r5,#0x0 ! {$r1~$r5}
80000004: 3a ff ef bc smw.adm $r15,[$sp],$p1,#0xe ! {$r15~$p1, $fp, $gp, $lp}
80000008: 42 21 00 20 mfusr $r2,$d1.lo
8000000c: 42 31 80 20 mfusr $r3,$d1.hi
80000010: 42 40 00 20 mfusr $r4,$d0.lo
80000014: 42 50 80 20 mfusr $r5,$d0.hi
80000018: 3a 2f 94 3c smw.adm $r2,[$sp],$r5,#0x0 ! {$r2~$r5}
8000001c: 64 13 00 02 mfsr $r1,$INT_MASK
Attachment:
demo-int-xip.zip [123.78 KiB]
Downloaded 857 times