Is it possible to have two different vector tables loaded in Flash?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to have two different vector tables loaded in Flash?

1,836 Views
Punit
Contributor III

Is it possible to have two different programs or hex files loaded into Flash with two different Vector tables ie in one case it is redirected and in other it is not.

Is it possible to run one program at a time in this situation?

I am talking this in concern to MC9S08JM60 and why I am asking this is because I have bootloader code and application code. One code can run at a time, bootloader doesn't have redirected Vector table and Application have redirected vector table(this is the only way I fugured out)

Labels (1)
0 Kudos
Reply
6 Replies

1,316 Views
tonyp
Senior Contributor II
0 Kudos
Reply

1,316 Views
Punit
Contributor III

Thanks for yor response. If I was not clear about the intention of my question, here it is.

 

I have a bootloader program which I put into Flash through programmer and then this program loades my application through USB cable into Flah. I could have tried following:

 

1) Bootloader code: Let the vector table be at default place

Application code: Redirect vector table

Issue: NVOPT_INIT  and NVPROT_INIT couldn't be re-written in Application and hence conflict.

 

2) Bootloader code: Redirect Vectors and protect this area to be erased as this contains USB interrupt.

Application code: Can not write Vecor table as it is protected.

Issue: the address of functions where vectors point is different so again application fails.

 

Thats why I need to figure out a way where single Vector table could be shared by Bootloader code and Application code or something else.

I would really appereciate any suggestion in this regard.

 

 

To add here, if I try to put my any of the Interrupt vector in different location (in bootloader), my bootloader fails.

 

0 Kudos
Reply

1,316 Views
tonyp
Senior Contributor II

Although I believe the links I gave are relevant to your situation, you can also try the simplest method of all, use a RAM vector table.  Both your bootloader and app will initialize the table according to their needs, and the hard vectors will always point to the RAM vector table.  The RAM vector table must be in form: JMP $nnnn (3 bytes for each entry).  Will this work for you?

0 Kudos
Reply

1,316 Views
Punit
Contributor III

Well, what seems to me is none of my code works if I try to assign different address other then 0xDFC4 (Vector redirection) or 0xFFC4(vector default location). The processor expert's Bean also give sme warning "The default location for vector location is 0xDFC4(or 0xFFC4)" whenever I change there.

 

So, it seems I can not change there location.  I am only concerned with USB interrupt in Bootloader code. If I tried to say:

void (* near const _vectUSB[])(void) @0xFFFC = { /* Interrupt vector table */
        USB_Interrupt                    /* Int.no.  0 Vreset (at FFFE)                Reset vector */
};

 

Bootloader didn't work.

0 Kudos
Reply

1,316 Views
tonyp
Senior Contributor II

Although this has become a CW issue (and I'm the least qualified to talk about it as I never use it), it seems you're trying to redefine the location of the vector as for vector redirection, but not where the vector points.  These two are different things.  What I said, was to make the actual vector (at the default location) POINT TO a RAM vector (with JMP $nnnn).  From this point on, I'll leave it to someone else, CW is not my territory.

0 Kudos
Reply

1,316 Views
Punit
Contributor III

I think I understand what you mean.

 

I will try doing so.

 

Thanks

0 Kudos
Reply