News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Bootloaders - idiots guide

Started by RGV250, Jun 25, 2023, 09:56 PM

Previous topic - Next topic

RGV250

Hi,
After first using the Amicus18 and Arduino (shows how long I have been looking) I decided to try to look at bootloaders for different devices. I have spent loads of time trying and looking on the internet to get nowhere, first the UMC? that was with the IDE, then Tiny bootloader and DS30.
Everything seems to assume you already know what you are doing, today it finally dawned on me (I hope) that the things I was looking at (Tiny bootloader and DS30) are only the loader (PC) side and you need to write the hex yourself and you also need a USB/TTL with RST/DSR signals?

I thought about paying for one and sent Evan an email but he does not do PIC24, Tiny bootloader does not do PIC24 so it seems DS30 is the only option.
I cannot find anywhere a guide to how to create the hex file so I was wondering if anyone knows if there is one.

Regards,
Bob
 

JonW

#1
You have to create the Hex file yourself or purchase one that someone else has written.  You then need a PC application that talks to the device.  The bootloader just receives the program memory from the PC and then writes the flash. 


Here is the original Tiny bootloader site, there is some info on there about how it all works tiny bootloader

You don't necessarily need the rts, it's just used in some cases to reset the MCU, you can power cycle or have a reset button to do the same.  The bootloader's first instructions branch to the bootloader code in memory.  It then waits for a small time period for a command from the PC side and once it gets the correct message the program memory data is transferred in blocks and written to the flash.  If no communication is detected they jump to the start of the main code (your program). 

Les may have one?

TimB


I have written and published a USB bootloader for the Pic18f15k22 and its been adapted for use with other devices. There is no reason you could not just modify it to accept packets over serial.

You will have to work out how the Tiny bootloader works but it is not hard once you understand the basics.

In the USB bootloader I received in the packet the address the data needs to end up in and how many bytes there where. Then I used Cwrite to send the data to flash memory. If the data was in eeprom space I used Ewrite.

You would need to manage stuff like where it is being written to and that it keeps it in bounds. The only feature extra I added was a flag system that marked in eeprom when you started updating the flash and when it was finished. That way you could check on startup if there was valid firmware and just hang in the bootloader waiting for another go.

RGV250

#3
Hi Tim,
Where have you published it, did you not do an article before on the old forum?
I still think it is beyond me but I would be interested in taking a look.

Hi Jon,
I recall you saying you paid for one, what sort of money are you talkiing about as it might be an idea to do that for one but I really would like to understand more so I can modify for other devices

Bob