Jernej Perdan
2005-12-19 12:24:40 UTC
Hi!
I've found similar problem, but it haven't helped me to solve mine, so I'm posting new message.
I'm trying to run an application on my PXA255 module. When I run it from NFS mounted root filesystem it works.
The problem ocours when the aplicaton is run from root filesystem which is burned to flash (jffs2). I get folowing error: Invalid argument
I found out this is due to mmap call when I try to mmap txt file to SDRAM.
The errno returned number is 22 -> EINVAL: we don't like start or length or offset. (they're too large or not aligned on a PAGESIZE boundary)
o my printfs:
mbaza_size = 626
Num of bytes in a page: 4096
error = 22
Mapiranje datoteke spodletelo!
: Invalid argument
o code:
baza::baza(const char *baza_kje):mbaza(NULL)
{
struct stat statbuf;
memset(&statbuf,0,sizeof(statbuf));
baza_dat = new char[strlen(baza_kje)];
strcpy(baza_dat,baza_kje);
// odpremo datoteko z bazo
fd = open(baza_dat, O_RDWR|O_CREAT);
if (fd < 0)
{
die("Ne morem odpreti baze!\n");
exit(1);
}
chmod(baza_dat,0644);
// doloèimo velikost datoteke
if (fstat(fd,&statbuf) != 0)
{
die("Ne morem brati informacij o datoteki!\n");
exit(1);
}
mbaza_size = statbuf.st_size;
// se ukvarjamo s prazno datoteko?
if (mbaza_size == 0)
{
mbaza = NULL;
return;
}
printf("mbaza_size = %d\n", mbaza_size);
int sz = getpagesize();
printf("Num of bytes in a page: %d\n", sz);
// mapiramo datoteko v pomnilnik
mbaza = mmap(NULL,mbaza_size, PROT_READ|PROT_EXEC|PROT_WRITE, MAP_SHARED, fd, 0);
if (mbaza == MAP_FAILED)
{
printf("error = %d\n", errno);
die("Mapiranje datoteke spodletelo!\n");
exit(1);
}
}
Printfs I get when usinf NFS mounted root filesystem:
mbaza_size = 486
Num of bytes in a page: 4096
I'm new to embedded systems so i don't know which values should I try instead of used ones or where else to look.
Maybe is this failure due to other (mis)configuration(s)?
Any ideas?
Jernej
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
I've found similar problem, but it haven't helped me to solve mine, so I'm posting new message.
I'm trying to run an application on my PXA255 module. When I run it from NFS mounted root filesystem it works.
The problem ocours when the aplicaton is run from root filesystem which is burned to flash (jffs2). I get folowing error: Invalid argument
I found out this is due to mmap call when I try to mmap txt file to SDRAM.
The errno returned number is 22 -> EINVAL: we don't like start or length or offset. (they're too large or not aligned on a PAGESIZE boundary)
o my printfs:
mbaza_size = 626
Num of bytes in a page: 4096
error = 22
Mapiranje datoteke spodletelo!
: Invalid argument
o code:
baza::baza(const char *baza_kje):mbaza(NULL)
{
struct stat statbuf;
memset(&statbuf,0,sizeof(statbuf));
baza_dat = new char[strlen(baza_kje)];
strcpy(baza_dat,baza_kje);
// odpremo datoteko z bazo
fd = open(baza_dat, O_RDWR|O_CREAT);
if (fd < 0)
{
die("Ne morem odpreti baze!\n");
exit(1);
}
chmod(baza_dat,0644);
// doloèimo velikost datoteke
if (fstat(fd,&statbuf) != 0)
{
die("Ne morem brati informacij o datoteki!\n");
exit(1);
}
mbaza_size = statbuf.st_size;
// se ukvarjamo s prazno datoteko?
if (mbaza_size == 0)
{
mbaza = NULL;
return;
}
printf("mbaza_size = %d\n", mbaza_size);
int sz = getpagesize();
printf("Num of bytes in a page: %d\n", sz);
// mapiramo datoteko v pomnilnik
mbaza = mmap(NULL,mbaza_size, PROT_READ|PROT_EXEC|PROT_WRITE, MAP_SHARED, fd, 0);
if (mbaza == MAP_FAILED)
{
printf("error = %d\n", errno);
die("Mapiranje datoteke spodletelo!\n");
exit(1);
}
}
Printfs I get when usinf NFS mounted root filesystem:
mbaza_size = 486
Num of bytes in a page: 4096
I'm new to embedded systems so i don't know which values should I try instead of used ones or where else to look.
Maybe is this failure due to other (mis)configuration(s)?
Any ideas?
Jernej
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php