I'm looking for some example code to write a secondary UART based bootloader, my design has an external supervisor/watchdog IC on the board, this means that for the initial programming I need to disable this with a jumper.
Currently the unit is programmed by opening up the unit, fitting a jumper to disable the watchdog and another to pull the ISP pin low, power on the unit and then load the firmware using flash magic.
What i'd like to be able to do is send the application code a command to enter my secondary bootloader, and have that take care of kicking the watchdog.
However when i look for examples everything I find is for things like USB, Ethernet or CAN/I2C, and I don't think are using the same command set as the ROM bootloader.
are there any examples of a UART based bootloaders?
I'd really like to avoid having to write my own flash applications to go with the bootloader, hence wanting to basically replicate the ROM bootloader.
Most chip makers provide such examples for their chips.
Since it will have at least some dependence on the specific chip's Flash details (and, maybe, other chip-specific details) - the chip maker is probably the best place to look...
sorry i should have mentioned i'm using an NXP LPC1758, i can find many examples for the LPC17xx family, but they are using completely different interfaces such as USB or ethernet, and different protocols to suit, i can't see how any of those can directly translate to what i need without having to reimplement the entire ISP command set which i would rather avoid if i can.
So, again, NXP would be the best place to ask.
But, surely, the transport (USB, Ethernet, whatever) is entirely independent of the flash programming?
So you just need to separate out the flash programming part from the comms part in their examples.
In the ST example, they use YMODEM as the comms protocol, which has the advantage that it is supported by just about every serial terminal app - so you don't need any special host code at all.
just for completeness - this is the docu we (Keil) have prepared on a Bootloader creation:
"How to Write a Bootloader"
Writing a boot loader is a task one typically has to own as a developer. One might have to own writing the complementary Linux or Windows application too.
You could ask NXP for source of their ROM loader, or review a disassembly so that you might use parts of it directly, either via an API, or mix-n-match some of your own wrapper code to manage your board.
Often the primary loader can permit downloading a secondary loader into RAM, this can then deal with idiosyncrasies of specific board hardware.
Secondary loaders frequently implement a different protocol, that's not vendor specific, often something that already works in the terminal application the end user might already have, like X/Y-MODEM
View all questions in Keil forum