I use SRecCvt to align my s19 file. I’ve always aligned the .phy file from codewarrior and I couldn’t find my interrupt addresses in the out.s19 file from SRecCvt when I aligned the .phy file. So I tried to align the s19 file generated by codewarrior and I get the following warning in oc-console:

20>l

loading …

*******************

Write error at BFC0

20>FFFFFFFFFFFFFFFC01536

Argument missing!

20>FFFFFFFFFFFFFFFFC0003B

Argument missing!

20>

My main program is still working but when I call my interrupt by switching input port H pin 0 the MCU stops running and nothing happens.

I use the SRecCvt GUI and my settings are:

Device = MC9S12Dx512

Memory = flash

Operation = convert

Output File Format = linear

S-record Size = 16

I don’t know what causes this problem.

What kind of s19 file is TwinPeeks expecting and how do I get the right file?

I think I’ve found a explanation of the error that occur in oc-console. I found this piece of text in the HCS12 manual.

Redirected Interrupt Vectors

The interrupt vectors of the HCS12 are located at the end of the

64KB memory address range, which falls within the protected monitor code space. Therefore, the application program can not modify the interrupt vectors directly. To provide an alternative way, the monitor redirects all vectors (except the reset vector) to RAM. The procedure is similar to how the HC11 behaved in Special Bootstrap Mode.

The application program can set the required interrupt vectors during runtime (before global interrupt enable!) by placing a jump instruction into the RAM pseudo vector. The following example shows the steps to utilizy the IRQ interrupt:

For a C program, the following sequence could be used:

// install IRQ pseudo vector in RAM

// (if running with TwinPEEKs monitor)

*((unsigned char *)0x3fee) = 0x06; // JMP opcode

*((void (**)(void))0x3fef) = isrFunc;

I implemented the C – code of this example in my main.c but it didn’t compile. I think the example code isn’t for codewarrior but for ICC12.

How do I translate it into codewarrior code? Or is there another way to solve this problem?

Using TwinPeeks you don't have to align S-records. *.phy file from CW should be fine.

interrupt 25 void intefunc(void)

Also you should remove interrupt vector number from ISR declaration, since TwinPEEKs has vector area protected and TwinPEEKs won't load anything to write protected areas. Instead of vector number after interrupt keyword, put this code into main() before asm cli or interruptenable