Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: SAM7 with yagarto Toolchain Flash Programming
PostPosted: Mon Oct 31, 2011 1:40 pm 
Offline

Joined: Tue Mar 15, 2011 1:53 pm
Posts: 1
Hello,

I have a problem with the flash programming on the AT91SAM7X.
because I think there goes something wrong with the assembler.

I use the Yagarto Toolchain, with Gcc and Eclipse.

I Debug the following function:

RAMFUNC int AT91F_Flash_Unlock(unsigned int Flash_Lock_Page)
{
AT91F_NVM_Init();

//* Protect
AT91F_disable_interrupt();
//* Write the Clear Lock Bit command
AT91C_BASE_MC->MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_UNLOCK | (AT91C_MC_PAGEN & (Flash_Lock_Page << 8) ) ;

//* Wait the end of command
AT91F_Flash_Ready();
//* Protect
AT91F_enable_interrupt();

return (AT91F_Flash_Lock_Status());
}

and the gcc makes the following code:

{
0x00200094 <AT91F_Flash_Unlock>: push {r7, lr}
0x00200096 <AT91F_Flash_Unlock+2>: sub sp, #8
0x00200098 <AT91F_Flash_Unlock+4>: add r7, sp, #0
0x0020009a <AT91F_Flash_Unlock+6>: str r0, [r7, #4]
AT91F_NVM_Init();
0x0020009c <AT91F_Flash_Unlock+8>: bl 0x1012ec <AT91F_NVM_Init>

//* Protect
AT91F_disable_interrupt();
0x002000a0 <AT91F_Flash_Unlock+12>: bl 0x200490
//* Write the Clear Lock Bit command
AT91C_BASE_MC->MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_UNLOCK | (AT91C_MC_PAGEN & (Flash_Lock_Page << 8) ) ;
0x002000a4 <AT91F_Flash_Unlock+16>: ldr r3, [pc, #40] ; (0x2000d0 <AT91F_Flash_Unlock+60>)
0x002000a6 <AT91F_Flash_Unlock+18>: ldr r2, [r7, #4]
0x002000a8 <AT91F_Flash_Unlock+20>: lsls r1, r2, #8
0x002000aa <AT91F_Flash_Unlock+22>: ldr r2, [pc, #40] ; (0x2000d4 <AT91F_Flash_Unlock+64>)
0x002000ac <AT91F_Flash_Unlock+24>: ands r2, r1
0x002000ae <AT91F_Flash_Unlock+26>: ldr r1, [pc, #40] ; (0x2000d8 <AT91F_Flash_Unlock+68>)
0x002000b0 <AT91F_Flash_Unlock+28>: orrs r2, r1
0x002000b2 <AT91F_Flash_Unlock+30>: str r2, [r3, #100] ; 0x64

//* Wait the end of command
AT91F_Flash_Ready();
0x002000b4 <AT91F_Flash_Unlock+32>: bl 0x200000 <AT91F_Flash_Ready>
//* Protect
AT91F_enable_interrupt();
0x002000b8 <AT91F_Flash_Unlock+36>: bl 0x200498

return (AT91F_Flash_Lock_Status());
0x002000bc <AT91F_Flash_Unlock+40>: bl 0x20002c <AT91F_Flash_Lock_Status>
0x002000c0 <AT91F_Flash_Unlock+44>: movs r0, r0
}
0x002000c2 <AT91F_Flash_Unlock+46>: movs r0, r0
0x002000c4 <AT91F_Flash_Unlock+48>: movs r0, r0
0x002000c6 <AT91F_Flash_Unlock+50>: movs r0, r0
0x002000c8 <AT91F_Flash_Unlock+52>: movs r0, r0
0x002000ca <AT91F_Flash_Unlock+54>: movs r0, r0
0x002000cc <AT91F_Flash_Unlock+56>: bx r1
0x002000ce <AT91F_Flash_Unlock+58>: nop ; (mov r8, r8)
0x002000d0 <AT91F_Flash_Unlock+60>: ; <UNDEFINED> instruction: 0xff00ffff
0x002000d4 <AT91F_Flash_Unlock+64>: vhadd.u8 d0, d0, d3
0x002000d8 <AT91F_Flash_Unlock+68>: movs r4, r0
0x002000da <AT91F_Flash_Unlock+70>: ldrh r0, [r0, r0]

I don't understand why there are 6 movs r0, r0. It makes no sense for me.

Has someone a idea what it could be?

I hope there is a person who can help me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 4 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: