Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: What happens if ITCM and DTCM overlap on ARM926EJ-S? - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What happens if ITCM and DTCM overlap on ARM926EJ-S? Rate Topic: -----

#1 User is offline   fhoguin 

  • Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-January 12

Posted 23 January 2012 - 11:45 AM

Hello,

I noticed a bug in ITCM and DTCM initialization in some bootloader code.

The result is that the same value is written in the ITCM region register and in the DTCM region register, so both are configured with the same address and size.

It looks like in this case, ITCM gets priority over DTCM since everything is working correctly when executing code stored in this region of memory. If DTCM had priority, fetching an instruction from this region of memory would cause a prefetch abort exception.

Now, that's my understanding of what happens, but I couldn't find anything about it in the ARM926EJ-S documentation.

Can anybody confirm my theory, or explain what happens in detail?

Thanks,

Frédéric.
0

#2 User is offline   ttfn 

  • Super Contributor
  • PipPipPipPip
  • Group: Members
  • Posts: 576
  • Joined: 29-September 06

Posted 23 January 2012 - 03:04 PM

It is probably luck that it works.

From memory, instruction fetches will go to the ITCM, and data accesses to the DTCM. (Note I don't think it is documented anywhere that it does this, all the docs I've seen just say not to do this). So it will work if you have no data in the ITCM. Sounds easy, but remember that compilers often embed pools of literal data within instruction sections. Basically, its a bad idea to map them to the same address.
0

#3 User is offline   fhoguin 

  • Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-January 12

Posted 23 January 2012 - 03:22 PM

Thanks for your answer.

Actually, there are literal pools in this ITCM code, but I recall reading somewhere that the ITCM can contain data precisely because of PC-relative literal pools (however the DTCM cannot contain instructions). This would mean that for data accesses to PC-relative literal pools, the ITCM is used anyway. I cannot imagine how the ITCM code would work otherwise.

I hope someone can confirm this or explain what happens in this case.

Anyway, I agree that it is probably some kind of undefined behavior, and it shouldn't be done even if it seems to be working.
0

#4 User is offline   fhoguin 

  • Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-January 12

Posted 24 January 2012 - 08:33 AM

I finally got my answer. It's there, at the bottom of the page: http://infocenter.ar...e/I1002021.html

Quote

The instruction TCM must not be programmed to the same base address as the data TCM. If the two TCMs are of different sizes, the regions in physical memory must not overlap. If they do overlap, it is Unpredictable which memory is accessed.


So it's undefined behavior, and really it is luck that it works.
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic