Boot from flash bank A to bank B failing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Boot from flash bank A to bank B failing

693 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by FlorentCapelle on Wed Sep 24 09:27:05 MST 2014
Dear all,


I am facing an issue implementing a bootloader on LPC1857.

My bootloader code is linked at address 0x00000000 and copied in the µC at address 0x1A000000, in the flash bank A of the controller.
From this bootloader, I want to jump to an application code situated in flash bank B at address 0x1B004000 (the code of this application is compiled at address 0x4000).

The steps I take are the following:

- copy the application code to address 0x1B004000 using IAP functions
- set the stack pointer to the value contained in address 0x1B004000
- set the VTOR register to 0x1B004000
- set the M3MEMMAP register to 0x1B000000 (remember my application is linked @0x4000)
- jump to the address contained in address 0x1B004004


My observation is that the bootloader is jumping correctly to my application in flash bank B but the program hangs very quickly. My guess is that the issue comes from the vectors table not being set correctly and that my application goes wrong as soon as interrupts are enabled.

Note also that the same process with the application put in flash bank A at address 0x1A004000 is giving no problem.

Could it be that switching from bank A to bank B is not allowed somehow?

Thanks in advance.
Best regards,
Florent.




Labels (1)
0 Kudos
6 Replies

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Feb 20 21:18:18 MST 2015
Hi Cristobal,
Bank A starts from address 0x1A000000. The address 0x14000000 is SPIFI memory map area.
0 Kudos

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by crchaves on Thu Feb 19 00:45:17 MST 2015
Hi everyone,

I am working with the same processor I have the same problem. I try to booting from the internal flash but without success. I dont know why I can generate a checksum for bank B (with the same address for internal memory flash bank A->0x14000000, bank B-> 0x1B000000). Currently I designed a kernel in uClinux for my hardware but I cant booting the embedded system, I test differents ways of booting without good results.

Sincerely

Cristóbal
0 Kudos

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Sep 25 08:54:03 MST 2014

Quote: FlorentCapelle

Is this actually a bug or an undocumented feature (if there is a difference  :) ...)?

I guess it's intentional, just the documentation is lacking. XOR is cheaper than adding, and works just fine for mapping whole memory areas.



Quote: FlorentCapelle
Do you know if NXP ever react on this?

Not that I'm aware of.  I just remembered that it is done by XOR and found that single thread through search.


In practice it's not a problem, just link your code for the proper address and set VTOR accordingly.
0 Kudos

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by FlorentCapelle on Thu Sep 25 08:05:53 MST 2014
Hi starblue,

Thanks for your reply. I got the picture now...

However I have never seen this in any documentation...!
Is this actually a bug or an undocumented feature (if there is a difference  :) ...)?

Do you know if NXP ever react on this?


Thanks again!
0 Kudos

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Sep 25 07:19:15 MST 2014
The problem is that MxMEMMAP is not implemented as addition but as XOR.

So you can't use it for a small offset from the start of the memory like 0x4000, if your application is bigger than that. For example, addresses in the range 0x4000 to 0x4fff in your application will be translated to 0x1A000000 to 0x1A000fff in the flash. BOOM.

http://www.lpcware.com/content/forum/how-over-come-m4-64k-image-limit-when-dual-core-using-lpc4350
0 Kudos

521 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by FlorentCapelle on Thu Sep 25 07:11:11 MST 2014
Dear all,


After further investigations, it appears to me that the issue is not related to switching from bank A to bank B, nor to the VTOR register.
Instead, it seems the issue comes when changing the M3MEMMAP value.

Let me list the new test steps I took and what is the result:

- the application is now linked @0x00000000 and copied @0x1A004000
- the current value of M3MEMAP is 0x1A000000 (the bootloader runs there)
- the bootloader sets the stack pointer to the value contained in address 0x1A004000
- sets the VTOR register to 0x1A004000
- sets the M3MEMMAP register to 0x1A004000
- jumps to the address contained in address 0x1A004004

Result:
The bootloader jumps correctly to the entry function of my application. However, as soon as the entry function jumps to another function, a [u]bus fault happens[/u].


So I am now not suspicious about the VTOR anymore, but about the changing of M3MEMMAP value.

Best regards,
Florent.
0 Kudos