Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SAM-BA and SAM7S (how to load code into SRAM and execute it with sam-ba)

Status
Not open for further replies.

kumle

Newbie level 1
Joined
Oct 15, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Russia Moscow
Activity points
1,309
We must do the following (for AT91SAM7S256):
- When copying a samba in a flash (when waiting for 10 seconds), then the samba startup takes
some SRAM memory, too, for its variables. Therefore, load your code to not at address 0x00200000 !
- Load your code at address 0x00202000 !

steps:

1) Need to edit the script file linker (example for IAR 5.4):

sram.icf (from example project 'basic_adc_project')

he's a big piece so here:

...//...

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\ a_v1_0.xml" */
/*-Memory Regions-*/
define symbol __ICFEDIT_region_RAM_start__ = 0x202000; //sasha edit !!!
define symbol __ICFEDIT_region_RAM_end__ = 0x20FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_vectors__ = 0x100;
define symbol __ICFEDIT_size_cstack__ = 0x1000;

...//..

2) then must determine the entry point address in order to properly write a command 'go xxxxxxxxx' from samba
2.1) Open file board_cstartup_iar.s

he's a big piece so here:

...//..

/*
After a reset, execution starts here, the mode is ARM, supervisor
with interrupts disabled.
Initializes the chip and branches to the main() function.
*/
SECTION .cstartup:CODE:NOROOT(2)

PUBLIC resetHandler
EXTERN LowLevelInit
EXTERN ?main
REQUIRE resetVector
ARM

resetHandler: //Sasha This is a entry point !!!
/* Set pc to actual code location (i.e. not in remap zone) */
LDR pc, =label
...//..

2.2) We have defined the character value is the entry point = 'resetHandler'
2.3) In setting the compiler, set check box 'Override default program entry' and
in the field 'Entry symbol' write 'resetHandler'.

3) Set the compiler option to generate a file *.map
3.2) Make project
3.3) Open *.map and find string with 'resetHandler':

he's a big piece so here:

...//...

mtx 0x002056d4 0x10 Data Lc xsyslock.o [3]
mtxdst 0x002056f8 0x4 Data Lc MtxWrapper.o [3]
mtxinit 0x002056f4 0x4 Data Lc MtxWrapper.o [3]
mtxlock 0x002056fc 0x4 Data Lc MtxWrapper.o [3]
mtxunlock 0x00205700 0x4 Data Lc MtxWrapper.o [3]
next_abi_dtor_rec 0x002056f0 0x4 Data Lc cppinit.o [3]
obuf 0x00205680 0x50 Data Lc xfiles.o [3]
pinsADC 0x00204a7c 0x30 Data Lc main.o [1]
printf 0x002053e4 0x38 Code Gb printf.o [3]
putchar 0x002052cc 0x8 Code Gb trace.o [1]
resetHandler 0x002051b0 Code Gb board_cstartup_iar.o [1] //Sasha Here it is!!!
resetVector 0x00202000 Code Gb board_cstartup_iar.o [1]
strchr 0x00205570 Code Gb strchr.o [4]
strlen 0x0020515c Code Gb strlen.o [4]
syslock_o 0x002056d0 0x4 Data Lc xsyslock.o [3]

...//..

3.4) Now we know that the address entry is 0x002051b0 (you may have other)

4) Run samba and load file *.bin in SRAM at address 0x202000
4.1) Compare file and memory (must match)
4.2) To run our code write command 'go 0x002051b0' (you may have other address entry)
4.3) The program should begin immediately to work !!!

5)To re-download the software needed to turn off the power to close the samba (on computer) and
turn on power and load samba (on computer) again.

p/s
One could certainly do so after the completion of the program management was transferred to back
to the samba (not power off) but I still don `t know how to do it.

Bye! I hope it's useful to someone !
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top