Leaving VBR in flash

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

Leaving VBR in flash

1,026 Views
FridgeFreezer
Senior Contributor I

Project is MCF52259 / CW7.2

 

Looking at some of the stuff going on in our project, I found myself wondering why we *need* to copy the interrupt vector table to RAM at startup. I know why it's done, but looking through our code I don't see any need to re-write the interrupt vectors - we know the address of every ISR function at compile time, so could simply store it in flash & mask interrupts as required.

 

Is this as simple as re-writing mcf5225x_vectors.s to change:

vectorXX:    .long    _asm_exception_handler

to:

vectorXX:    .long    isr_function_name

?

Labels (1)
0 Kudos
3 Replies

388 Views
CrasyCat
Specialist III

Hello

 

Only reason I can see for that is that it allows you to modify content of the vector table at run time (in the application).

 

CrasyCat

0 Kudos

388 Views
FridgeFreezer
Senior Contributor I

So to answer my question, is this as simple as:

- Removing the memcopy of VBR -> SRAM at startup

- Removing ___VECTOR_RAM data from the LCF

- Rewriting mcf5225x_vectors.s to contain the correct routines

 

Or do I need to change exception/interrupt handler routines etc. in the mcf5xxx / 5225x .c/.h/.s files?

0 Kudos

388 Views
Piotr
Contributor I

Please note that only 12 upper bits of VBR register are implemented, so VBR table must begin on 1M boundary. The flash can be located on 512k boundary, so you must remember that A19 in FLASHBAR should be 0.

I guess that Flash->RAM copying is the easiest method, when you want to get portable program, which runs on various CPUs, both from RAM and ROM.

 

0 Kudos