I have tested this self-contained .c file successfully with the latest SDCC
(compiled from svn):
$ /media/data/local/sdcc-20141016/bin/sdcc -v
SDCC :
mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8
3.4.1 #9088 (Oct 16 2014) (Linux)
published under GNU General Public License (GPL)
$ /media/data/local/sdcc-20141016/bin/sdcc -mpic14 -p16f628a --use-non-free
main.c
main.asm:90:Message[312] Page or Bank selection not needed for this
device. No code generated.
message: using default linker script
"/home/neider/local/share/gputils/lkr/16f628a_g.lkr"
No banksel problem. What SDCC version do you use (sdcc -v)? It may be that
old that __asm is not yet supported... You may want/need to upgrade.
Hope that helps,
Raphael
BTW: Defining functions (with body) in header files is *not* the way to go
in C. Header files declare interfaces (function prototypes). If you include
that header in multiple .c files in the same project, you will get linker
errors.
BTW2: I recommend to use __at(0x20) with parens so that you can
#define __at(x) /* nothing */
when switching to a different compiler / analysis tool.
Here is my test input -- does not make much sense, but tests most of your
issues:
$ cat main.c
int foo;
struct {
int i;
} dvar;
unsigned __at(0x20) bar;
void cycle_eater(void)
{
__asm banksel _dvar // mumblegrumble
nop
delay_big: movlw 191 // Calibrated for b*764 cycles
movwf _dvar+0 // Load W into reg
delay_inner: nop // To make the inner loop take 4 cycles per
decfsz _dvar+0, 1
goto delay_inner
decfsz _dvar+1, 1
goto delay_big
correction: decfsz _dvar+2, 1
goto correction
__endasm;
}
void main()
{
__asm banksel _foo
__endasm;
}
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user