PDA

View Full Version : Picbasic Bootloader ?



Marcick
- 1st June 2007, 07:59
I would like to write a "picbasic bootloader" for my Pic18F2550.
It should read a new code from an external EEPROM and reprogram the chip.
I search and search but I can't find any example.
Anybody was able to do this ?
Marco

rod27cn
- 1st June 2007, 10:29
try to visit the link below:

http://www.microchipc.com/sourcecode/#bootloader

maybe you can find some clue, I did not find exactly the same chipset that you have but other examples base on other chipset may be a good reference.

Marcick
- 1st June 2007, 10:47
try to visit the link below:

http://www.microchipc.com/sourcecode/#bootloader

maybe you can find some clue, I did not find exactly the same chipset that you have but other examples base on other chipset may be a good reference.

Tnank you, but I'm looking for sample in Picbasic, not C or assembler ...
Marco

Jumper
- 1st June 2007, 10:50
http://www.picbasic.co.uk/forum/showthread.php?t=4498

An example of a picbasic bootloader I wrote. BUT you might have some problems doing this way since you have to remember the pic basic pro 16-bit limitation in adressing. So for anything bigger than 64kbytes (32k words) you have to break new ground but for smaller devices this works great.

/me

Marcick
- 1st June 2007, 12:08
Thank you so much,
there is much to read and learn in that thread !
Bye
Marco

Marcick
- 4th June 2007, 06:43
http://www.picbasic.co.uk/forum/showthread.php?t=4498

An example of a picbasic bootloader I wrote. BUT you might have some problems doing this way since you have to remember the pic basic pro 16-bit limitation in adressing. So for anything bigger than 64kbytes (32k words) you have to break new ground but for smaller devices this works great.

/me

Hi Jumper, it is not clear to me this point:
I have a GPRS modem in my application, so I would like to send it the new firmware to be programmed via e-mail. The main program should receive it, store it in an EEprom then jump to the "bootloader" in the high memory, that read it again and reflash the PIC.
So my bootloader is not "classic style" and is not useful to reprogram the PIC via serial line.
The question is: once the bootloader is programmed in the PIC, is there a way to continue using the MPLAB ICD2 to program the main application in the PIC ?
Thanks
Marco

Jumper
- 4th June 2007, 11:17
Since you never want to enter the bootloader with a jump from the reset vector (which is the normal way) you dont even have to add define loader_used 1 or what ever it should be.

You just need to write the bootloader and program it to the high memory. Then you need to set the ICD2 to only program a certain momory area and then you can write your software as the bootloader didnt exist. This will over write the reset vector but in your case that is a good thing :-) Just make sure you dont write or erase the area where the bootloader lives.

Then with a jump to your address for the loader you are ready to go. This is similar to the way I program some of my pics, from a 64k ee-card with the difference I only do it at startup or never at all.

GPRS flashing seems to be a fun idea, that is why we like to write our own loaders!

An other way is to program the loader, e-mail the applicationsoftware (since the PIC is blank you will end up in the loader anyway. Bootload the PIC and when it is all finished read out the hexfile with the ICD2 and use that 2-in-1 hex file for all the other 2 million pics or so in your production line.

Hope I was clear....

/me

Marcick
- 4th June 2007, 11:37
Thank you Jumper,
yes it's more than clear !
Really I've tryed that way and it didn't work , but sure I did something of wrong, I'll try again.
Many txs
Marco

dhouston
- 8th July 2007, 17:22
I don't know whether this will help but there is a mikroBasic project for a UDP bootloader (using the ENC28J60) and 18F PICs.http://www.mikroe.com/en/projects/

victorf57
- 9th July 2007, 01:15
Perhaps this may help.
http://www.oshonsoft.com/picbootloader.html

regards
Victor