Atmel website | ARM Community | AVR freaks | Technical Support
Banner
Welcome to AT91SAM Community Forum
http://www.at91.com/samphpbb/

AT91FR40162SB project using Keil UVision3
http://www.at91.com/samphpbb/viewtopic.php?f=15&t=19051
Page 1 of 1

Author:  mrmichaelmt [ Thu Mar 11, 2010 3:34 am ]
Post subject:  AT91FR40162SB project using Keil UVision3

Dear Community. I am a firmware engineer new to ARM architecture, looking for some general advice pertaining to a project I recently joined. I'm using Keil uVision3 with an AT91FR40162SB based target (that is 256K internal RAM, 2 Meg flash part.)

As I look at the example Startup.s file that is generated by Keil and the code in which it is integrated, I understand how the circuit is set to start reading from flash at location 0x0000000. I understand the vector table, how I jump into the startup assembler, how the vector table is transfered to RAM using LDMIA, STMIA... and I understand how the remap is actuated when the EBI table is copied. but for the life of me...I don't understand HOW the SOURCE code is copied from flash memory to RAM when the project first boots!

I see code that does

LDMIA R8!, {R0-R7} Load Vectors
STMIA R9!, {R0-R7} Store vectors
LDMIA R8!, {R0-R7} Load handlers <<---- What is this for? I copied the
STMIA R9!, {R0-R7} Store handlers <<---- Vector table already. Why
copy the proceeding 24 bytes?

I start the project, and magically the code is executing my main in ram (which has been remapped from flash at 0 to flash at 0x1000000) The only thing that has been "copied" per-se is my vector table, right? It looks like the vector table, and then 24 bytes of junk thereafter ( I know I'm not reading this right, I'm a newcomer to ARM assembler.)

What am I missing here? HOW is my code getting copied to RAM on the AT91? Or is it just getting mirrored after the remap and not actually copied?

Thanks sincerely,
Michael Thomas

Author:  mrmichaelmt [ Fri Mar 12, 2010 2:22 am ]
Post subject:  Re: AT91FR40162SB project using Keil UVision3

http://infocenter.arm.com/help/topic/co ... UI0203.pdf

"During startup, C library initialization code in __main carries out the copying and
zeroing of code and data necessary to move from the image load view to the execute view."

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/