KEA-128 relocate vector table and ISR function to SRAM

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

KEA-128 relocate vector table and ISR function to SRAM

913 Views
jianyingchu
Contributor I

I am developing KEA-128 application with S32 Design Studio. I need relocate the vector table and the corresponding ISR routines to SRAM for quicker response. Although I am aware to configure the default linker file SKEAZ_flash.ld to link the target code into SRAM, and assume that I must copy the code from Flash to SRAM before execution, I am not sure how to do it? Can anybody help me or point me to some example code?

Appreciate your help so much.

Best regards,

Jerry 

Labels (1)
1 Reply

687 Views
mjbcswitzerland
Specialist V

Jerry

Assuming that your RAM were to start at 0x1fff8000 and your vectors are in Flash at their default location, and the interrupt vector table were 0x200 in length you can do it with simple code as follows. In the linker script you can defined 0x200 bytes to keep free at the start of SRAM.

   SCB_VTOR = 0x1fff8000; // set the location of interrupt vectors to the start of SRAM
   memcpy((void *)0x1fff8000, 0x00000000, 0x200); // copy the fixed vectors to SRAM

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis KEA128:
- http://www.utasker.com/kinetis/TRK-KEA128.html
- http://www.utasker.com/kinetis/FRDM-KEAZ128Q80.html
S32 Design Studio: http://www.utasker.com/kinetis/compilers.html#S32

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

Professional Kinetis support, one-on-one training and complete fast-track project solutions: http://www.utasker.com/support.html