Hello all,
I started coding for the MM912H634 Eval Kit and got my software working including the provided Interrupt Vector Table from NXP support (Thank you again for your work!) Now I wanted to port it all to the final hardware which uses a MM912G634 chip. If i try to link the files i get the following error for all my interrupt vectors (from which I only use one):
Link Error : L1907: Fixup overflow in _InterruptVectorTable, to Default_Interrupt type 1, at offset 0x0
This is just the first linbe of the error list, because it is the same error for all the interrupt vectors in the interrupt vector table. Here is my vectors.c file:
#include "derivative.h" /* derivative-specific definitions */
#include "globals.h"
#define TIM0_Interrupt 2
#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void ISRTIMER(void){
if(1u == B_ISR_CH0){
B_TC0 = B_TCNT + 1000;
//PORTA_PA0 = ~PORTA_PA0;
TIMER_1_MS_TICK++;
B_TFLG1_C0F = 1;
}
}
#pragma CODE_SEG DEFAULT
__interrupt void Default_Interrupt(void)
{
asm(BGND);
}
/* ISR prototype @0xFF80U */
typedef void (*near tIsrFunc)(void);
/*lint -save -e950 Disable MISRA rule (1.1) checking. */
const tIsrFunc _InterruptVectorTable[] @0xFF80 = { /* Interrupt vector table */
/*lint -restore Enable MISRA rule (1.1) checking. */
/* ISR name No. Address Name */
&Default_Interrupt, /* 0x40 0xFF80 Vsi */
&Default_Interrupt, /* 0x41 0xFF82 VReserved62 */
&Default_Interrupt, /* 0x42 0xFF84 VReserved61 */
&Default_Interrupt, /* 0x43 0xFF86 VReserved60 */
&Default_Interrupt, /* 0x44 0xFF88 VReserved59 */
&Default_Interrupt, /* 0x45 0xFF8A Vlvi */
&Default_Interrupt, /* 0x46 0xFF8C VReserved57 */
&Default_Interrupt, /* 0x47 0xFF8E VReserved56 */
&Default_Interrupt, /* 0x48 0xFF90 VReserved55 */
&Default_Interrupt, /* 0x49 0xFF92 VReserved54 */
&Default_Interrupt, /* 0x4A 0xFF94 VReserved53 */
&Default_Interrupt, /* 0x4B 0xFF96 VReserved52 */
&Default_Interrupt, /* 0x4C 0xFF98 VReserved51 */
&Default_Interrupt, /* 0x4D 0xFF9A VReserved50 */
&Default_Interrupt, /* 0x4E 0xFF9C VReserved49 */
&Default_Interrupt, /* 0x4F 0xFF9E VReserved48 */
&Default_Interrupt, /* 0x50 0xFFA0 VReserved47 */
&Default_Interrupt, /* 0x51 0xFFA2 VReserved46 */
&Default_Interrupt, /* 0x52 0xFFA4 VReserved45 */
&Default_Interrupt, /* 0x53 0xFFA6 VReserved44 */
&Default_Interrupt, /* 0x54 0xFFA8 VReserved43 */
&Default_Interrupt, /* 0x55 0xFFAA VReserved42 */
&Default_Interrupt, /* 0x56 0xFFAC VReserved41 */
&Default_Interrupt, /* 0x57 0xFFAE VReserved40 */
&Default_Interrupt, /* 0x58 0xFFB0 VReserved39 */
&Default_Interrupt, /* 0x59 0xFFB2 VReserved38 */
&Default_Interrupt, /* 0x5A 0xFFB4 VReserved37 */
&Default_Interrupt, /* 0x5B 0xFFB6 VReserved36 */
&Default_Interrupt, /* 0x5C 0xFFB8 Vflash */
&Default_Interrupt, /* 0x5D 0xFFBA Vflashfd */
&Default_Interrupt, /* 0x5E 0xFFBC VReserved33 */
&Default_Interrupt, /* 0x5F 0xFFBE VReserved32 */
&Default_Interrupt, /* 0x60 0xFFC0 VReserved31 */
&Default_Interrupt, /* 0x61 0xFFC2 VReserved30 */
&Default_Interrupt, /* 0x62 0xFFC4 VReserved29 */
&Default_Interrupt, /* 0x63 0xFFC6 Vcpmuplllck */
&Default_Interrupt, /* 0x64 0xFFC8 Vcpmuocsns */
&Default_Interrupt, /* 0x65 0xFFCA VReserved26 */
&Default_Interrupt, /* 0x66 0xFFCC VReserved25 */
&Default_Interrupt, /* 0x67 0xFFCE VReserved24 */
&Default_Interrupt, /* 0x68 0xFFD0 VReserved23 */
&Default_Interrupt, /* 0x69 0xFFD2 VReserved22 */
&Default_Interrupt, /* 0x6A 0xFFD4 VReserved21 */
&Default_Interrupt, /* 0x6B 0xFFD6 VReserved20 */
&Default_Interrupt, /* 0x6C 0xFFD8 Vspi */
&Default_Interrupt, /* 0x6D 0xFFDA VReserved18 */
&Default_Interrupt, /* 0x6E 0xFFDC VReserved17 */
&Default_Interrupt, /* 0x6F 0xFFDE VReserved16 */
&Default_Interrupt, /* 0x70 0xFFE0 VReserved15 */
&Default_Interrupt, /* 0x71 0xFFE2 VReserved14 */
&Default_Interrupt, /* 0x72 0xFFE4 VReserved13 */
&Default_Interrupt, /* 0x73 0xFFE6 VReserved12 */
&Default_Interrupt, /* 0x74 0xFFE8 VReserved11 */
&Default_Interrupt, /* 0x75 0xFFEA VReserved10 */
&Default_Interrupt, /* 0x76 0xFFEC VReserved9 */
&Default_Interrupt, /* 0x77 0xFFEE VReserved8 */
&Default_Interrupt, /* 0x78 0xFFF0 Vrti */
&ISRTIMER, /* 0x79 0xFFF2 Vd2di_ext */
&Default_Interrupt, /* 0x7A 0xFFF4 Vd2di_err */
&Default_Interrupt, /* 0x7B 0xFFF6 Vswi */
&Default_Interrupt, /* 0x7C 0xFFF8 Vtrap */
};
And my .prm file looks like this:
/* This is a linker parameter file for the MM912G634xx1xx */
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
/* Register space */
/* IO_SEG = PAGED 0x0000 TO 0x03FF; intentionally not defined */
/* RAM */
RAM = READ_WRITE 0x3800 TO 0x3FFF;
/* D-Flash */
DFLASH = READ_ONLY 0x0400 TO 0x0BFF;
/* non-paged FLASHs */
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xFEFF;
//VECTORS = READ_ONLY 0xFF00 TO 0xFFFF; /* intentionally not defined: used for VECTOR commands below */
//OSVECTORS = READ_ONLY 0xFF80 TO 0xFFFF; /* OSEK interrupt vectors (use your vector.o) */
/* paged FLASH: 0x8000 TO 0xBFFF; addressed through PPAGE */
PAGE_0E = READ_ONLY 0x0E8000 TO 0x0EBFFF;
/* PAGE_0D = READ_ONLY 0x0D8000 TO 0x0DBFFF; not used: equivalent to ROM_4000 */
/* PAGE_0F = READ_ONLY 0x0F8000 TO 0x0FBEFF; not used: equivalent to ROM_C000 */
END
PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
_PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
//.ostext, /* OSEK */
NON_BANKED, /* runtime routines which must not be banked */
COPY /* copy down information: how to initialize variables */
/* in case you want to use ROM_4000 here as well, make sure
that all files (incl. library files) are compiled with the
option: -OnB=b */
INTO ROM_C000/*, ROM_4000*/;
DEFAULT_ROM INTO PAGE_0E;
//VECTORS INTO ROM_4000;
//.stackstart, /* eventually used for OSEK kernel awareness: Main-Stack Start */
SSTACK, /* allocate stack first to avoid overwriting variables on overflow */
//.stackend, /* eventually used for OSEK kernel awareness: Main-Stack End */
DEFAULT_RAM INTO RAM;
//.vectors INTO OSVECTORS; /* OSEK */
END
ENTRIES /* keep the following unreferenced variables */
_InterruptVectorTable;
//VECTORS_vect;
/* OSEK: always allocate the vector table and all dependent objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
END
STACKSIZE 0x100
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialization entry point */
Can somebody please help me to figure out, why it won't work on the MM912G634? I compiled the same code and programmed it onto the MM912H634 Eval board and everything works perfect.
I work with CW v5.1 and PE micro USB Multilink Interface with the CW debugger.
Greetings and thanks in advance.
Ralph
Hi Ralph,
Your prm linker file uses PAGE_0E as default ROM memory.
Since the S12 core uses 16bit vectors, the interrupt routines have to be placed in non-banked memory – all of them.
Please just move linker command #pragma CODE_SEG DEFAULT several lines down, that Default_Interrupt will be also placed in non-banked memory.
This should help you. If not, please let me know.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Radek,
your solution did not work completely. I can now compile and link all the files, but if I try to program the HW there commes up thiserror message:
I think there is still something wrong with the memory mapping?
Greetings
Ralph
Hi Ralph,
Oh yes, I forgot at one point.
The default MM912G634 project uses small memory model (all 48kB flash may fit into default 64kB address space).
When you want to use paged memory as in the MM912H634 case, you should choose banked memory model.
Please, open project settings (Alt+F7) – Compiler for HC12 – and change “-Ms” argument to “-Mb”.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Radek,
I already had this option in my compiler command line arguments:
-CpuHCS12 -DPPAGE_ADDR=0x15 -Mb -Cf
Are the other arguments ok? I will try to set up a blank project with nothing else than the interrupt vector table to see if I get it working.
Right now i still get the following Error:
Greetings
Ralph
EDIT:
Even with a comletely empty project (except of vectors.c) i get this error:
I don't know what else to do. Can you provide an example project that actually works on the MM912G634 including the mentioned Interrupt Vector table? I can send you th whole (empty) project if that helps.
If it helps you here is the Command output of the Hiwave debugger:
executing C_layout.hwl
!OPEN source 0 0 60 39
NO CONNECTION
!Source < attributes MARKS off
!OPEN assembly 60 0 40 31
!Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,TOPPC 0xF88C
!OPEN procedure 0 39 60 17
!Procedure < attributes VALUES on,TYPES off
!OPEN register 60 31 40 25
!Register < attributes FORMAT AUTO,COMPLEMENT None
!OPEN memory 60 56 40 22
!Memory < attributes FORMAT hex,COMPLEMENT None,WORD 1,ASC on,ADR on,ADDRESS 0x80
!OPEN data 0 56 60 22
!Data:1 < attributes SCOPE global,COMPLEMENT None,FORMAT Symb,MODE automatic,UPDATERATE 10,NAMEWIDTH 16
!OPEN data 0 78 60 22
!Data:2 < attributes SCOPE local,COMPLEMENT None,FORMAT Symb,MODE automatic,UPDATERATE 10,NAMEWIDTH 16
!OPEN command 60 78 40 22
!Command < attributes CACHESIZE 1000
!bckcolor 50331647
!font 'Courier New' 9 BLACK
!AUTOSIZE on
!ACTIVATE Data:2 Command Procedure Data:1 Source Register Assembly Memory
done C_layout.hwl
Loading Target ...
IO registers loaded for MM912G634xx1xx from C:\Program Files (x86)\Freescale\CWS12v5.1\prog\REG\MCU01E1.REG
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_USB_startup.cmd
!// At startup the commands written below will be executed
Target Ready
done .\cmd\P&E_Multilink_USB_startup.cmd
Startup command file correctly executed.
executing .\cmd\P&E_Multilink_USB_preload.cmd
!// Before load the commands written below will be executed
done .\cmd\P&E_Multilink_USB_preload.cmd
Preload command file correctly executed.
FP: FLASH parameters loaded for MC9S12G634xx1xx_V0_5(NVMIF2 rev 4,4,4) from C:\Program Files (x86)\Freescale\CWS12v5.1\prog\FPP\mcu01E1.fpp
executing .\cmd\P&E_Multilink_USB_reset.cmd
!// After reset the commands written below will be executed
done .\cmd\P&E_Multilink_USB_reset.cmd
Reset command file correctly executed.
Block Module Name Address Range Status
0 DFLASH 400 - BFF Blank - Unselected
1 PFLASH 4000 - FFFF Blank - Unselected
2 PFLASH FFFFFF -1FFFFFD Skipped - Unselected
FP: The UNPROTECT command is not available for the DFLASH flash module => Skipped.
FP: The UNPROTECT command is not available for the PFLASH flash module => Skipped.
FP: Operation failed on PFLASH flash module.
Block Module Name Address Range Status
0 DFLASH 400 - BFF Blank - Selected
1 PFLASH 4000 - FFFF Blank - Selected
2 PFLASH D8000 -2CBFFF Programmed - Selected
executing .\cmd\P&E_Multilink_USB_vppon.cmd
!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_USB_vppon.cmd
Vppon command file correctly executed.
FP: Operation failed on DFLASH flash module.
FP: No programming voltage
FP: No programming voltage
executing .\cmd\P&E_Multilink_USB_vppoff.cmd
!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_USB_vppoff.cmd
Vppoff command file correctly executed.
FP: Arm FLASH for loading.
executing .\cmd\P&E_Multilink_USB_vppon.cmd
!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_USB_vppon.cmd
Vppon command file correctly executed.
executing .\cmd\P&E_Multilink_USB_vppoff.cmd
!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_USB_vppoff.cmd
Vppoff command file correctly executed.
FP: FLASH disarmed.
executing .\cmd\P&E_Multilink_USB_reset.cmd
!// After reset the commands written below will be executed
done .\cmd\P&E_Multilink_USB_reset.cmd
Reset command file correctly executed.
executing .\cmd\P&E_Multilink_USB_postload.cmd
!// After load the commands written below will be executed
RESET
done .\cmd\P&E_Multilink_USB_postload.cmd
Postload command file correctly executed.
in>
Hello all,
we finally found the problem. In a different thread Radek Sestak mentioned the following:
Please check if you have at least 8V at TCK pin (44). This disable internal watchdog – it is necessary during loading software and debugging.
So after checking every line of code and every single memory location multiple times it just was a hardware fault. The TCLK pin was held on 5 V and that, as mentioned above, didnt work.
THank you all for your support!
Greetings Ralph
Hi Ralph,
You are welcome.
I am glad that the problem was resolved.
In fact, I already forget on that potential issue with watchdog at analog die – It is already some time when I meet with that last time. Now it is clear. Thank you for the reminder.
Have a great day,
Radek