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: How to Access TCM? - ARM Community

Jump to content

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

How to Access TCM? Rate Topic: -----

#1 User is offline   Zova 

  • Member
  • Pip
  • Group: Members
  • Posts: 15
  • Joined: 09-June 11

Posted 27 June 2011 - 06:44 AM

Hi all,
I wrote a driver to enabe TCM on ARM1176jzf-s based board. It shows success when I insmod. I set the base address of ITCM to 0x100000. Then, I tried to write something to that space from user space. I found one way to do that by open /dev/mem, and mmap to get a virtual address.
Here's the code
off_t iphybase = 0x100000;
....
if((mdesc=open("/dev/mem",O_RDWR))==0) {
            	perror("Error openning file /dev/mem");
            	return false;
    	}   	
    	ibase = (char *)mmap(0, MAP_SIZE,PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED, mdesc, iphybase&~MAP_MASK);



Then, I put some code (JIT'ed code, acctually) into it, and run with gdb and shell command. Both get segment faults. I checked the mapped address in gdb, but it is not accessiable like this

(gdb) x/i 0x50b11158
0x50b11158: 	Cannot access memory at address 0x50b11158



segment faults at the address above, and strangly, it is not the base address returned by mmap, which means instructions starting from ibase got executed, right? Then, why segment faults?

So, where the problem? Did I use the TCM in a right way? Please help me out. ANY ADVICE WILL BE APPRECIATED. Thanks very very much.

This post has been edited by Zova: 27 June 2011 - 06:47 AM

0

#2 User is offline   Zova 

  • Member
  • Pip
  • Group: Members
  • Posts: 15
  • Joined: 09-June 11

Posted 29 June 2011 - 01:28 PM

View PostZova, on 27 June 2011 - 06:44 AM, said:

Hi all,
I wrote a driver to enabe TCM on ARM1176jzf-s based board. It shows success when I insmod. I set the base address of ITCM to 0x100000. Then, I tried to write something to that space from user space. I found one way to do that by open /dev/mem, and mmap to get a virtual address.
Here's the code
off_t iphybase = 0x100000;
....
if((mdesc=open("/dev/mem",O_RDWR))==0) {
            	perror("Error openning file /dev/mem");
            	return false;
    	}   	
    	ibase = (char *)mmap(0, MAP_SIZE,PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED, mdesc, iphybase&~MAP_MASK);



Then, I put some code (JIT'ed code, acctually) into it, and run with gdb and shell command. Both get segment faults. I checked the mapped address in gdb, but it is not accessiable like this

(gdb) x/i 0x50b11158
0x50b11158: 	Cannot access memory at address 0x50b11158



segment faults at the address above, and strangly, it is not the base address returned by mmap, which means instructions starting from ibase got executed, right? Then, why segment faults?

So, where the problem? Did I use the TCM in a right way? Please help me out. ANY ADVICE WILL BE APPRECIATED. Thanks very very much.



Hi all, I finally fixed this and I guess it's because I give the wrong phisical address to TCM. My friend finally find this link, Linux-SMDK6410_Test_Rev01 which specify 0x8000000 as the starting address. I changed to that one, and it works fine.

Thanks,
Zova
1

Share this topic:


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