Page 1 of 1

compiler / linker failure in asm block

Posted: Mon Jan 17, 2011 11:08 am
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

Re: compiler / linker failure in asm block

Posted: Mon Jan 17, 2011 1:06 pm
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;
}

Re: compiler / linker failure in asm block

Posted: Mon Jan 17, 2011 1:43 pm
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

Re: compiler / linker failure in asm block

Posted: Mon Jan 17, 2011 2:41 pm
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 ;
}