Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#922 pic16_popGet: assertion failed

closed-fixed
5
2014-08-17
2005-05-15
Matt Anderson
No

I am trying to port some source from a microchip
application notw from their C compiler to sdcc to use
the CAN transciever on the pic18f258. I almost have it
compiling except I have run into a compiler error. Full
source is attached in the tar.bz2 file, you can
reproduce two problems as follows.

1. syntax error on CANCON, although the exact same line
is used many times earlier in the source

$ sdcc -mpic16 -p18f258 can18xx8.c
Processor: 18f258

can18xx8.c:636: syntax error: token -> 'CANCON' ; column 10
can18xx8.c:638: error 103: code not generated for
'CANSendMessage' due to previous errors
can18xx8.c:764: error 103: code not generated for
'CANReceiveMessage' due to previous errors

2. assertion failed if the inline asm block is removed.
I was unsure if this problem was caused by the _asm
block or not, as to be honest I have not reviewed how
to use inline asm properly in sdcc, so to see if it
would compile, I try to remove the lines,

#if defined(MCHP_C18)
_asm
bsf RXB0CON, 3, 0
_endasm
#endif
#if defined(HITECH_C18)
asm("bsf _RXB0CON,3");
#endif

starting at line 623, then:

$ sdcc -mpic16 -p18f258 can18xx8.c
Processor: 18f258
sdcc: gen.c:2068: pic16_popGet: Assertion `aop &&
aop->aopu.aop_reg[offset] != ((void *)0)' failed.
Caught signal 6: SIGABRT

Wheather this code can properly drive the CAN
tranciever or not I am not sure, but the compiler
should not abort without this asm block.

I am running the latest sdcc from cvs today,
$ sdcc -v
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.0 #1020 (May 15 2005) (UNIX)

If you need any further information, please do not
hesitate to contact me, mda2376@rit.edu.

Thanks.

Discussion

  • Matt Anderson
    Matt Anderson
    2005-05-16

    Logged In: YES
    user_id=629780

    tar.bz2 aparently didnt make it. trying to upload again.

     
  • Matt Anderson
    Matt Anderson
    2005-05-16

    full source to demonstrate problem

     
    Attachments
  • Raphael Neider
    Raphael Neider
    2005-05-16

    • milestone: --> fixed
    • assigned_to: nobody --> tecodev
    • status: open --> closed-fixed
     
  • Raphael Neider
    Raphael Neider
    2005-05-16

    Logged In: YES
    user_id=1115835

    (1) _asm
    bsf RXB0CON, 3, 0
    _endasm

    needs a trailing semicolon and must refernce _RXB0CON,
    correct code:
    _asm
    bsf _RXB0CON, 3, 0
    _endasm;

    (2) fixed in SDCC 2.5.1 #1027