Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Microchip Bootloader
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Microchip Bootloader

by zener on Sun Nov 07, 2010 11:02 pm

The latest thing I am trying is to get a bootloader working for my PIC18F27J13. The DS30 bootloader looks good so I am going to try it. One thing I would like to understand better is the requirement for the goto at 0x0000. At www.microchipc.com/pic_bootloader_ds30/
it says: "You need to make sure there's a goto placed at location 0x00 in your application. In most cases your linker already does this for you."

Where does the goto point to? To the bootloader? How does the linker know what to do? How does the bootloader know where to return to the app code?

Thanks

zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Microchip Bootloader

by JohnDowdell on Tue Nov 09, 2010 1:54 am

I agree after looking at it that it's a bit confusing,

It's not really clear why they are making this point. 0x0000 is the PIC reset vector and need a goto to the entry point address of the start of code. As you say, should this be the bootloader or your app?

I would say you could go either way - 1. reset vector goto to your app and invoke the bootloader when your app says you can using aserial command or pushbutton or something. But it means your app has to know the entry point of the bootloader code. or 2. reset vector goto to the bootloader and then let it fall into your app when the bootloader timeout timesout. There is provision in the bootloader code for doing the latter. Of course then the bootloader code needs to know where to find your apps entrypoint address.

On the other point about the linker - if youve included the reset vector goto in your code, i don' t know why the compiler/linker would or could ever leave it out. Maybe they are are just trying to highlight that you need to remember whether you wanted your app to reset to your apps entrypoint or to the bootloaders entrypoint.

As i said above, if you want the bootloader to return to your app, you need to modify the bootloader firmware and choose an address that you will always start your apps from and that the bootloader firmware will always point a goto to.

JD
JohnDowdell
 
Posts: 27
Joined: Sun May 02, 2010 1:59 am

Please be positive and constructive with your questions and comments.