- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to use jffs2 with ecos on the cycloneII NIOSII development board.
I have included jffs2 into the ecos lib. Now I don't know what to do next - I have looked for some documentation but could not find it in the ecos directories. Any help on getting started would be great. ThanksLink Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can find example code that uses jffs2 in the tests directory of the jffs2 package. Limited documentation, and links to the jffs2 mailing lists, can be found here (http://sources.redhat.com/jffs2/).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi pxs,
> Now I don't know what to do next 1. create a jffs2 filesystem You can create a filesystem image with mkfs.jffs2 and download it to your jffs2 partition. As an alternative, you can simply erase your jffs2 partition. 2. mount the partition You can mount the partition in cycuser_start(). For example:void cyg_user_start(void)
{
...
# ifdef CYGPKG_IO_FILEIO
if (mount ("/dev/flash1", "/", "jffs2") == 0)
chdir ("/");# endif
...
}
3. use the standard routines For example:ret = mkdir ("newdir", S_IRWXU|S_IRWXG|S_IRWXO); /* Create a directory */
ret = rmdir ("olddir"); /* Remove a directory */
ret = rename ("oldname", "newname"); /* Rename a file */
/* ... and so on ... */
Hope this is helpful. Regards, --Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>1. create a jffs2 filesystem
>You can create a filesystem image with mkfs.jffs2 and download it to your jffs2 partition. >As an alternative, you can simply erase your jffs2 partition. The only time I used mkfs.jffs2 was on an uClinux box and it had mkfs.jffs2 on it. So I created the directory structure in RAM and then ran mkfs.jffs2 on the uClinux box and it created the image. I then used erase and copied the image over. Then I used mount. Can you explain how you create the image in more detail? Do you use a Linux box to create it or do you download the source and compile it on a windows box using cygwin, or do you compile it in NIOS? How do I download it to the jffs2 partition? How do I create the jffs2 partition? Do I need Redboot? Thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi pxs,
> Can you explain how you create the image in more detail? 1. In your unix environment create a directory that will serve as the root of your jffs2 filesystem. 2. Then populate this directory with all of the directories, files, links, etc. that are needed for your target system. 3. Run mkfs.jffs2, specifying the directory you created in step 1 (the -r, -d, or --root option). You'll need to specify the eraseblock size also. A single 8-bit device with 64K sector size would be "-e 0x10000", two of them in parallel would be "-e 0x20000" and so on. It's also a good idea to explicitly set the endian order in your makefiles as a precaution, use -l option for nios. By default mkfs.jffs2 will use the endian order of the machine you run it on (for nios and x86 this is never a problem since they're both little endian -- but PowerPC hosts can cause issues). So an invocation of mkfs.jffs2 might look something like this if your file structure is in the directory "ecos_root":$ mkfs.jffs2 -d ecos_root -e 0x10000 -o jffs2.bin -l
4. Once you have the binary, you can use bin2flash and the nios2-flash-programmer to load the binary into your jffs2 partition on your target board. > Do you use a Linux box to create it or do you download the source and compile it on a > windows box using cygwin, or do you compile it in NIOS? I always use mkfs.jffs2 on a unix box. Under cygwin, you'll loose some of your file attributes (like the execute bits or example) which can be troublesome for embedded linux targets. But for ecos, you may not really care. Prior to Nios II 5.0, the Microtronix uClinux linux came with host gcc ... and the mkfs.jffs2 source code available at: http://www.psyent.com/download (http://www.psyent.com/download) would build cleanly in an SDK shell windown. I haven't tried these sources with the latest 5.0 stuff yet. I know there are problems building this code in a "normal" cygwin environment from www.cygwin.com. Regards, --Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi pxs,
Just FYI ... > I haven't tried these sources with the latest 5.0 stuff yet. I was able to finish installing the Microtronix linux uClinux for Nios II 5.0, and the psyent sources for mkfs.jffs2, mkcramfs, etc. build just fine in the Nios SDK shell environment ... they also build fine under RH9. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Scott,
I have downloaded Microtronix linux uClinux for Nios II 5.0 and compiled mkfs.jffs2 without a problem. I created a few directories and a file and then I used the following command to generated jffs2.img$> mkfs.jffs2 -d jffs2 -e 0x10000 -o jffs2.img -l
then $> bin2flash --input=jffs2.img --base=0x0000 0000 --location=0x0060 0000 --verbose
I used the base=0x0000 0000 because I am using the Altera NIOS CYCLONE II Development Board. I used the location at 0x0060 0000 because this is in the user region (as per Nios development brd cycloneII Edition Ref. Manual). User region= 0x0000 0000 to 0x00BF FFFF I placed it high in the user region but I am not sure where ecos is placed - do you know where I can find this information? The previous command gives a output of jffs2.flash I then tried to download jffs2.flash to the board with the following command without succuss. $> nios2-flash-programmer --base=0x0000 0000 --input=jffs2.flash --location=0x0060 0000 --verbose --sof=/cygdrive/c/altera/kits/nios2/examples/verilog/niosII_cycloneII_2c35/standard/standard.sof
<div class='quotetop'>QUOTE </div> --- Quote Start --- Aug 16, 2005 4:31:49 PM - (FINE) nios2-flash-programmer: nios2-flash-programmer starting Aug 16, 2005 4:31:49 PM - (INFO) nios2-flash-programmer: args = --base=0x00000000 --input=jffs2.flash --verbose --sof=standard.sof Aug 16, 2005 4:31:49 PM - (INFO) nios2-flash-programmer: Attempting to read input-data from c:jffs2.flash Aug 16, 2005 4:31:49 PM - (INFO) nios2-flash-programmer: Launching Quartus Programmer to download: standard.sof Aug 16, 2005 4:31:49 PM - (FINE) nios2-flash-programmer: Quartus Pgm launched Info: ******************************************************************* Info: Running Quartus II Programmer Info: Command: quartus_pgm --no_banner --mode=jtag --operation=p;standard.sof Info: Using programming cable "USB-Blaster [USB-0]" Info: Started Programmer operation at Tue Aug 16 16:31:51 2005 Info: Configuring device index 1 Info: Device 1 contains JTAG ID code 0x020B40DD Info: Configuration succeeded -- 1 device(s) configured Info: Successfully performed operation(s) Info: Ended Programmer operation at Tue Aug 16 16:31:53 2005 Info: Quartus II Programmer was successful. 0 errors, 0 warnings Info: Processing ended: Tue Aug 16 16:31:53 2005 Info: Elapsed time: 00:00:04 Aug 16, 2005 4:31:53 PM - (FINE) nios2-flash-programmer: SOF programming done. exit code = 0x0000 Connecting with target design Attempting to resynch with target Unable to synchronize with target. Aug 16, 2005 4:31:56 PM - (SEVERE) nios2-flash-programmer: Error opening target hardware Aug 16, 2005 4:31:56 PM - (SEVERE) nios2-flash-programmer: In order to program flash, you must first create a purpose-built flash-programming design (i.e. FPGA configuration) and associate it with your particular board. The Nios development kit is delivered with purpose-built flash-programming designs pre-built for several development boards. If you wish to program flash on your own board, you must first create a flash-programming design. The process of creating a flash-programming design for your board is mostly automated. From a bash-shell, execute this script: mk_target_board --help The help-message includes references to other documentation on programming flash and targeting Nios systems to custom board designs. - exiting.[/b] --- Quote End --- I am using a pre-built configuration (cycloneII 2c35) so I am not sure why it wants me to use mk_target_board. Any ideas? Can you explain further about how to make the jffs2 partition you spoke of previously (see below). Is this the jffs2.img (jffs2.flash) or do I have to do something to make the partition? <div class='quotetop'>QUOTE </div> --- Quote Start --- 1. Create a jffs2 filesystem You can create a filesystem image with mkfs.jffs2 and download it to your jffs2 partition. As an alternative, you can simply erase your jffs2 partition.[/b] --- Quote End ---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi pxs,
> I placed it high in the user region but I am not sure where ecos is placed - do you > know where I can find this information? ecos is normally stored at the reset address ... so it will start at power-on or cpu reset. You can check your elf file with objdump: $ nios2-elf-objdump -h your-ecos-elf-file > I then tried to download jffs2.flash to the board with the following command without succuss. <div class='quotetop'>QUOTE </div> --- Quote Start --- $> nios2-flash-programmer --base=0x0000 0000 --input=jffs2.flash --location=0x0060 0000 --verbose --sof=/cygdrive/c/altera/kits/nios2/examples/verilog/niosii_cycloneii_2c35/standard/standard.sof[/b] --- Quote End --- You need to specify the _programmer_ sof for the board ... not the example configuration. Use the sof in: $SOPC_KIT_NIOS2/components/altera_nios_dev_board_cyclone_2c35/system/altera_nios_dev_board_cyclone_2c35.sof > Can you explain further about how to make the jffs2 partition you spoke of previously (see below). > Is this the jffs2.img (jffs2.flash) or do I have to do something to make the partition? You can divide your flash into several "blocks" or "areas" that can be independently managed by jffs2 ... all in the same spirit as partitions on a hard disk drive. So from a software point-of-view, it appears as though you have multiple flash "drives". Since I'm primarily a linux person, I've never used more than a single partition with ecos ... but I'm assuming there's an easy way to create more than one with the config tool. Maybe monkeyboy can help with this. Regardless, you can configure your default partition in the "Flash device drivers" configuration under "instantiate in I/O block device API" -> "static configuration". Regards, --Scott
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page