Page 1 of 1

Code Offset bug ?

Posted: Sun Mar 01, 2015 9:02 pm
by faveremario
Hi all,

I wrot a small FC6 program (for PIC18f2455) using the linker directive : -rb 0x1000 (for using with the µchip HID bootloader)
When I look at the code, I see that it starts @ 0x800 in stead of 0x1000 !

In attachement the HEX-file.
ANy suggestions are welcome...

I'm using FC6.1.1.0


greetz

Re: Code Offset bug ?

Posted: Sun Mar 01, 2015 11:02 pm
by kersing
It would be better if you posted your flowchart and export of the compiler and linker settings for us to look at.

Re: Code Offset bug ?

Posted: Mon Mar 02, 2015 12:56 pm
by LeighM
The hex file attached looks like it does start at 0x1000, to me

Re: Code Offset bug ?

Posted: Mon Mar 02, 2015 1:13 pm
by Benj
Yes I agree with Leigh, All memory locations before address 0x1000 are NOPs.
SSMem.jpg
SSMem.jpg (98.07 KiB) Viewed 3950 times


I used MPLAB to get this program memory listing from your hex file.

Re: Code Offset bug ?

Posted: Mon Mar 02, 2015 5:49 pm
by faveremario
Hi all

Now today I found 'a solution' and why i tought the code-offset was wrong.
I opened the hex with notepad & saw the code started at 0x1000, so my first impression was wrong.

I was mislead by the way the HID-bootloader functions : when in bootloader is initiated (a button must be pressed while initiating) & connected to the PC, 2 led’s are alternatedly blinking.
After the programming, we reset the PIC without pressing the ‘bootloader’-button so the user-program is starting to run.
But this did not happen…. The bootloader sequence was entered. This is generaly a sign that the user-program has not been transferred into the PIC (very often related to code-offset mismatch).

The FC6 did simply set-up a USB serial communication with the PC, sending a counter-value every 1sec.

Solution : I must deconnect the USB-cable, then reset the PIC. The user-program is now starting to run (bootloader is skipped) then reconnect the USB-cable.
I have not the smallest idea why the usb-cable may not stay connected when resetting the PIC….