Copy vector to RAM

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

Copy vector to RAM

2,134 Views
xavierbuhot
Contributor II

Hello,

I would like to know the goal of the RAM copy of the vector.

In my kinetis K60 example there is in the start function:

/* Copy the vector table to RAM */

  if (__VECTOR_RAM != __VECTOR_TABLE)

  {

    for (n = 0; n < 0x410; n++)

      __VECTOR_RAM[n] = __VECTOR_TABLE[n];

  }

  /* Point the VTOR to the new copy of the vector table */

  write_vtor((uint32)__VECTOR_RAM);

What is the main advantage to copy the vector table into the RAM?

Best regard.

0 Kudos
4 Replies

1,210 Views
pgo
Senior Contributor V

Hi Xavier,

Another obvious reason is if you want to dynamically change the interrupt handlers.  For example, some of the Kinetis SDK code does this i.e. it installs an interrupt handler as part of the setup rather than hard coding in the vector table.

I generally prefer the VT in ROM unless there is a real need.

bye

0 Kudos

1,210 Views
xavierbuhot
Contributor II

Thank you for the answer.

0 Kudos

1,210 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

you are welcome!


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,210 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

However in some application, we need move vector table to other address. A typical usage is developing boot loader code. The boot loader code occupies the first region of the FLASH memory (the lowest memory address space starting from 0x0000000).

This placement moves at the beginning of the available memory space and it is necessary to shift this address in the user application.

for more information, please see this document that may help you.

Interrupt Vector Redirection Method in Kinetis

can this answer help you?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------