Bootloader

Status
Not open for further replies.

AtomSoft

Well-Known Member
I know this is not the first time i asked about a bootloader but heh....

I need some general info on how to start this off...

ever bootloader i have seen is written in asm and i write in C now.

So im not sure where to start in C18

Im lost any C18 examples out there?
 
it may help if you can verify this:
Code:
void _reset (void)
{
    _asm goto _startup _endasm
}

That "_startup" part... is it on the newly downloaded hex? Like when the hex is downloaded to the pic. would that jump to the "main" in the newly downloaded hex?

Code:
void main(void){
//is this the _startup?
}
 
My Guess Is

Yes, I believe that is the way that it functions, although to be absolutely honest I have not tried it
 
I am guessing you only want to write the uC end of the bootloader?

For starters I would look at Microchip AN851. It should provide you most of you need to know. In particular the memory map and the 10 commands used by the loader.

The PACKET FORMAT can be found under communication protocol.

That should cover about everything you need to write a C version. If you get stuck you can always look at the source code.

3v0
 
It does not jump to void main(void).

It causes a jump to
_startup

which is in the c018 startup code.

c018 is part of the users C program (downloaded hex). When it finishes doing its work it will jump to the users code at void main (void).

3v0
 
3v0 if you look above thats what i was reading...

The problem is how does one intertwine the 2?

Like if i write a bootloader or use one from there. when i write the MAIN code i want to use in the chip do i need to alter the C018 file? or is that only for the bootloader portion?

Bootloader..... check if user wants to upgrade/download new hex if not then
main code... this is whats messing me up... can i write a normal file?

Like i have some older projects like my Nokia 7110 code. Can i alter the PIC to use a bootloader and without changing nothing download my old hex into it using the bootloader?
 
The right linker script should solve most or all of your problems. See APPENDIX D: LINKER SCRIPT EXAMPLES


When i was playing with the USB bitwacker I looked at this stuff enough to figure how to link the code so I could build it with or without the bootloader. IIRC the only difference is the linker script used.
 
ok ok i think i got it sort of lol....

I will try to code something in about 20-30 minutes. If all goes well then i will post the complete project and all ok....

... if i run into a problem then ill ask some more lol
 
I edited my previous post while you were reading it.
 
thanks. I re-read the post...

I hate reading code lol i get lost but heh i guess its the best way, Ill take a look at it Nigel thanks
 
Your server is down.
**broken link removed**
Nice work collecting all that info into one place.

Failed to Connect
 
sorry let me upload to my new site lol 1 minute

EDIT:

Link Fixed now
 
Last edited:
1 question before i start also...

Those USB to SERIAL by FTDI can be used for this also right? I mean all you would have to do is setup the COM on the PC side since its a Virtual Com port right?
 
I made up my mind and i will code the BOOTLOADER in ASM and the main hex files in C.

This way i can copy the Microchips bootloader alter it a bit to fit my needs then write some C. Then some VB for the Bootloader windows app.
 
I have been holding back on this question. Why do you need your own version of a bootloader ?
 
i dont but i would like to be able to edit one to work the way i want to lol

Like i want to make my own Widows side also with secret commands and such.
Also want to know how it works well.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…