|
| 1 | +<br> |
| 2 | + |
| 3 | +## Using prepared **LittleFS** image |
| 4 | + |
| 5 | +**Prepared** image file can be flashed to K210 board, if not flashed, the file system will be formated after first boot. |
| 6 | + |
| 7 | + |
| 8 | +LittleFS **image** can be **prepared** on host and flashed to K210 board: |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +### Prepare the image |
| 13 | + |
| 14 | +Copy the files to be included on LittleFS into **`mklittlefs/internalfs_image/`** directory. Subdirectories can also be added. |
| 15 | + |
| 16 | +Change the working directory to `mklittlefs`.<br> |
| 17 | +The image file is created using `mklfs` utility. |
| 18 | + |
| 19 | +``` |
| 20 | +Usage: |
| 21 | + mklfs [-b block_size] [-c block_count] [-l lookahead_size] image_dir image_name |
| 22 | + block_size: default=512 (MICRO_PY_LITTLEFS_SECTOR_SIZE) |
| 23 | + block_count: default=20480 (MICRO_PY_FLASHFS_SIZE / MICRO_PY_LITTLEFS_SECTOR_SIZE) |
| 24 | + lookahead_size: default=32 (LITTLEFS_CFG_LOOKAHEAD_SIZE) |
| 25 | +``` |
| 26 | +If using the dafault Flash file system parameters defined in `mpconfigport.h`, you only have to provide input directory and output file name<br> |
| 27 | + |
| 28 | + |
| 29 | +Execute: |
| 30 | +``` |
| 31 | +./mklfs |
| 32 | +``` |
| 33 | + |
| 34 | +Example: |
| 35 | +``` |
| 36 | +./mklfs |
| 37 | +
|
| 38 | +Creating LittleFS image |
| 39 | +======================= |
| 40 | +Image directory: |
| 41 | + 'internalfs_image' |
| 42 | +Image name: |
| 43 | + 'maixpy_lfs.img' |
| 44 | +Block size=512, Block count=20480, lookahead=32 |
| 45 | +
|
| 46 | +Creating and mounting LittleFS image... |
| 47 | + Image file created. |
| 48 | + Image file formated. |
| 49 | + Image file mounted. |
| 50 | +
|
| 51 | +Adding files from image directory: |
| 52 | + 'internalfs_image' |
| 53 | +---------------------------------- |
| 54 | +
|
| 55 | +/examples [D] |
| 56 | +/examples/display [D] |
| 57 | +/examples/display/test1.jpg |
| 58 | +/examples/display/test2.jpg |
| 59 | +/examples/display/test3.jpg |
| 60 | +/examples/display/test4.jpg |
| 61 | +/examples/display/tiger.bmp |
| 62 | +/examples/webserver [D] |
| 63 | +/examples/webserver/README.md |
| 64 | +/examples/webserver/webserver_example.py |
| 65 | +/examples/bme280.py |
| 66 | +/examples/sqlite3_example.py |
| 67 | +/examples/chinook.db |
| 68 | +/examples/wifi_example.py |
| 69 | +/examples/ssd1306_i2c_example.py |
| 70 | +/fonts [D] |
| 71 | +/fonts/arial_bold.fon |
| 72 | +/fonts/BigFont.fon |
| 73 | +/fonts/DejaVuSans12.fon |
| 74 | +/fonts/DejaVuSans18.fon |
| 75 | +/fonts/DejaVuSans24.fon |
| 76 | +/fonts/DotMatrix_M.fon |
| 77 | +/fonts/Grotesk24x48.fon |
| 78 | +/fonts/OCR_A_Extended_M.c |
| 79 | +/fonts/swiss721_outline.fon |
| 80 | +/fonts/Georgia128.fon |
| 81 | +/fonts/dot32.fon |
| 82 | +/fonts/lobo30.fon |
| 83 | +/lib [D] |
| 84 | +/www [D] |
| 85 | +/www/python.ico |
| 86 | +/www/favicon.ico |
| 87 | +/www/test.pyhtml |
| 88 | +/www/wstest.html |
| 89 | +/www/style.css |
| 90 | +/www/index.html |
| 91 | +/www/pdf.png |
| 92 | +/www/pdf-sample.pdf |
| 93 | +/boot.py |
| 94 | +
|
| 95 | +Image size: 1506897 (1507328) |
| 96 | +Saving image to 'maixpy_lfs.img' |
| 97 | +======================= |
| 98 | +
|
| 99 | +``` |
| 100 | + |
| 101 | +### Flash the image |
| 102 | + |
| 103 | +Change the working directory to `k210-freertos`. |
| 104 | + |
| 105 | +The image must be flashed to the file system start address defined in `mpconfigport.h` (`MICRO_PY_FLASHFS_START_ADDRESS`).<br> |
| 106 | +Default address is at 4MB (4194304). |
| 107 | + |
| 108 | +To flash it, execute: |
| 109 | +``` |
| 110 | +./kflash.py -p /dev/ttyUSB0 -b 2000000 --address 4194304 -t ../mklittlefs/maixpy_lfs.img |
| 111 | +``` |
| 112 | + |
| 113 | +Change */dev/ttyUSB0* to the port used to connect to the board if needed. |
| 114 | + |
| 115 | +--- |
| 116 | + |
0 commit comments