FC8 and code-offset

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

Moderator: Benj

Post Reply
User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

FC8 and code-offset

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

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: FC8 and code-offset

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

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: FC8 and code-offset

Post by faveremario »

Hi Benj

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

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: FC8 and code-offset

Post 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

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: FC8 and code-offset

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

Post Reply