PDA

View Full Version : Bootloader + Mainline code in single HEX file



dman776
- 16th May 2006, 19:22
I have developed a bootloader (in ASM). (relocatable)
My mainline code is developed in PBP. (absolute)

How can I create a single HEX file to program my pics?
I don't think I can use a linker script since PBP apparently creates absolute code.

Any suggestions?

Anyone??

btaylor
- 17th May 2006, 04:41
It should be possible to read the entire chip (i.e. the low address PBP code and the high address bootloader) as one fiile in a programmer such as EPIC. That file can then be used to program any new chips.

That should streamline production but still leave open a serial bootloader for field mods.

HTH
Brian

keithdoxey
- 17th May 2006, 08:33
It should be possible to read the entire chip (i.e. the low address PBP code and the high address bootloader) as one fiile in a programmer such as EPIC. That file can then be used to program any new chips.

Povided that Code Protect isnt on !!!!

picnaut
- 17th May 2006, 20:53
Hi,

A bootloader is not much good if code protection is enabled.
So, chances are, this shouldn't be a problem.
I've tried Brian's method with success.

Cheers!

dman776
- 18th May 2006, 07:45
Sure it is.
Why do you say that a bootloader is not good with CP on?

picnaut
- 18th May 2006, 15:29
Hi,

My understanding is that if you set the code "protect" bit then the bootloader will not be able to write to program memory.
Seems logical to me but I could be wrong.

Regards,

picnaut
- 18th May 2006, 15:45
Hello again,

I've done a little more digging on the web and came up with the following:

http://www.embeddedrelated.com/groups/piclist/show/9151.php


http://www.electro-tech-online.com/micro-controllers/19522-bootloader-code-protection.html?highlight=code+protect


http://www.picbasic.co.uk/forum/showthread.php?t=3598&highlight=code+protect

So, is it true that code protect makes it so that you can't read the PIC's memory but you can write to it with a bootloader?

If so, how do you verify that the code is correct?

Has anybody here used a reliable bootloader with code protect enabled?

If so, I'd be very interested.

I did a search within this forum (search words: bootloader code protect) and only came up with this thread.

Cheers!

modifyit
- 18th May 2006, 16:43
I have done this reliably with Mechanique's Bootloader. I would also like to figure out a way to combine the bootloader and mainline code into a single hex and use code protect.

I have done it in the past by not code protecting the bootloader hex, bootloading the main file onto the chip, and then reading the whole thing back. This works and I can manually select code protect in my programmer to code protect the combination.

I would like to figure out a way to correct the CP fuse in the hex once I have the combined file so I don't have to keep remembering to adjust the fuses in my programmer.

dman776
- 19th May 2006, 22:59
My bootloader is working fine with CP on. I've obviously left TBLWRT and TBLRD enabled, so that the bootloader works. (I'm working with an 18F).

I ended up taking the bootloader.hex and appending the mainline.hex together (after stripping out the EOF line from the first hex file). It seems to work ok using it to program both in a single run.

If anyone finds a better way to do it, let me know.