Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

jffs2 init

Altera_Forum
Honored Contributor II
1,211 Views

I have included and compiled JFFS2 but I am having a problem opening files. 

 

Processor:NIOSII, CYCLONE II 

Version : Quartus/eCos 5.1 

 

I have used mkfs.jffs2 and created my image then I used nios2-flash-programmer to create a srec. I used bin2flash to program the flash part with the jffs2 image. I have placed it at 0xD0000 with a length=0x20000. 

 

The following is test code I have been using: 

iRtn = mount("/dev/flash1", "/", "jffs2"); //return value is 0 - good 

iRtn = chdir("/"); //return value is 0 - good 

fp = fopen("inPort.cfg","w"); //return value = -1 errno 28 

 

The fopen() fails ..... 

 

output 

=================================================  

Try to open inPort.cfg - write mode! 

jffs2_lookup() 

<7>jffs2_create() 

<7>jffs2_new_inode(): dir_i 1, mode 0x16f0008 

<7>Allocated inocache at 0x0413ba00 

<7>jffs2_do_new_inode(): Assigned ino# 2 

<7>jffs2_reserve_space(): Requested 0x44 bytes 

<7>jffs2_reserve_space(): alloc sem got 

<7>dirty size 0x00000000 + unchecked_size 0x00000000 < nospc_dirty_size 0x00010000, returning -enospc 

<7>jffs2_do_create(): reserved 0x0 bytes 

<7>jffs2_clear_inode(): ino# 2 mode %o 

File Open FAILED in WRITE mode ! 

=================================================  

 

It looks like the flash device/ jffs partition is not initialized - but I can not find out how to initialize it!  

 

Does anyone know how the system knows the base address of the jffs patition and the length of the partition?  

Do you call a jffs init function or a flash init function? Do you add a table entry? 

 

 

 

Thanks
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
500 Views

> Does anyone know how the system knows the base address of the jffs patition 

> and the length of the partition? 

 

I believe it&#39;s set by FLASH_BLOCK_OFFSET/_LENGTH. From my ecc file: 

# ># Start offset from flash base# This gives the offset from the base of flash which this# block device corresponds to.# cdl_option CYGNUM_IO_FLASH_BLOCK_OFFSET_1 {   # Flavor: data    user_value 0x00000000   # value_source user   # Default value: 0x00100000 }; # Length# This gives the length of the region of flash given over# to this block device.# cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 {   # Flavor: data    user_value 0x00200000   # value_source user   # Default value: 0x00100000 }; 

 

 

> Do you call a jffs init function or a flash init function? Do you add a table entry? 

 

No, I just do the same as you:#ifdef CYGPKG_IO_FILEIO     if (mount ("/dev/flash1", "/", "jffs2") == 0)  chdir ("/");# endif 

 

 

Regards, 

--Scott
0 Kudos
Reply