View previous topic :: View next topic |
Author |
Message |
pleslie
Joined: 16 Sep 2005 Posts: 4
|
USB Bootloader Questions |
Posted: Mon Oct 03, 2005 11:55 am |
|
|
I am currently modifying the Codeloader bootloader to work with the CCS CDC USB framework.
I have managed to get it up and running but still need to map the applications interrupt.
My question is however, How can I access the CDC functions like usb_cdc_putc() and usb_cdc_getc() or usb_init(), etc that are already compiled with the bootloader and already present on the microcontroller from my application software without having to re-include the CDC framework with my application as well. This would put two versions of the same code on the PIC, which would really waste alot of space.
Any suggestions would be grealty appreciated as this really simplifies my bootloading process as I can load my applications hex file from hyperterminal just as if I was implementing an RS232 bootloader.
Thanks in advance,
Paul Leslie |
|
|
pleslie
Joined: 16 Sep 2005 Posts: 4
|
|
Posted: Mon Oct 03, 2005 12:02 pm |
|
|
I forgot to mention that Im using a PIC18f4550 and CCS version 3.227,
Paul |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: USB Bootloader Questions |
Posted: Mon Oct 03, 2005 1:41 pm |
|
|
pleslie wrote: | I am currently modifying the Codeloader bootloader to work with the CCS CDC USB framework.
I have managed to get it up and running but still need to map the applications interrupt.
My question is however, How can I access the CDC functions like usb_cdc_putc() and usb_cdc_getc() or usb_init(), etc that are already compiled with the bootloader and already present on the microcontroller from my application software without having to re-include the CDC framework with my application as well. This would put two versions of the same code on the PIC, which would really waste alot of space.
Any suggestions would be grealty appreciated as this really simplifies my bootloading process as I can load my applications hex file from hyperterminal just as if I was implementing an RS232 bootloader.
Thanks in advance,
Paul Leslie |
The best way would be to include the bootloader code with your application. It doesn't cost you anything since the loader is already occupying space. Another option would be to locate the functions at specific addresses. In your application code, put dummy stub functions there. |
|
|
pleslie
Joined: 16 Sep 2005 Posts: 4
|
|
Posted: Mon Oct 03, 2005 2:16 pm |
|
|
Thats a good idea, and kinda along the lines I was thinking. A dummy function with Goto, but how would I deal with the getc() and putc() functions where I need to pass and recieve characters. I would really like the bootloader to remian in the PIC as a standalone piece of code that cannot be modified. Thank you for your quick response,
Paul Leslie |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Oct 03, 2005 2:58 pm |
|
|
I don't like "magic" code that I cannot see. getc() and putc() falls into this category. I would write my own functions (there is not much to a getc and putc function). These are part of the loader code. I would always have the loader code in my application. The functions would then be available to the application. There is no draw back to this if you aren't changing the loader. And if you are, then there must have been a problem in the old one any ways. |
|
|
Guest
|
|
Posted: Wed Oct 05, 2005 1:07 pm |
|
|
The code isn't really magic if it lies resident on the PIC. You can easy see where the functions are located with the bootloader. I dont want to include the bootloader with the application because this would allow a possible corruption of the loader as it must overwrite itself. This would not work well as i will be putting this on a 44pin QFN package with no ablillity to program it with and ICD2 etc. I wrote the dummy stub functions in my application and org'ed them to the right locations. I cannot however get the usb_cdc_putc() and usb_cdc_getc() functions to work. Since these functions use the usb cdc firmware it is not trivial to write these functions without the framework included in the app. Any suggestions would be appreciated as I have the loader working now but just need the abillity to put and receive characters from hyperterminals virtual comm port in my application.
Thanks again,
Paul Leslie[/code] |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Oct 05, 2005 6:24 pm |
|
|
"Magic" code that I am referring to are built in functions that CCS provides. The code is not "included" and therefore cannot be located you a users desired location.
Quote: | I dont want to include the bootloader with the application because this would allow a possible corruption of the loader as it must overwrite itself. |
Not true if you bootloader protects itself by not allowing its location to be overwritten! |
|
|
|