I am finding an annoying feature of the reset vector
for the pic16 architecture in the latest sdcc build.
I am using the 2.5.0 with the
sdcc -v gives:
2.5.1 #1031 (May 22 2005) (UNIX)
there are 3 points:
1. simply declare main as interrupt 0 :
void main(void) interrupt 0
- problem: although the goto is used (in the asm)(thus
allowing interrupt vector at 00008) it saves the wreg,
bsr etc as the first instructions in the asm file (when
the chip has just switch on), why???. If using the
shadow regs keyword this only removes some of the
problem - some reg's are still saved. (main also ends
with a RETFIE - no need)
2. declaring the function as '_naked' stops the saving
of the regs but removes the 'goto' thereby writing main
code over the ISR at 00008. - in an earlier version :
0.0.0 #959 (Feb 13 2005) (UNIX)
this dosnt happen (the goto appears with the _naked
3. I have worked around this by using some inline asm,
the chip _seems_ to run ok (but it may be executing the
isr on start, i havnt checked):
void main(void) interrupt 0 _naked
I renamed my original main to (mainloop) and made that
It just seems strange that this problem didnt exist in
the earleir version.
It's of course possible that I have missed something
basic here, please let me know and thanks for your
time. Your SDCC compiler is a commendable undertaking
and I have been using it for part of my third year
degree project developing an ultrasonic and bump-sensor
interface to a CAN bus.
If you want to see the code, I have attached a tar file.
I thought that would be better than copying and pasting
all the code in here.
richARDg@mail.com << remove the CAPTIALS