| View previous topic :: View next topic |
| Author |
Message |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
|
Posted: Tue Feb 05, 2013 2:46 am |
|
|
Looks like my lexdyxia is'nt cured yet !
The advantage, all be it a minor one, is with a high memeory bootloader the app does'nt need to modified and re-compiled when switching between using a PICKIT, ICD or other programmer and using the bootloader. i.e. You might have a dev system on your desk with ICD attached and targets in the field with bootloaders. Both should run the same hex file. |
|
 |
jeremiah
Joined: 20 Jul 2010 Posts: 1426
|
| Re: ex_usb_bootloader |
Posted: Tue Feb 05, 2013 9:20 am |
|
|
What modifications are needed in that scenario for a low memory bootloader?
| nurquhar wrote: |
Personally I prefer the approach of the bootloader being in the top of memory so the app can be used as normal starting at 0x0000. The only wrinkle to be handled by the bootloader is to catch the writing of the apps reset vector at 0x0000 and store it elsewhere. i.e. The reset vector points directly to the start of bootloader which chains to the app using the vector it caught and stored. |
You can actually set a different app reset vector in the app code using the #build directive (as well as interrupts if you wish to move those, but that actually requires a remapping in the bootloader as well). Then it won't try to write it to 0x0000. |
|
 |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
|
Posted: Wed Feb 06, 2013 12:02 pm |
|
|
Ok I have it working . ie modified ex_usb_bootloader to load applications at there natural position in low memory. Bootloader is now in high memory. No need to alter your app in any way to use the bootloader, other than it needs to fit the space available.
I have made some other improvements/changes :
1) Changed it use polled usb task which gets rid of the need for interrupt redirection.
2) Turned off Xon/Xoff, seems work without. I will have to check a big program to be sure.
3) Why send 0x06 after each hex line? Changed it to give '+' for a line which passes the CRC check, '~' for failed.
4) Allowed echo of hex file comment lines.
5) Added simple command line i/f. ie two commands "load" and "run".
So output on terminal to load and run an app looks like :
| Code: | Monitor 06-Feb-13 17:42:07
>
>
>load
Waiting for Hex File Upload
+++++++++++++++++++++++++++++++++++++++++++++++++++
;PIC18F27J53
;CRC=8774 CREATED="06-Feb-13 14:14"
Upload OK
>
>run
Starting... |
I would love to share the code but the moderators might jump on me for posting CCS examples. All be it heavily modified. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20161
|
|
Posted: Wed Feb 06, 2013 12:25 pm |
|
|
06, is ASCII 'acknowledge'.
Use 06, and 21 (0x15 is ASCII 'negative acknowledge).
These are historical standard communication characters.
Best Wishes |
|
 |
|