specify an function to absolute address and LMA equ VMA
c code:
Code:
/*
* patchprog.c
*
*/
int func2(int) __attribute__ ((section (".FUNC_PATCH")));
int func2(int x){
return x*100;
}
int main()
{
func2(100);
return 0;
}
sag code:
Code:
USER_SECTIONS .FUNC_PATCH
REG1 0x0 0x10000
{
EXEC1 0x0 0x10000
{
* (+RO, +RW, +ZI)
STACK = 0x3000000
}
}
REG2 0x500020 0x1000
{
EXEC2 0x500020 0x1000
{
* (.FUNC_PATCH)
}
}
Execute nds_ldsag.exe
Code:
$ /cygdrive/d/Andestech/AndeSight201MCU/utils/nds_ldsag.exe lma_eq_vma.sag -o lma_eq_vma.ld
The output file is placed "lma_eq_vma.ld"
result :
Sections:
Idx Name Size VMA LMA File off Algn
0 .nds32_init 00000002 00000000 00000000 00001000 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .init 00000004 00000002 00000002 00001002 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .text 00000100 00000008 00000008 00001008 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .ex9.itable 00000004 00000108 00000108 00001108 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .eh_frame 00000004 00000120 00000120 00001120 2**2
CONTENTS, ALLOC, LOAD, DATA
5 .ctors 00000004 00000124 00000124 00001124 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .dtors 00000004 00000128 00000128 00001128 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .jcr 00000004 0000012c 0000012c 0000112c 2**2
CONTENTS, ALLOC, LOAD, DATA
8
.FUNC_PATCH 0000000e
00500020 00500020 00002020 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE