Skip to main content
Explorer
September 24, 2024
Solved

NUCLEO-F746ZG: VTOR set to 0x00200000 - Efficient use of RAM and modifying linker script

  • September 24, 2024
  • 2 replies
  • 958 views

Hello ST Micro community,

I'm working with a NUCLEO-F746ZG board and have noticed some interesting behavior regarding memory usage. I'd like to seek your advice on the following:

  1. The VTOR (Vector Table Offset Register) is currently set to 0x00200000.
  2. The contents flashed to 0x08000000 (Flash memory) are mirrored at 0x00200000 (RAM).
  3. I haven't seen a linker script that explicitly uses the 0x00200000 address range for the uploaded code.

Given this situation, I have two main questions:

a) What could be the reason for VTOR being set to 0x00200000? Is this a default behavior for this board or a specific configuration?

b) Using the 0x00200000 address range (RAM) could potentially be more efficient for code execution. How can I modify my project to take advantage of this? Specifically, what changes would I need to make to the linker script to utilize this memory address?

Any insights or guidance on how to optimize my setup would be greatly appreciated. Thank you in advance for your help!

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello @sungjin and welcome to the community.

    0x00200000 is the start address of the Flash-ITCM. Physically, it's the same Flash on the die as the Flash-AXIM but "aliased" on another address: 0x08000000.

    From AN4667:

    SofLit_0-1727177167812.png

    Flash-ITCM start address: 0x00200000

    Flash-AXIM start address: 0x08000000

    SofLit_0-1727176376685.png

    So if you are executing from Flash-ITCM you need to relocate the VTOR base address to 0x00200000 while for Flash-AXIM it needs to be relocated to 0x08000000.

    I invite you to have a look at the application note AN4667 "STM32F7 Series system architecture and performance". In this application note you will find many details of STM32F7 product  architecture as well as some performance results of different typical configs with some tips and code partitioning tricks at the end.

     Also refer to the related X-Cube package X-CUBE-32F7PERF downloadable from here. There you can find how to configure the linker scripts to relocate your code and the data in the desirable memory.

    Hope I answered your questions.

    2 replies

    mƎALLEmAnswer
    Technical Moderator
    September 24, 2024

    Hello @sungjin and welcome to the community.

    0x00200000 is the start address of the Flash-ITCM. Physically, it's the same Flash on the die as the Flash-AXIM but "aliased" on another address: 0x08000000.

    From AN4667:

    SofLit_0-1727177167812.png

    Flash-ITCM start address: 0x00200000

    Flash-AXIM start address: 0x08000000

    SofLit_0-1727176376685.png

    So if you are executing from Flash-ITCM you need to relocate the VTOR base address to 0x00200000 while for Flash-AXIM it needs to be relocated to 0x08000000.

    I invite you to have a look at the application note AN4667 "STM32F7 Series system architecture and performance". In this application note you will find many details of STM32F7 product  architecture as well as some performance results of different typical configs with some tips and code partitioning tricks at the end.

     Also refer to the related X-Cube package X-CUBE-32F7PERF downloadable from here. There you can find how to configure the linker scripts to relocate your code and the data in the desirable memory.

    Hope I answered your questions.

    sungjinAuthor
    Explorer
    September 24, 2024

    Dear SofLit,

    Thank you very much for your detailed explanation. Your answer has been incredibly helpful in understanding how the Flash-ITCM and Flash-AXIM addresses work on the STM32F7 series. The clarification about relocating the VTOR base address based on the execution memory makes perfect sense now. I appreciate your recommendation to read the AN4667 application note and to explore the X-CUBE-32F7PERF package. These resources will undoubtedly aid me in optimizing my project's performance.

    Your assistance has been invaluable, and I am grateful for your support.

     

    Best regards, 

    Sungjin