Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Bootloader USB PIC24FJ128GB204

Status
Not open for further replies.

Rikr09

Member level 3
Joined
Feb 14, 2013
Messages
59
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,745
Hello,

I am about to use PIC24FJ128GB204 and the idea is to implement a bootloader using USB but i do not have any knowledge about this. I would like you can help me with some ideas, things to read...

I hope you can help me with this.

:shock:
 

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
 

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

Hello Susan,

First, thanks for your reply.

According you told me, i already have a Pickit 3 to get the bootloader into the device. The thing that i do not understand is what you say about design my memory layout to include the bootloader, this is on the .gld?

I hope you can continue helping me with this.

Thanks again
 

What specific compiler are utilizing?

The file extension .gld indicates a linker script file.


BigDog
 

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

Hello BigDog, thans for your reply.

According you answer me, i have some questions which i would like you to help me to clarify:

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??

Thanks again,

Best regards.

- - - Updated - - -

What specific compiler are utilizing?

The file extension .gld indicates a linker script file.


BigDog

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.


1. When you say make some changes, which are?

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.

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?

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.

3. I see that you and Susan talk about debbug, why to debbug the bootloader 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:


I'm using XC16 v1.24

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
 

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
 

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.
 

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.

Sorry, i dont understand what you mean....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top