compiler/linker error

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
keesp
Posts: 17
Joined: Wed Sep 22, 2010 11:53 am
Contact:

compiler/linker error

Post by keesp »

I and one of my students are facing a compiler linker error when trying to use an Assembler macro in Flowcode 4 for PIC. Both of us are running Windows 7,`and using a 16F88a PIC.
The block that we are trying to run is the following:

asm
{
BSF _status, RP0 ;
MOVLW 0x0 ;
MOVWF _trisa ;
BCF _status, RP0 ;
MOVLW 0x30 ;
MOVWF 0x20 ;

SWAPF 0x20,1 ;
MOVF 0x20,0 ;
MOVWF _porta ;
}

When we try to run this, we get the following error:

D:\Archief\projects\Dirksen\pmc\koldewijn\ASM Les 4.c(91): error: error in built-in assembly
D:\Archief\projects\Dirksen\pmc\koldewijn\ASM Les 4.c(93): error: error in built-in assembly
D:\Archief\projects\Dirksen\pmc\koldewijn\ASM Les 4.c(94): error: error in built-in assembly
ASM Les 4.c success

failure

Return code = 1

Flowcode kan de C-code niet vertalen vanwege de volgende fout:

Als de flowchart C-code bevat, controleer die dan zorgvuldig. Als de flowchart geen C-code bevat of als die gegarandeerd vrij is van fouten, neem dan contact op met de technische ondersteuning.

FINISHED

Translated to English, I would get the idea that compiler works ok (this is confirmed when only C-code is generated), but that something goes wrong afterwards.

The tow messages trnaslate to:

Flowcode cannot translate the c-Code due to the following error:

If the flowchart contains C-code, then please check this carefully. If the flowchart does not contain C-Code, or is guaranteed error free, please contact the helpdesk.


Any ideas?

Thanks

Kees

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: compiler/linker error

Post by Benj »

Hello,

The compiler is giving an error because it doesn't seem to like the way you were referencing the memory address.

I have changed the code to dynamically provide a memory address and this is working correctly.

Code: Select all

char temp;

asm
{
BSF _status, RP0 ;
MOVLW 0x0 ;
MOVWF _trisa ;
BCF _status, RP0 ;
MOVLW 0x30 ;
MOVWF _temp ;

SWAPF _temp,1 ;
MOVF _temp,0 ;
MOVWF _porta ;
}

keesp
Posts: 17
Joined: Wed Sep 22, 2010 11:53 am
Contact:

Re: compiler/linker error

Post by keesp »

Thanks Ben!

Is this a workaround, or was the code wrong in the first place?

Thanks

Kees

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: compiler/linker error

Post by Benj »

Hello,

The code looked ok and all I did was to replace your fixed memory address of 0x20 and swap it with the reference to the char C variable. You should be able to use fixed memory locations with the standard MPASM assembler but maybe BoostC does not like this as you could very easily start corrupting C variables.

Post Reply