Hi.
I'm working with this simple code in a TS-7200 board. The problem is
that it is generating a hardware access from the base address+0x300 to
base address+0x31E, instead of a single access to base+0x300. I mean,
instead of a single mem access, it generates 16. Since I'm working with
fifos, that´s not good... I've tried it with the precompiled
crosstoolchain for cygwin from embededarm and with an arm9tdmi crosstool
for cygwin built with glibc2.3.2, gcc 4.1.1 with the crosstool script.
The disassembly seems like a single memory access. Could it have
something to do with the cache? If so, is there a way to disable it for
the PC-104 mem map?
This is the compiler command line:
arm-9tdmi-linux-gnu-g++ -c -mcpu=arm9tdmi -I. -gdwarf-2 -O2 -Wall
-Wcast-align -Wcast-qual -Wimplicit -Wpointer-arith -Wswitch
-Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=main.lst
-MD -MP -MF .dep/main.o.d main.cpp -o main.o
int main(int argc,char *argv[])
{
int mem_fd;
unsigned short *addr;
unsigned long io_base_pcm;
unsigned long len;
volatile unsigned short *work;
float th;
if ((mem_fd = open("/dev/mem",O_RDWR))<0) {
printf("E: Can't open /dev/mem!\n");
exit(1);
}
//MAPEAMENTO
io_base_pcm = 0x21e00000;
len = 0x00001000;
addr = (unsigned short int *)mmap(0, len, PROT_READ | PROT_WRITE,
MAP_SHARED, mem_fd, io_base_pcm);
printf("1: Endereco fisico : %#x\n", (unsigned int)io_base_pcm);
printf("1: Endereco virtual: %#x\n", (unsigned int)addr);
printf("1: Tamanho : %#x\n\n", (unsigned int)len);
//READ WRITE
work = addr + (0x00000300 / (sizeof(*work)));
*work;
if (munmap(0, len) < 0) {
printf("E: Can't unmmap!\n");
exit(1);
}
printf("Fim!\n");
close(mem_fd);
return 0;
}
Thanks,
Ricardo.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|