- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi
I am trying to save data in to Flash. I want to load previous execute data and system setting before I turn it off. Did anyone know how to do this. Please tell who or share me some information to do this. Thank you very much.Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can set up a flash file system in a flash memory chip. JFFS2 is the version I once tested to be working, but nowadays, UBIFS seems to be the more accepted variant.
The wiki at least provides some articles on JFFS2 and MTD. See the article on "Haserl Script" in the wiki for parameters that you want to set remotely via an Browser interface..- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Basically, if you want to use CFI-Flash, you may want to add MTD driver.
I am using JFFS2. It is easy to use, but consume a bit area for the file system itself. You should be able to find the drive in the menuconfig selection.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mschnell,
Thanks for your replying. Could you share more detail about UBIFS. It seems it can do the same as JFFS2, and I think this is worth to try it. Thanks. I try to turn on it. However, when I turn on UBIFS file system support under Miscellaneous filesystems, I have "mkfs.ubifs.h:48:23: error: uuid/uuid.h: No such file or directory", this error messenge. Did I somehow corrupt the link file? Thanks Best regards Tingming --- Quote Start --- You can set up a flash file system in a flash memory chip. JFFS2 is the version I once tested to be working, but nowadays, UBIFS seems to be the more accepted variant. The wiki at least provides some articles on JFFS2 and MTD. See the article on "Haserl Script" in the wiki for parameters that you want to set remotely via an Browser interface.. --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Basically, if you want to use CFI-Flash, you may want to add MTD driver. I am using JFFS2. It is easy to use, but consume a bit area for the file system itself. You should be able to find the drive in the menuconfig selection. --- Quote End --- Hi nekojiru Thank you for your replying. I enable "Direct char device access to MTD Device" After that, I write a small program to test it. I try to open it --- Quote Start --- fd = open("/dev/mtd0",O_RDWR); if(fd<0){ printf("Cannot Open mtd0 Error Code = %d\n",fd); }else{ printf("Open mtd0 Success\n"); ret = read( fd, buffer, 4); if(ret > 0) printf("PreData 0x%02x 0x%02x 0x%02x 0x%02x\n",buffer[0],buffer[1],buffer[2],buffer[3]); else printf("Reading Fail %d\n",ret); buffer[0] = buffer[0] + 1; buffer[1] = buffer[1] + 2; buffer[2] = buffer[2] + 3; buffer[3] = 0x30; ret = write(fd,buffer, 4); if(ret > 0) printf("Write Success !!\n"); else printf("Write Fail %d\n",ret); ret = read( fd, buffer, 4); if(ret > 0) printf("Reading Data 0x%02x 0x%02x 0x%02x 0x%02x\n",buffer[0],buffer[1],buffer[2],buffer[3]); else printf("Reading Fail %d\n",ret); } close(fd); --- Quote End --- The Exec result is past below --- Quote Start --- Open mtd0 Success PreData 0xff 0x00 0x00 0x01 Write Success !! Reading Data 0xff 0xff 0xff 0xff --- Quote End --- It seems I still can't read write to correct location. I search Internet, and It seems I need to create the file systems mkfs.jffs2 **** However, do I need to create file system every time? If I need to do it every time when I booting up, my file saved inside will been clear. Then I still can't save it. I am using Cyclone III (#define CONFIG_ALTERA_CYCLONE_III) This is the booting up result when I added the MTD Support. http://i53.tinypic.com/zmts2.jpg Below is my setting for Flash MTD Support Setting http://i54.tinypic.com/20s6fpx.jpg File System Setting http://i52.tinypic.com/28vx8nk.png Flash Tool http://i52.tinypic.com/wlt92v.png
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to mount flash correctly.
Something like this... mkdir /mnt/flash mount -t jffs2 /dev/mtdblock2 /mnt/flash After mounted, you should be able to make file on the file system. either do cp command and copy file or use vi to create something text file. Since jffs2 is file system, you just want to open file or write file rather than direct read/write access to specific address on the flash.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- You need to mount flash correctly. Something like this... mkdir /mnt/flash mount -t jffs2 /dev/mtdblock2 /mnt/flash After mounted, you should be able to make file on the file system. either do cp command and copy file or use vi to create something text file. Since jffs2 is file system, you just want to open file or write file rather than direct read/write access to specific address on the flash. --- Quote End --- Hi nekojiru Below is my mtd system --- Quote Start --- root:/> cat /proc/mtd dev: size erasesize name mtd0: 02800000 00020000 "userspace" mtd1: 00100000 00020000 "U-Boot" mtd2: 00400000 00020000 "uImage1" mtd3: 00400000 00020000 "uImage2" mtd4: 00400000 00020000 "uImage3" mtd5: 00380000 00020000 "DEFAULT_MMU" mtd6: 00380000 00020000 "MAXIMUM_MMU" mtd7: 00380000 00020000 "USER_IMAGE" mtd8: 00020000 00020000 "options-bits" --- Quote End --- below is my filesystems --- Quote Start --- root:/> cat /proc/filesystems nodev sysfs nodev rootfs nodev proc nodev tmpfs nodev sockfs nodev pipefs nodev configfs nodev devpts nodev ramfs nodev jffs2 nodev autofs --- Quote End --- At first, I decide to mount mtdblock0 to mnt/flash --- Quote Start --- root:/> mkdir /mnt/flash root:/> mount -t jffs2 /dev/mtdblock0 /mnt/flash mount: mounting /dev/mtdblock0 on /mnt/flash failed: Invalid argument --- Quote End --- Then I think it is caused by mtdblock0 is not a jffs2 filesystem. I try to remove jffs2 and exec it --- Quote Start --- root:/> mount -t /dev/mtdblock0 /mnt/flash mount: can't read /etc/fstab: No such file or directory --- Quote End --- I realize inside my system, I don't have fstab file!!! Below is my executed result.. http://i55.tinypic.com/34q8f0h.jpg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess you need to enable the block read/write access.
https://www.alteraforum.com/forum/attachment.php?attachmentid=3522 https://www.alteraforum.com/forum/attachment.php?attachmentid=3523- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I guess you need to enable the block read/write access. https://www.alteraforum.com/forum/attachment.php?attachmentid=3522 https://www.alteraforum.com/forum/attachment.php?attachmentid=3523 --- Quote End --- Hi nekojiru Thank you very much. You are correct, I didn't turn on block device. In my system, I can't turn on it causing by some setting corrupted. I try to rebuild it from new then I can turn it on. I try to save it and success!!!!! Thank you very much. Best regards Tingming below is my result... http://i55.tinypic.com/2lxf19h.jpg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, make sure this.
I think I should have mention this link. http://www.alterawiki.com/wiki/jffs2_for_linux- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Also, make sure this. I think I should have mention this link. http://www.alterawiki.com/wiki/jffs2_for_linux --- Quote End --- Thanks nekojiru

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