Page 1 of 1

FC8 and code-offset

Posted: Thu Oct 25, 2018 9:46 am
by faveremario
Hi all
I tried in FC8 to make a HEX with a code offset of 0x1000 (used for a bootloader), using the parameter in the compiler options:

--CODEOFFSET=0x1000

No errors where produced, but the generated code in the hex-file started at 0x0000.
FC7 does the job perfectly...

Anybody knows why?
Many thanks.

Re: FC8 and code-offset

Posted: Thu Oct 25, 2018 10:33 am
by Benj
Hello,

V7 and V8 use the same compiler so both should work fine with this mod.

Does the --CODEOFFSET appear in the call to the compiler in the compiler messages window? Maybe there was a problem setting the default compiler option?

Re: FC8 and code-offset

Posted: Thu Oct 25, 2018 12:18 pm
by faveremario
Hi Benj

Yes I see the parameter figuring in the outpout-window.

Re: FC8 and code-offset

Posted: Thu Oct 25, 2018 10:22 pm
by Benj
Thanks I'll look into the problem for you and see if I can replicate here.

If you have v7 installed on the same machine then you can try pointing v8 to the location of the v7 compiler. v7 is running an earlier version of xc8 I believe but should still be fully compatible with v8. In any case this could point to a bug in the current compiler version. You can also install the latest xc8 compiler separately if you wish to have the very latest version.

Saying this it could be your syntax is slightly wrong, here is the command for our bootloader based devices. Note the hexadecimal notation is different. This could just be a red herring if the code you suggested worked fine in v7.

--CODEOFFSET=800h

Re: FC8 and code-offset

Posted: Fri Oct 26, 2018 6:32 am
by faveremario
Hi Benj, many thanks to your efforts. I will sure try to use the FC7 compiler since it is also installed.
The syntax should be OK after looking-up the documentation of the XC8.
The bootloader I use is a little bigger (I use the microchip one), so my code needs to start on 0x1000 (1000h is also accepted as command parameter).

Update: I replaced in FC8 the compiler options as follows:
FC8 :
  • $(compilerpic)batch\pic_xc8_comp.bat
    $(chip) "$(outdir)" "$(target)" --codeoffset=0x1000
with the ones I slightly modified from FC7:
  • C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe (in stead of $(appdir)compilers\pic\bin\xc8.exe)
    --chip=$(chip) "$(target).c" --MSGDISABLE=359,1273,1388 --codeoffset=0x1000
That worked and produced a correct code-offset.

When I changed the compilersettings to the XC8-compiler (that comes with FC8) without using the batch-file:
  • C:\Program Files (x86)\Flowcode\Common\Compilers\pic\bin\xc8.exe
    --chip=$(chip) "$(target).c" --MSGDISABLE=359,1273,1388 --codeoffset=0x1000
That worked also and produced a correct code-offset.

So I took a look into the batch-file used in FC8 (C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch) and found the solution.
First step, adding the possibility for my 4th parameter to pass to the compiler (the red-bold text):
  • @REM $(chip) "$(outdir)" "$(target)"
    @PUSHD %~2
    %~dp0..\bin\xc8.exe --chip=%~1 "%~3.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32 %~4
    @POPD
    @IF %ERRORLEVEL% NEQ 0 GOTO Error
    @ECHO.
    @ECHO Compilation successful!
    @EXIT 0
    :Error
    @ECHO.
    @ECHO Error returned from [xc8.exe]
    @EXIT 1
Second step : using the FC8's original compiler settings, placing my parameter between quotation marks:
  • $(compilerpic)batch\pic_xc8_comp.bat
    $(chip) "$(outdir)" "$(target)" "--codeoffset=0x1000"
I hope this contributed a little :wink: