Page 1 of 1

Bootloader and Program start location help

Posted: Wed Aug 15, 2007 10:07 pm
by Ron
Hi,

I am having a boot loader written for me and the person doing the work is telling me I need to have the compiler place the code at 0x03 as the first 3 words are used by him.

How can I have the flowcode place the program at 0x03 instead of 0x00?

Thanks

Ron

Posted: Thu Aug 16, 2007 9:39 am
by Steve
Hello Ron,

In the linker options, add "-rb 0x003 " at the beginning - this will tell the linker to begin the code at 0x03.

More info needed for Bootloader

Posted: Fri Aug 17, 2007 6:07 pm
by Ron
Hi Steve/Benj,

The programmer has asked me this and I have no idea what it means. He is writing a bootloader for me and the PC application to download a hex file to the PIC.

Here is his questions

I Still need to know how the compiler make a interpage start jump. Like a page select then a goto. These means 3 words and still wonder how it goes with intrerupts enabled.

Let me know if you can help me out with this.

Thanks for the great support....

Ron

Posted: Tue Aug 28, 2007 10:31 am
by Steve
Hello Ron,

Sorry for the long wait for a reply - I've been away on holiday.

I'm not 100% sure, but I think the "-rb" command simply shifts the compiled code (and all the jumps, etc). This includes the "reset vector" (usually 0x000) and the interrupt vector (0x004 for 16F devices).

Note that this is a linker setting. There is no facility for telling the compiler that the first 3 words are reserved. You will probably need to take over the area for the interrupt vectors as well and provide a jump to the shifted interrupt vector.

For the bootloaders we have written, we put the bootloader into the lowest part of memory (0x000 to 0x7FF) and have the user's program relocated to 0x800. To allow the user's interrupts to work, we then place a jump at the interrupt vector (0x004) to the relocated interrupt vector (0x804).

If you look at the more modern PICmicros, they often assume the bootloader code is going to be located in the low part of memory (e.g. see the config word "code-protect" settings for the 18F4455).

I hope this helps.

Posted: Sun Nov 04, 2007 2:57 pm
by elecrobot
Hi matrixmultimedia team!

Can anyone please explain it a bit more because i am new to flowcode. how can i go to linker option in flowcode? I have a development board with pic16f877a. it is already loaded with a bootloader and it works with some other gui application which loads the program in the PIC. the problem is i am using Flowcode v2 which is very easy to write a code but the hex file doesn't get loaded into my PIC because my code should start at ORG 0x0004 instead of ORG 0x0000.

Regards

Posted: Sun Nov 04, 2007 10:43 pm
by Steve
The linker option is in the "compiler options" screen.

Re: Bootloader and Program start location help

Posted: Wed Feb 13, 2008 12:07 am
by elecrobot
Hi MatrixMultimedia

(please note that i have flowcode v2)
When i compile my program to asm. part of asm code looks as shown below. now if i comment out "clrf PCLATH" and then if i compile it by using mplab, my program gets loaded through another gui application created by someone else, otherwise i get error. Can you please let me know how can i comment this instruction out "clrf PCLATH" using flowcode. or is there any alternative way. thanks.
elecrobot

ORG 0
clrf PCLATH ..........................>>>if i comment this out, then my program gets loaded into the PIC
goto start__code

ORG 4
_interrupt
bcf INTCON, T0IF ;clear interrupt flag
retfie

start__code
_main__code
movlw D'7'
bsf STATUS, RP0

Re: Bootloader and Program start location help

Posted: Thu Feb 14, 2008 1:17 am
by elecrobot
hi matrix multimedia team.

is there any way to get rid of "clrf PCLATH" in the beginning of the program as shown above. I am using flowcode v2. please accept my thanks in advance

Re: Bootloader and Program start location help

Posted: Thu Feb 14, 2008 10:55 am
by Benj
Hello

The command you wish to remove is probably added by the C2C compiler software.

This page may be able to shed some light onto your problem,
http://forum.sourceboost.com/lofiversio ... /t765.html

The BoostC compiler used with Flowcode V3 does not have this problem.