Uploading HEX file via bootloader

Started by Gregor1971, December 05, 2013, 01:39:40 PM

Previous topic - Next topic

Gregor1971

Hi,
i'm trying to write some c base programm for a pic32-T975H. I'm using the actual version of MPLab for developing. Instead of writing the programm to the board using a pickit, i'd like to use the bootloader via the usb connector.

Since i've been searching the web and this forum for several days without finding a sufficient answer, i would appreciate any hint to solve the folowing two questions:

Which programm to use for uploading the hex file to the board?
Are there special addressranges to be set in MPLap X?

Many thanks in advance...

Gregor

LubOlimex

Hey Greg,

Which programm to use for uploading the hex file to the board?

Download this one: https://www.olimex.com/Products/Duino/Duinomite/_resources/Olimex-Bootloader_Applicatoin-for-Duinomite.zip. To be able to enter bootloader mode - disconnect the board from the mini USB, press and hold down button BUT, connect the board to the mini USB, release the button BUT, <if asked for drivers point the installer to the folder where you extracted the zip>.

Voila! You are now able to program with binaries via the obootloader application.

Note by using this method of programming you can wipe the Duinomite and Pinguino bootloaders. Most importantly, you might also overwrite the bootloader that connects to the application in the archive - this would be irreversible without a PIC32-compatible debugger. 

Are there special addressranges to be set in MPLap X?

You might check the addresses in the document here: http://ww1.microchip.com/downloads/en/AppNotes/01388B.pdf.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

Gregor1971

#2
Hi Lub,

thank you for your tips.

Just to clarify my ideas:

The mmbasic, which is originally installed on the board, is called firmware? If so i would like to replace it with my own binaries. To do so i would have to replace the flash area (0x1d000000 - 0x1d07FFFF). Am i right?

By the way, at witch address does the cpu expect the first instruction to execute after power up? I would gues it is the first address (0x1FC00000) of the bootloader section, but I'm not sure. If the first instuction is placed in the programm flash section (0x1d000000), which is the first address my own binaries should use to avoid overwritng the calling code for the bootloader?

Regards and thanks for helping in advance
Gregor



Stanimir5F

Hi Gregor!

You are right about address mapping:
0x00000000 - 0x0001FFFF - RAM Memory
0x1D000000 - 0x1D07FFFF - Program memory
0x1FC00000 - 0x1FC02FEF - Boot memory

The Boot memory should not be overwritten unless you want to use another bootloader. And the main program should be placed in the Program Memory.
May the Source be with You!

JohnS

You really do need to read the Microchip data sheet because it explains the virtual and physical address ranges.  The ones mentioned so far are physical but not what the program sees.

With a suitable USB HID bootloader you can then use programs like mphidflash but in a way you're already trying to use an odd combination (MPLAB but without PICkit).  Generally people either do it Microchip's way (MPLAB and PICkit) or go with a C complier (like gcc) and a hex or bin uploader like mphidflash.

If you want to single step, breakpoint etc you might like to go with PICkit.

John

Gregor1971

Hi John,

sorry for the long time to answer.

The idea is to develope with pickkit. I agree to you so far.

In the wild a pickit seldomly will be awailable. So it would be easier to have a bootloader writing the new version to flash via usb-sreial mode. This will be possible more often.

Regards
Gregor

JohnS

You could use any of the HID bootloaders.  Microchip publish one and some others have been made, such as used with Pinguinos.  DP have one too I think.

John