Hey All,
I'm looking at implementing a boot loader in to project. The communication interfaces that i will be using are RS-485 and Ethernet. The specific MCU i'm using is a LPC1788 from NXP. I have looked around forums to find a boot loader that i could use but i have had no luck. If someone could give me example code or point me in the write direction for implementing it this would be much appreciated.
Matt
I cannot provide you with code because our ethernet boot code is to specific to our user application:
But if you want to make ethernet boot loader you need to manage the following items.
1.- Reading and writing data using ethernet port. Many examples are provides in sample code.
2.- You need to learn how to create user applications on kiel project with memory offset so it doesn't overlap your ethernet bootloader.
3.- Creation and interpretation of HEX file, you need to set your project to generate the HEX file for user application. You need to extract the content of HEX file and transfer it with ethernet.
search for "parallel flash format intel hex" in google to understand HEX format.
4.- Using IAP (in application programing) to write the content of your HEX file into flash memory. There is a sample project about how to use IAP.
5.- Jumping from boot loader, once you have downloaded the user application to flash you need to jump to user application, many threads on this forum deal with how to set vector interrupt table and how to jump to user application.
HEX files are not needed.
The program fromelf.exe can convert directly into a binary file.
But is very easy to extract the content of your HEX file and transfer it to flash, and as HEX provide information about memory offset you will know where to write it in flash.
And the bin file is one single block of raw data ready to transfer. You should already know where, because of the settings made in the memory dialog of the project.
Next thing is that you normally don't want to distribute a hex file that requires the boot loader to parse data. The binary data don't have anything needing to be parsed. But are very easy to extend with some fill data so you get <app_bin> + <fill_data> + <app_id> + <app_version> + <crc32>.
Then you can instantly look at a fixed address in the file and see that it is a binary intended for your hardware, and not a random file someone have accidentaly found somewhere. And you can see if it is the same version as currently used or a newer or older version.
And it's possible to compute a CRC32 directly on the file and verify that the file hasn't been corrupted.
The binary file is also half the size (unless you had holes in your flash memory layout) speeding up transfer to device, potentially using over-the-air updates where the traffic costs money.
Points taken,
but my parsing of the HEX file occurs in the window application that uses ethernet to talk to M3 bootloader so what is sent is mostly raw image + memory offset.
Using memory offset in the HEX file means that M3 bootloader (and windows application talking to it) doesn't need to know what is the setting of your keil user application project.
Of course file is verified after writing, HEX file also includes checksum.
Thanks for getting back to me so quick. I wont be able to implement the ideas yet, the board is still in the development stages. I have some more specific questions about the functionality of the boot loader.
Which UART does the ISP use on the LPC1788 or do you set this is this chosen by the boot loader?
When designing the circuit for the LPC1788. Is there any specific circuitry that i need to add so that the USB and Ethernet can be used to boot load from later on?
Does IAP allow for new firmware to be programed with out reseting the LPC1788?
Thanks in advance
UART0 - by hardware.
I don't understand what you are asking here. Please clarify.
Yes, but this is not recommended. It is better to either physically reset the system or let the watchdog do it for you.
View all questions in Keil forum