About Data/Code and TCM

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

About Data/Code and TCM

1,692 Views
yaoxingshan
Contributor II

As we all know, i.MX RT MCU has two TCMs (Tightly-Coupled Memory): D-TCM and I-TCM, although in fact they are both FlexRAM. In theory, data should be placed in D-TCM, and code/instructions should be placed in I-TCM.

In Using the i.MX RT FlexRAM, Application Note, Rev. 3, 01/2021, section 3.1.2.1.Code memory footprint, the example places the interrupt vector table and related routines in the I-TCM:

3.1.2.1.Code memory footprint

The interrupt vector table and a couple of critical interrupt service routines must be placed in the ITCM (a 64-bit single-cycle access memory can pre-fetch 64-bit, 4 x 16-bit, or 2 x 32-bit instructions) to speed up its execution time. The interrupt vectors and corresponding interrupt service routines take 46 kB of memory.

I'm wondering about this because I think the interrupt vector table should be classified as data, which would be more appropriate in the D-TCM. I can't understand why the example arranges memory this way. Is my thinking wrong?

Labels (1)
0 Kudos
Reply
4 Replies

1,687 Views
jay_heng
NXP Employee
NXP Employee

Vector table contains all ISR function addresses, CPU fetches ISR function address to execute when interrupt come, ISR function address is not simple data.

0 Kudos
Reply

1,682 Views
yaoxingshan
Contributor II

So would it be faster to put the vector table on ITCM than on DTCM?

0 Kudos
Reply

1,673 Views
jay_heng
NXP Employee
NXP Employee

Not slower than DTCM at least

0 Kudos
Reply

1,671 Views
yaoxingshan
Contributor II

According to the description of the reference manual, the speed of ITCM and DTCM can be the same, but the interface is different (64-bit I-TCM interface and 2x 32-bit D-TCM interface).

There should be no performance advantage to place the vector table in ITCM, but it should be more appropriate to place the vector table in DTCM (I think special data is also data, the difference between instructions and data should be executable or not).

The only reason I can think of to put a vector table on the ITCM is for it to start at address 0 (which is where most traditional programs start).

0 Kudos
Reply