MC9S12G128 bootloader remapping the interrupt vector table

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MC9S12G128 bootloader remapping the interrupt vector table

跳至解决方案
1,293 次查看
920065012
Contributor II

I design the bootloader for 9S12G128 ,I need to remapping the interrupt vector table from 0xFF80-0xFFFF, I make some code like that(under words),the code can not work, when I reset ,the code can not enter into the main ();  Is there where I need to set up?

#define __CPU_VECTOR_BASE_ADDR__ 0x7F80
/* ISR prototype */
typedef void (*near tIsrFunc)(void) ;
/*lint -save -e950 Disable MISRA rule (1.1) checking. */

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt void UnimplementedISR(void) //定义在NON_BANKED区
{}
void interrupt T0_inter(void)
{}
void interrupt T2_inter(void)
{}
void interrupt CAN_receive(void)
{}

#pragma CODE_SEG DEFAULT

static const tIsrFunc _InterruptVectorTable[] @__CPU_VECTOR_BASE_ADDR__ = {
/* Interrupt vector table */
/*put your ISR functions list here according to the interrupt vector order*/
&UnimplementedISR, /* vector 63 */
&UnimplementedISR, /* vector 62 */
&UnimplementedISR, /* vector 61 */
&UnimplementedISR, /* vector 60 */
&UnimplementedISR, /* vector 59 */
&UnimplementedISR, /* vector 58 */
&UnimplementedISR, /* vector 57 */
&UnimplementedISR, /* vector 56 */
&UnimplementedISR, /* vector 55 */
&UnimplementedISR, /* vector 54 */
&UnimplementedISR, /* vector 53 */
&UnimplementedISR, /* vector 52 */
&UnimplementedISR, /* vector 51 */
&UnimplementedISR, /* vector 50 */
&UnimplementedISR, /* vector 49 */
&UnimplementedISR, /* vector 48 */
&UnimplementedISR, /* vector 47 */
&UnimplementedISR, /* vector 46 */
&UnimplementedISR, /* vector 45 */
&UnimplementedISR, /* vector 44 */
&UnimplementedISR, /* vector 43 */
&UnimplementedISR, /* vector 42 */
&UnimplementedISR, /* vector 41 */
&UnimplementedISR, /* vector 40 */
&UnimplementedISR, /* vector 39 */
&CAN_receive, /* vector 38 */
&UnimplementedISR, /* vector 37 */
&UnimplementedISR, /* vector 36 */
&UnimplementedISR, /* vector 35 */
&UnimplementedISR, /* vector 34 */
&UnimplementedISR, /* vector 33 */
&UnimplementedISR, /* vector 32 */
&UnimplementedISR, /* vector 31 */
&UnimplementedISR, /* vector 30 */
&UnimplementedISR, /* vector 29 */
&UnimplementedISR, /* vector 28 */
&UnimplementedISR, /* vector 27 */
&UnimplementedISR, /* vector 26 */
&UnimplementedISR, /* vector 25 */
&UnimplementedISR, /* vector 24 */
&UnimplementedISR, /* vector 23 */
&UnimplementedISR, /* vector 22 */
&UnimplementedISR, /* vector 21 */
&UnimplementedISR, /* vector 20 */
&UnimplementedISR, /* vector 19 */
&UnimplementedISR, /* vector 18 */
&UnimplementedISR, /* vector 17 */
&UnimplementedISR, /* vector 16 */
&UnimplementedISR, /* vector 15 */
&UnimplementedISR, /* vector 14 */
&UnimplementedISR, /* vector 13 */
&UnimplementedISR, /* vector 12 */
&UnimplementedISR, /* vector 11 */
&T2_inter, /* vector 10 */
&UnimplementedISR, /* vector 09 */
&T0_inter, /* vector 08 */
&UnimplementedISR, /* vector 07 */
&UnimplementedISR, /* vector 06 */
&UnimplementedISR, /* vector 05 */
&UnimplementedISR, /* vector 04 */
&UnimplementedISR, /* vector 03 */
&UnimplementedISR, /* vector 02 */
&UnimplementedISR, /* vector 01 */
&UnimplementedISR, /* Reset vector */

};

void main(void)
{  IVBR = 0x7F;
//set the vector base

}

Is there where I need to set up?

0 项奖励
回复
1 解答
1,103 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

It seems to be correct.

The attached example works on my side. 

So please try it.

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,104 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

It seems to be correct.

The attached example works on my side. 

So please try it.

Regards,

Daniel

0 项奖励
回复
1,103 次查看
920065012
Contributor II

Hi,

     Thank you for your help,  I solve the problem.

Regards,

Joy

0 项奖励
回复
1,103 次查看
920065012
Contributor II

Hi,thank you for your help.There are still have some problems.

I open your example,I notice that you use" P&E USB BDM muitilink", I use "TBDML " download the program to MC9S12G128,But it can not works.What's wrong with it?Did you change the file,such as"project.prm" and"start12.c".

pastedImage_1.png

if MC9S12G128 connected  with CW software,when I use the resert button in CW software,it can do well.

pastedImage_3.png

but,if I use buton in hardware reset ,it can't work,like that: 

pastedImage_2.png

Regards,

Joy

0 项奖励
回复