Thanks for sticking with me BK-
From Debug (configurations), which pauses at main(), I see the following initial Debug stack:
MISTER_MC9S08LG32_PnE U-MultiLink [CodeWarrior Download] HCS08, MISTER.abs (Suspended) Thread [ID: 0x0] (Suspended: Signal 'Halt' received. Description: User halted thread.) 3 main() main.c:145 0x8a5b 2 vprintf() printf.c:671 0x9004 1 0x9F95 (0x9F95)() 0x9f95 C:\Users\John\workspace500\MISTER\MC9S08LG32\MISTER.abs (6/10/12 9:24 PM)
I should be at the first statement in main because I did not hit Resume, Step or Run. Please see the attached image.
If I step ahead into chipinit() I see the following stack:
MISTER_MC9S08LG32_PnE U-MultiLink [CodeWarrior Download] HCS08, MISTER.abs (Suspended) Thread [ID: 0x0] (Suspended) 4 chipinit() hardwarecode.c:27 0x846b 3 main() main.c:150 0x8a60 2 vprintf() printf.c:671 0x9004 1 0x9F95 (0x9F95)() 0x9f95 C:\Users\John\workspace500\MISTER\MC9S08LG32\MISTER.abs (6/10/12 9:09 PM)
So it looks like main() is called from vprintf() [please disconfuse me, BK]. I do not know why vprintf() is even in the picture, it is not always there, but as long as it is not Viic_isr() shown in my original post, I am not going to fret.
In the original post it was
MISTER_MC9S08LG32_PnE U-MultiLink [CodeWarrior Download] HCS08, MISTER.abs (Suspended) Thread [ID: 0x0] (Suspended: Signal 'Halt' received. Description: User halted thread.) 4 main() main.c:139 0x8915 3 vprintf() printf.c:548 0x8c96 2 Viic_isr() i2c.c:317 0x87f6 1 0x7F32 (0x7F32)() 0x7f32 C:\Users\John\workspace500\MISTER\MC9S08LG32\MISTER.abs (6/6/12 11:01 PM)
I have some print-statements in my Viic_isr() so Viic_Isr() calling vprintf() makes sense. But main.c:139 is the beginning of the definition of main{ ...}. printf.c:548 is..
#if LIBDEF_PRINTF_PTR if ((sizeof(void*) != sizeof(unsigned int)) && ((flags & _PRINTF_PTR) != 0U)) { /*lint !e506 !e774 !e845 , MISRA 13.7 REQ & MISRA 14.1 REQ, target-dependent Boolean expressions */ /* support for %p for targets with non int pointer sizes */ /*lint -e{506} , MISRA 13.7 REQ & MISRA 14.1 REQ, default data type formats can be changed with the -T option */ /*lint -e{923} , MISRA 11.3 ADV, the cast is necessary, see comment above */ val = (unsigned _PRINTF_INTEG)va_arg(args, void*); } else { /*lint -e{506} , MISRA 13.7 REQ & MISRA 14.1 REQ, default data type formats can be changed with the -T option */ uint_tmp = va_arg(args, unsigned int); <<<<<<<<<<<<<<<<<<<<<line 548 val = (unsigned _PRINTF_INTEG)uint_tmp; }#elseSo, though I do not understand the startup code, it does look like it intends main() to be called from vprintf(). But why Viic_isr() -- I don't undertand enough to continue here. Thanks for your ear.
-Cab-