Hello Cram!
I do not understand C Language cause I write my programs in assembly language.
It seems to me that you dont initialize the Interrupt Vectors.
Try to initialize the interrupt Vector Table from 0xFFFE - 0xFFC0. In assembly language that should look like this:
RTC_ISR:
RTI
Vectorstart: EQU $FFC0
;**************************************************************
;* Interrupt Vectors for MC9S08SH8 *
;**************************************************************
ORG Vectorstart
DC.W spurious ; 31 unuset/future used
DC.W spurious ; 30 Vacamp
DC.W spurious ; 29 unuset/future used
DC.W spurious ; 28 unuset/future used
DC.W spurious ; 27 unuset/future used
DC.W spurious ; 26 Vmtim
DC.W RTC_ISR ; 25 Vrtc
DC.W spurious ; 24 Viic
DC.W spurious ; 23 Vadc
DC.W spurious ; 22 unuset/future used
DC.W spurious ; 21 Vportb
DC.W spurious ; 20 Vporta
DC.W spurious ; 19 unuset/future used
DC.W spurious ; 18 Vscitx
DC.W spurious ; 17 Vscirx
DC.W spurious ; 16 Vscierr
DC.W spurious ; 15 Vspi
DC.W spurious ; 14 Vtpm2ovf
DC.W spurious ; 13 Vtpm2ch1
DC.W spurious ; 12 Vtpm2ch0
DC.W spurious ; 11 Vtpm1ovf
DC.W spurious ; 10 unuset/future used
DC.W spurious ; 9 unuset/future used
DC.W spurious ; 8 unuset/future used
DC.W spurious ; 7 unuset/future used
DC.W spurious ; 6 Vtpm1ch1
DC.W spurious ; 5 Vtpm1ch0
DC.W spurious ; 4 unuset/future used
DC.W spurious ; 3 Vlvd
DC.W spurious ; 2 Virq
DC.W spurious ; 1 SWI
DC.W _Startup ; 0 Reset
Regards,
Ingo