Look in the Microchip MLA (Microchip Libraries for Applications) as the USB library contains a HID bootloader for PIC24 devices (as well as for other families of devices).
However, you need to be aware that you still need a programmer to get the bootloader into the device in the first place. Also the bootloaders generally do not support debugging.
Therefore I'd recommend that you design your memory layout to include the bootloader but do not add it in to the application until it is fully debugged and working the way you want to. Then add in the bootloader for manufacturing purposes to allow for field-upgrading of the application.
Susan
Adding to Susan's points mentioned, the current MLA provides a few precompiled HEX files for the PIC24FJ family, unfortunately, there are none specifically for the PIC24FJ128GB204. Therefore I would suggest using the HID bootloader source code for the PIC24FJ256GB210 family of devices, which is probably the closest in compatibility to your device, and make the appropriate changes for the bootloader to function properly with the PIC24FJ128GB204 and your design. Microchip also provides a Windows application, HIDBootLoader.exe, to download the application firmware to the device using the HID bootloader, which is also located with the MLA/HID - Bootloader directory.
You will need to take note of the section of memory occupied by the HID bootloader, particularly the last address as this information is necessary to make the proper configurations to compilation and linking of the application code, to ensure it does not attempt to be loaded into a section of flash memory already occupied by the HID bootloader.
In regards to debugging with a bootloader, the bootloader and application code can be merged into a single HEX, which then can be download into the device and debugged using a PICkit 3, ICD 3, etc. Of course, this technique is only useful for the debugging phase of your code development and is typically not applicable in the field as it negates the reason for utilizing a bootloader in the first place.
The current MLA can be downloaded from the following Microchip webpage:
**broken link removed**
BigDog
What specific compiler are utilizing?
The file extension .gld indicates a linker script file.
BigDog
1. When you say make some changes, which are?
2. With the HIDBootloader.exe i download the complete source code project of the Bootloader? If is this, i have to download it to the PIC you suggested me?
3. I see that you and Susan talk about debbug, why to debbug the bootloader firmware??
I'm using XC16 v1.24
You still have not mentioned what specific compiler and IDE your are utilizing? Without these details, it's difficult to offer specific advice, as typically each compiler/IDE handle the required configuration settings differently.
Bootloaders reside in and occupy a particular section of flash, most bootloaders typically reside in flash immediately after the Reset Vector and Interrupt Vectors. Therefore, when compiling any application to be downloaded and installed by the bootloader, the resulting code from compilation must be offset to a section of flash not occupied by the bootloader, so as to not overwrite the bootloader. Also, the particular method the bootloader handles Interrupt Vectors varies from one bootloader to another, the original Interrupt Vector Table is often redirected to an Interrupt Vector Table which resides within the downloaded and installed application code, as it too is typically offset along with the application code. Therefore, the linking phase must be properly configured to not only offset the resulting application code, the application's Interrupt Vector Table must be positioned at a predetermined location, so that when an interrupt is triggered, execution flow branches to the original Interrupt Vector Table and is then redirected to the applications Interrupt Vector Table. I should mention, while I have not actually utilized the HID Bootloader with the PIC24F family of microcontrollers, I have quite a bit of experience with the HID Bootloader and the PIC18F family of microcontrollers and while the PIC18F's Interrupt Vector Table is considerably simpler, consisting of only two Interrupt Vectors, Hi and Lo priority, I suspect the actual methods employed are similar.
No the HIDBootloader.exe is utilized to download the resulting application firmware after compilation to the device by the use of the HID Bootloader which must already be properly installed in the device. As Susan indicated, the HID Bootloader firmware must first be programmed/installed into the device using a programmer like the PICkit 3, just as you would any typical application firmware.
The intent, that both Susan and I both mentioned, is not debug the HID Bootloader, but to debug your application code which the HID Bootloader and downloaded and programmed/installed into the device. Bootloaders often do not support debugging of the application code, however there is a possibility of merging both the bootloader and application firmware into a single image which can then be downloaded, programmed and debugged. However, this process can be far from simple, therefore I would suggest you follow Susan's suggested approach of compiling your application without any the reconfiguration and modifications for the bootloader and simply program and debug your application without the use of a bootloader.
Update:
Thank you.
Is this the free version or licensed professional version?
Are we to assume you are using the MPLAB X IDE? If so, what version?
BigDog
Yes this is the free version, and off course i'm using MPALB X IDE. V3.00
I appreciate your clarification.
I should mention, after contributing to and moderating this forum for a number of years, I quickly learned, the hard way, to avoid making any assumptions.
There is always the off chance you might be one of few compiling via the command line, utilizing some other IDE or by some other means not previously conceived.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?