Microchip Bootloader - code and interrupt remapping

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Microchip Bootloader - code and interrupt remapping

Post by nbremond »

Hello,

For one of my projects using Flowcode v5, I'am using a PIC18F4550 with an USB connection to the computer, and I need to set-up a bootloader to program the code using USB, without any programmer.

The PIC18F4550 board has a 20MHz quartz, an USB connector, and a push button (active low) connected to RB.4.
I have successfully build and programmed the microchip bootloade. Here are the step I had to follow (given for reference):
- Download and run "microchip-application-libraries-v2012-04-03-windows-installer.exe" from the Microchip website
- Install the USB windows driver "mchpusb.inf"
- Install the windows software to program the target : "Pdfsusb"
- Build the bootloader "MCHPUSB Bootloader PIC18F4550 Family", using MPLAB 8.xx, and the full (eval, OK for 60 days) version of the C18 compiler (the linker step fails with the limited/student version :-( !!!)
- Program the bootloader with my PicKit 3

So far so good, I'am able to program a .HEX code into my microcontroller. To do this, I need to hold donw the push button (RB.4) while the uC is going out of reset.

But, for th code I program to execute correctly, I need:
- To remap the code to 0x0800: To do this I have added "-rb 0x800" to the options of the linker (menu Build/Compiler Options/Linker)
- To remap the interrupt vectors.

And here is my question: How to perform this remapping ?
I have found the following in the forum, but I don't know where to set this up (I do not want to have to hand modify the generated code...):

RESET_VECTOR = 0x000800
HIGH_INTERRUPT_VECTOR = 0x000808
LOW_INTERRUPT_VECTOR = 0x000818

#pragma code reset_vector=0x0800
void _reset (void)
{
_asm GOTO main _endasm
}

Thanks in advance for your help,
Best regards,
Bernard

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: Microchip Bootloader - code and interrupt remapping

Post by Benj »

Hi Bernard,

All you need to do in the Flowcode program is to remap the linker to 0x800 using the -rb switch. The interrupt vectors should automatically be correct if the bootloader has set them up correctly. We use a similar bootloader for ECIO and MIAC and these work fine with just the linker code shift command.

nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Re: Microchip Bootloader - code and interrupt remapping

Post by nbremond »

Thanks a lot Benj, it works fine.

I just still have an issue with the clock speed settings... the doesn't seems to run at the right speed: for example a delay of 250ms will last 310ms on the real board... Maybee a conflict between the configuration bits managed by flowcode and the configuration bits managed by the bootloader...
Any idea on this ?

Best regards,
Bernard

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: Microchip Bootloader - code and interrupt remapping

Post by Benj »

Hello Bernard,

Please ensure your clock speed in the Flowcode project option window is set to 48000000. You should probably leave the config setting unticked.

I have moved this topic to the v5 section for you. Please ensure you sign up for this v5 topic and post your v5 related questions there.

Details can be found here.
http://www.matrixmultimedia.com/mmforum ... =46&t=9958

nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Re: Microchip Bootloader - code and interrupt remapping

Post by nbremond »

Thanks.

Post Reply