LPC1700 Multiple Images flashed to memory

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

LPC1700 Multiple Images flashed to memory

1,938 Views
nicholas1
Contributor II

Hi guys,

I am using an LPC1758 (KEIL MCB1700) with uvision 5. I am trying out an alternative to bootloading. Is it possible to flash three separate KEIL projects (HEX or otherwise) to memory.

The plan is to have 2 different applications (Blinky1 and Blinky2) at 2 different locations and have a separate application that will point to and run either of these flashed at address 0x00.

Blinky1 and Blinky2 having already been compiled to a HEX file and verified to work if flashed at address 0x00.

So for example Blinky1 will be located at 0x2000 and Blinky2 will be located at 0x4000 and the third project will run these two functions at these addresses as seen in the code below. (I tried 3 times to format it properly for this forum but can't work it out. Sorry)

#include "LPC17xx.h" #define AP_ADDR 0x2000 // where the user app located #define AP_ADDR2 0x4000 // where the user app located typedef void (*FP)(void); /** run the user application from pre-specified address*/ void Run_Blink1() {         FP fp;         fp = (FP)AP_ADDR;         (*fp)(); } void Run_Blink2() {         FP fp;         fp = (FP)AP_ADDR2;         (*fp)(); } int main(){         while(1){         Run_Blink1();         Run_Blink2();         } }

I'm pretty new to embedded and not quite sure where to start. If this is possible how would one go about separately flashing each of these HEX files at the specified locations?
The idea is that we can use IAP to update a function, sort of like a live firmware update.

Thanks in advance for any and all help, even if it's just a link to point in the right direction.

regards Nick

Labels (1)
0 Kudos
4 Replies

779 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Nicholas Lawrenson,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you to refer to these follow applications.
https://www.nxp.com/docs/en/application-note/AN11258.zip
https://www.nxp.com/docs/en/application-note/AN10866.zip
https://www.nxp.com/docs/en/application-note/AN11257.zip
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

779 Views
nicholas1
Contributor II

jeremyzhou, Thanks, did briefly go through those already and even got the USB loader working (sometimes). Could not get the Ethernet bootloader to do anything. Will have to do some more research before I can dig into the code for these bootloaders.

0 Kudos

779 Views
converse
Senior Contributor V

What you are doing is not "an alternative to boot loading" - it is boot loading!

These devices do not support position independent code, so you need to link each of your images to the address that they are going to run from. So, in your example, "Blinky1" must be linked to run at 0x2000 and "Blinky" at 0x4000. These should be standalone apps that (assuming they are using interrupts) must include a vector table, and you must move the vector base. You boot loader (the application based at 0x0) must select the correct image, setup the stack and then jump to the application entry point.

You are probably best off be reading and understanding the various boot loader examples provided by NXP.

0 Kudos

779 Views
nicholas1
Contributor II

converse‌, Thanks. So if I understand you correctly, if the device supported position independent code, my initial plan should have been pretty simple. But because it doesn't I need to read up on linking and vector mapping (only if interrupts being used?). I actually already read through most of the bootloader examples(Ethernet, USB, I2C etc) but the key as you said was to "understand". Will have to slow it down a bit and read some docs more thoroughly . Thanks for pointing in the right direction.

0 Kudos