1Title: Zephyr File System Demo 2 3Description: 4 5Demonstrates basic file and dir operations using the Zephyr file system. 6-------------------------------------------------------------------------------- 7 8Building and Running Project: 9 10The demo will run on native_posix and will use the on-board SPI flash. 11 12 mkdir build; cd build 13 cmake -DBOARD=native_posix .. 14 make run 15 16To test fatfs on MMC, add this cmake option to your build command: 17 -DCONF_FILE=prj_mmc.conf 18-------------------------------------------------------------------------------- 19 20Sample Output: 21 22***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Feb 8 2017 07:33:07 ***** 23Running test suite fat_fs_basic_test 24tc_start() - test_fat_file 25 26Open tests: 27Creating new file testfile.txt 28Opened file testfile.txt 29 30Write tests: 31Data written:"hello world!" 32 33Data successfully written! 34 35Sync tests: 36 37Read tests: 38Data read:"hello world!" 39 40Data read matches data written 41 42Truncate tests: 43 44Testing shrink to 0 size 45Testing write after truncating 46 47Write tests: 48Data written:"hello world!" 49 50Data successfully written! 51Original size of file = 12 52 53Testing shrinking 54File size after shrinking by 5 bytes = 7 55 56Testing expanding 57File size after expanding by 10 bytes = 17 58Testing for zeroes in expanded region 59 60Close tests: 61Closed file testfile.txt 62 63Delete tests: 64File (testfile.txt) deleted successfully! 65=================================================================== 66PASS - test_fat_file. 67tc_start() - test_fat_dir 68 69mkdir tests: 70Creating new dir testdir 71 72Write tests: 73Data written:"hello world!" 74 75Data successfully written! 76Created dir testdir! 77 78lsdir tests: 79 80Listing dir /: 81[DIR ] FATFILE 82[FILE] TEST.C (size = 10) 83[DIR ] TESTDIR 84[DIR ] 1 85 86lsdir tests: 87 88Listing dir testdir: 89[FILE] TESTFILE.TXT (size = 12) 90 91rmdir tests: 92 93Removing testdir/TESTFILE.TXT 94Removed dir testdir! 95 96lsdir tests: 97 98Listing dir /: 99[DIR ] FATFILE 100[FILE] TEST.C (size = 10) 101[DIR ] 1 102 103=================================================================== 104PASS - test_fat_dir. 105tc_start() - test_fat_fs 106 107Optimal transfer block size = 512 108Allocation unit size = 1024 109Volume size in f_frsize units = 2028 110Free space in f_frsize units = 2025 111=================================================================== 112PASS - test_fat_fs. 113=================================================================== 114PROJECT EXECUTION SUCCESSFUL 115