Exact match. Not showing close matches.
PICList
Thread
'[PIC] PIC16F916 Error [474] compiling assembler f'
2012\04\07@165320
by
AdiCH
|
I try to compile the assembler example from the
"HI-TECH C® for PIC10/12/16 User’s Guide" page 91.
my file main.c
// declare the assembly routine so it can be correctly called
extern unsigned int add(unsigned a, unsigned b);
void main(void) {
int a, result;
a = 8;
result = add(5, a); // call the assembly routine
}
assembler file (AddValue.as):
#include <aspic.h>
GLOBAL _add,?_add ; make _add globally accessible
SIGNAT _add,8298 ; tell the linker how it should be called
FNSIZE _add,0,4 ; this required 4 bytes of params; no autos
; everything following will be placed into the mytext psect
PSECT mytext,local,class=CODE,delta=2
; our routine to add to ints and return the result
_add:
; params are loaded by the calling function;
; we access them here using the special symbol
BANKSEL (?_add) ; select the bank of this object
MOVF BANKMASK(?_add+2),w ; take the LSB of the second param
ADDWF BANKMASK(?_add),f ; add to the LSB of the first param
BTFSC STATUS,0 ; check for carry
INCF BANKMASK(?_add+1),f ; handle carry
MOVF BANKMASK(?_add+3),w ; take the MSB of the second param
ADDWF BANKMASK(?_add+1),f ; add to the MSB of the first param
; the result is already in the required location so we can
; just return
RETURN
If I compile this with the MPLAP IDE V8.84 for the PIC16F916 I get the
error:
Error [474] ; 0. no psect specified for function variable/argument
allocation
Is something wrong with the definition of PSECT or what else do I have to
change?
thanks
Adrian
--
View this message in context: old.nabble.com/PIC16F916--Error--474--compiling-assembler-function-tp33579510p33579510.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.
2012\04\10@022812
by
Wouter van Ooijen
> PSECT mytext,local,class=CODE,delta=2
I use
PSECT text0,local,class=CODE,delta=2
--
Wouter van Ooijen
-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu
C++ on uC blog: http://www.voti.nl/erblog
More... (looser matching)
- Last day of these posts
- In 2012
, 2013 only
- Today
- New search...