Bootloader and the 1754

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by CRose on Fri Aug 01 02:30:10 MST 2014
Hello Guys,
i'm kind of new to Microcontrollerprogramming,
and i have a problem with the LPC1754 IAP function
I would like to the LPC1754 to have an update-function. So that i can overwrite the Flash with a new image without using a LPC-Link.

So my first thought was, to take a function copy it somewhere into ram or onto a specific location in the flash, and make sure i protect that part of the flash from overwriting.
This function should accepts the new Firmware via USB_VCOM.
But my problem there was, that i couldn't find a way to write a function into a specific position on the flash (or Ram) so i can make sure to not overwrite it during the update.

After some research, i found out, that there is a secondary bootloader in the Examples of the LPCXpresso IDE.
(the bootloader is for the lpc1768 but i hope it will work for the lpc1754 aswell(?)).
This bootloader would be a great advantage over my first idea, because its more save, and the possibility of Bricking the Microcontroller would be a lot lower.
So i tried like the readme said to edit the Settings (linkerscripts of the bootloader), and upload it onto the lpc1754.
That worked flawlessly, but as soon as it boots up(after the writing finished, or even after i power off and on again), the microcontroller simply loads the image that was flashed before.
So i thought, well maybe the old image is still intact, and since i haven't figured out which button the „Joystick“ button is (because i don't have the RDB1768, but an own board), i decided to uncommend the part, where it checks for the valid image.

So my main looks like that:

int main (void)

#if 0
// Check to see if there is a user application in the LPC1768's flash memory.
if( user_code_present() )
// There is an application, but need to check if user is pressing the button
// to indicate they want to upload a new application.

// User code not present or isp entry requested

// Note - should never actually return from enter_usb_isp ().
while (1);// loop forever
return 0;

but still it simply loads the image that was flashed before, am i missing something?
I can't debug anymore btw. If i set a Breakpoint in the main class of the Bootloader, he doesn't stop there.
So maybe its flashed but its not executed (wrong position inside the flash)?