Bootloader and Program start location help

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

Bootloader and Program start location help

Post 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

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post 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.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

More info needed for Bootloader

Post 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

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post 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.

elecrobot
Posts: 12
Joined: Tue Oct 09, 2007 11:18 pm

Post 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

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

The linker option is in the "compiler options" screen.

elecrobot
Posts: 12
Joined: Tue Oct 09, 2007 11:18 pm

Re: Bootloader and Program start location help

Post 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

elecrobot
Posts: 12
Joined: Tue Oct 09, 2007 11:18 pm

Re: Bootloader and Program start location help

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bootloader and Program start location help

Post 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.

Post Reply