Bootloader and the 1754

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

Bootloader and the 1754

590 Views
lpcware
NXP Employee
NXP Employee
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.
check_isp_entry_pin();
}
#endif

// User code not present or isp entry requested
enter_usb_isp();


// 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)?
Labels (1)
0 Kudos
4 Replies

459 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CRose on Thu Aug 14 06:27:35 MST 2014
Okay i now figured out how to start it, and i was even able to mount it.
I set the Parameters according to my Memory map.

Thanks you for your help so far.

The Problem is, that if i delete the "dummy" firmware.bin, theres no space freed.

So in Windows, if i klick on the Mass Storage Device and select properties, it says:
Used Space: 152Kb
Free memory 0 Bytes.
Even after i deleted the firmware.bin
(Deleting changes nothing)

I don't know a lot about it, but i would guess:
my device somehow have to report back to the PC that he got free space, and somehow it doesn't.

could someone point out to me at which function i should have look at, to find the "Reporting-back-to-OS-how-much-space-i-have"-functionality?
Thanks in Advance



0 Kudos

459 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CRose on Wed Aug 13 06:05:58 MST 2014
Thanks for your Answers already.

Edit: Oh... i just figured out, i totally missread the readme... i thought i needed to change the linkscript of the bootloader, instead it means to edit the linkscript of the image...
i'm sorry that i bothered you, it should work now.

Thanks for your time.

0 Kudos

459 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 01 11:13:39 MST 2014
There have been quite a few posts about secondary bootloaders on the LPC17 family previously, it might be worth you doing a forum search for more information. In particular the point about the stack pointer in this post:

http://www.lpcware.com/content/forum/lpc1768-secondary-usb-bootloader-lock#comment-1133905

For debugging when using a bootloader, I would also suggest looking at:

http://support.code-red-tech.com/CodeRedWiki/DebugThroughBootloader
[written for an earlier version of LPCXpresso but still of use]

Regards,
LPCXpresso Support
0 Kudos

459 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Aug 01 09:23:00 MST 2014
Hi CRose,
There are some differences between LPC1768 and LPC1754 in terms of SRAM, Flash size, peripheral and number of pins. The secondary boot loader done for LPC1768 should work on LPC1754 as well. Please check datasheet and set memory accordingly.
http://www.nxp.com/documents/data_sheet/LPC1769_68_67_66_65_64_63.pdf
http://www.nxp.com/documents/data_sheet/LPC1758_56_54_52_51.pdf

The secondary bootloader is also available for LPC1768 on Keil IDE at below location. I have just tested it and it works.
http://www.lpcware.com/content/nxpfile/an10866-lpc1700-secondary-usb-bootloader
0 Kudos