Andes Workshop

It is currently Fri Mar 29, 2024 5:13 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: specify an function to absolute address and LMA equ VMA
PostPosted: Mon Jan 12, 2015 12:14 pm 
Offline

Joined: Wed Aug 27, 2014 1:00 pm
Posts: 12
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


Attachments:
LMA_VMA.zip [36.11 KiB]
Downloaded 1120 times
Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group