compiler / linker failure in asm block

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 failure in asm block

Post by keesp »

Hi,

I am getting the error reported below when trying to compile the following asm-block in flowcode:

char temp;

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

//MOVWF 0x20;
MOVLW 0x20 ;
MOVWF _temp ;
SWAPF _temp,1 ;
MOVF _temp,0 ;

MOVLW 0x01;
SUBWF 0x20,1 ;
MOVF 0x20,0;
MOVWF _trisa;
}

The Dutch messages do not give any interesting information related to the error, so I will not translate them.

Any help would be greatly appreciated.

Regards,

Kees
http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F88 "767-07.2-14.c"

.......................

BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited


767-07.2-14.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\pp.exe D:\Archief\projects\Dirksen\pmc\tests\767-07.2-14.c -i C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\include -d _PIC16F88 -la -c2 -o D:\Archief\projects\Dirksen\pmc\tests\767-07.2-14.pp -v -d _BOOSTC -d _PIC16


......................................................................................................................................................................

D:\Archief\projects\Dirksen\pmc\tests\767-07.2-14.c(95): error: error in built-in assembly
D:\Archief\projects\Dirksen\pmc\tests\767-07.2-14.c(96): error: error in built-in assembly
767-07.2-14.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

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 failure in asm block

Post by Benj »

Hello,

I have added another C variable to take the place of memory location 0x20 and the code is compiling ok now.

Code: Select all

char temp;
char temp2;

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

//MOVWF 0x20;
MOVLW 0x20 ;
MOVWF _temp ;
SWAPF _temp,1 ;
MOVF _temp,0 ;

MOVLW 0x01;
SUBWF _temp2,1 ;
MOVF _temp2,0;
MOVWF _trisa;
}

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

Re: compiler / linker failure in asm block

Post by keesp »

Hi Ben,

thanks again for your quick reply. I suspected it was the same kind of problem as we discussed earlier (http://wwww.matrixmultimedia.com/mmforu ... =29&t=8007)
I have, however, some problems with this, as I am using Flowcode for education, and my students are getting frustrated with this bug. Do you think there is any action at sourceboost (?) to fix this?

Kind regards,

Kees

User avatar
Steve
Matrix Staff
Posts: 3427
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: compiler / linker failure in asm block

Post by Steve »

This is not a bug - it's just the way the inline assembly feature of BoostC works.

If you specifically want to interact with the address 0x20, then you can do something similar to this:

Code: Select all

char var@0x20;

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

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

Post Reply