View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 406
|
|
Posted: Sun Jan 10, 2021 4:59 pm |
|
|
Ok, good news, I have two separated HEX files, once with the bootloader and once with the main program correctly addressed.
Now, I need to flash both HEX files at once, Is this possible? What are the options? _________________ Electric Blue |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9097 Location: Greensville,Ontario
|
|
Posted: Sun Jan 10, 2021 5:11 pm |
|
|
Possible ? Yes.. though you'll have to either search this forum of 'how to do it' or wait until someone else replies who has done it.
Normally you burn( download) the 'downloader' program, then get it to download the 'real' program.
One possible are the 'fuses' they MUST be identical for both bootloader and 'main() program. Big thing is to be sure the memory where bootloader is stored is protected !
I am curious as to why you want to download both bootloader and main() at the same time ? If you do it that way, you bypass the downloading feature and cannot 'test and confirm' that everything works.
Jay |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 406
|
|
Posted: Sun Jan 10, 2021 5:19 pm |
|
|
I'm trying to make a FOTA.
So the bootloader download the firmware using a GPRS modem or a WiFi module.
But the device must be running when the client install it.
A device with only the bootloader is worthless to a client.
The FOTA is just an option in case the client request an update.
In a normal use the client will never use FOTA but the firmware that we burn it in the device. _________________ Electric Blue |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 10, 2021 7:31 pm |
|
|
E_Blue wrote: | I have two separated HEX files, once with the bootloader and once with the main program correctly addressed.
I need to flash both HEX files at once, Is this possible?
|
See Ttelmah's answer in this thread. He explains how to do it:
http://www.ccsinfo.com/forum/viewtopic.php?t=55241 |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 406
|
|
Posted: Sun Jan 10, 2021 9:28 pm |
|
|
Thanks to everyone for your help and patience.
After like 20 minutes I have a solid HEX file.
Just one more thing; once the bootloader ends must jump to the main code; I can do that with a GOTO in assembler but I want to have some portability to PIC24FJ family.
I just found goto_address() function, It is ok to use this or is too dirty? _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19215
|
|
Posted: Mon Jan 11, 2021 1:02 am |
|
|
Look at the examples.
The bootloader example, shows how to handle the interrupt relocation,
and how to jump to the 'application'. The really important one is the
special jump_to_isr instruction used to handle the interrupt vectoring. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 406
|
|
Posted: Mon Jan 11, 2021 8:38 am |
|
|
Yes, the ISR is ok, But I didn't understood the jump from bootloader to main program. I will re read the example. _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19215
|
|
Posted: Mon Jan 11, 2021 10:35 am |
|
|
There isn't a separate jump.
They put a dummy application at the same location, which never returns,
and simply call this.
Result the compiler generates a jump to this. |
|
|
|