Sign in

username:

password:



Not a member?

Search AT91SAM



Search tips

Subscribe to AT91SAM



Ads

Discussion Groups

Discussion Groups | AT91SAM ARM | IAR linker setting for bootloader

For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU. This group is to exchange information to help users get started and learn how to use the devices.

IAR linker setting for bootloader - liew...@kenetics-group.com - Sep 23 7:57:01 2008

Hi all,

I have a bootloader which is located at flash memory 0x0000 to 0x4000 and ram memory 0x0000 to 0x2000. The bootloader itself has enabled the remap feature. Now, I wish to write my application in IAR but I have no idea on how to write my linker setting (*.xcl). Here is my non-working example. Any expert who can hint what was wrong? All kind of hints will be greatly appreciated.

//************************************************
// Inform the linker about the CPU family used.
// AT91SAM7S256 Memory mapping
// No remap
// ROMSTART
// Start address 0x0000 0000
// Size 256 Kbo 0x0004 0000
// RAMSTART
// Start address 0x0020 0000
// Size 64 Kbo 0x0001 0000
// Remap done
// RAMSTART
// Start address 0x0000 0000
// Size 64 Kbo 0x0001 0000
// ROMSTART
// Start address 0x0010 0000
// Size 256 Kbo 0x0004 0000

//************************************************
-carm

//* turn on segment map
-xs
//*************************************************************************
// Internal Ram segments mapped AFTER REMAP 64 K.
//*************************************************************************
-Z(CONST)INTRAMSTART_REMAP=00104000
-Z(CONST)INTRAMEND_REMAP=00105000

//*************************************************************************
// Read-only segments mapped to Flash 256 K.
//*************************************************************************
-DROMSTART=00104000
-DROMEND=00105000
-DROMSTART2=00105100
-DROMEND2=00137BFF

-DOEMCFGSTART=00137C00
-DOEMCFGEND=0013FFFF
-DOEMCFGLEN=00008400

//*************************************************************************
// Read/write segments mapped to 64 K RAM.
//*************************************************************************
-DRAMSTART=00202000
-DRAMEND=0020FFFF

//************************************************
// Address range for reset and exception
// vectors (INTVEC).
// The vector area is 32 bytes,
// an additional 32 bytes is allocated for the
// constant table used by ldr PC in cstartup.s79.
//************************************************
-Z(CODE)INTVEC=202000-20203F

//************************************************
// Startup code and exception routines (ICODE).
//************************************************
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND,ROMSTART2-ROMEND2
-Z(CODE)SWITAB=ROMSTART-ROMEND,ROMSTART2-ROMEND2

//************************************************
// Code segments may be placed anywhere.
//************************************************
-Z(CODE)CODE=ROMSTART-ROMEND,ROMSTART2-ROMEND2

//************************************************
// Various constants and initializers.
//************************************************
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND,ROMSTART2-ROMEND2
-Z(CONST)CHECKSUM=ROMSTART-ROMEND,ROMSTART2-ROMEND2

//************************************************
// Data segments.
//************************************************
-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND

//************************************************
// __ramfunc code copied to and executed from RAM.
//************************************************
-Z(DATA)CODE_I=RAMSTART-RAMEND
-Z(CONST)CODE_ID=ROMSTART-ROMEND,ROMSTART2-ROMEND2 // Initializer for
-QCODE_I=CODE_ID

//************************************************
// ICCARM produces code for __ramfunc functions in
// CODE_I segments. The -Q XLINK command line
// option redirects XLINK to emit the code in the
// debug information associated with the CODE_I
// segment, where the code will execute.
//************************************************

//*************************************************************************
// Stack and heap segments. (hex values)
//*************************************************************************
//-D_CSTACK_SIZE=(100*4)
// ASIDSING - made stack 4k (400*4) or 8k(800*4)
-D_CSTACK_SIZE=(400*4)
-D_IRQ_STACK_SIZE=(3*8*4)
-D_ABT_STACK_SIZE=100

// ASIDSING note that these stacks are initialized in Cstartup.s79
// and are stuck at the end of RAM
-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)ABT_STACK+_ABT_STACK_SIZE=RAMSTART-RAMEND
------------------------------------



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )


Re: IAR linker setting for bootloader - kcl999 - Sep 23 20:45:23 2008

Additional information: I think also need to change assembler directive
ORG to "ORG 0x4000"
------------------------------------



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )