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 16-------------------------------------------------------------------------------- 17 18Sample Output: 19 20***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Feb 8 2017 07:33:07 ***** 21Running test suite fat_fs_basic_test 22tc_start() - test_fat_file 23 24Open tests: 25Creating new file testfile.txt 26Opened file testfile.txt 27 28Write tests: 29Data written:"hello world!" 30 31Data successfully written! 32 33Sync tests: 34 35Read tests: 36Data read:"hello world!" 37 38Data read matches data written 39 40Truncate tests: 41 42Testing shrink to 0 size 43Testing write after truncating 44 45Write tests: 46Data written:"hello world!" 47 48Data successfully written! 49Original size of file = 12 50 51Testing shrinking 52File size after shrinking by 5 bytes = 7 53 54Testing expanding 55File size after expanding by 10 bytes = 17 56Testing for zeroes in expanded region 57 58Close tests: 59Closed file testfile.txt 60 61Delete tests: 62File (testfile.txt) deleted successfully! 63=================================================================== 64PASS - test_fat_file. 65tc_start() - test_fat_dir 66 67mkdir tests: 68Creating new dir testdir 69 70Write tests: 71Data written:"hello world!" 72 73Data successfully written! 74Created dir testdir! 75 76lsdir tests: 77 78Listing dir /: 79[DIR ] FATFILE 80[FILE] TEST.C (size = 10) 81[DIR ] TESTDIR 82[DIR ] 1 83 84lsdir tests: 85 86Listing dir testdir: 87[FILE] TESTFILE.TXT (size = 12) 88 89rmdir tests: 90 91Removing testdir/TESTFILE.TXT 92Removed dir testdir! 93 94lsdir tests: 95 96Listing dir /: 97[DIR ] FATFILE 98[FILE] TEST.C (size = 10) 99[DIR ] 1 100 101=================================================================== 102PASS - test_fat_dir. 103tc_start() - test_fat_fs 104 105Optimal transfer block size = 512 106Allocation unit size = 1024 107Volume size in f_frsize units = 2028 108Free space in f_frsize units = 2025 109=================================================================== 110PASS - test_fat_fs. 111=================================================================== 112PROJECT EXECUTION SUCCESSFUL 113