mirror of
https://github.com/DiUS/spiffsimg.git
synced 2025-05-08 20:40:34 +08:00
Some docs.
This commit is contained in:
parent
4e73803061
commit
d3028e3165
50
README.md
Normal file
50
README.md
Normal file
@ -0,0 +1,50 @@
|
||||
# spiffsimg - Manipulate SPI Flash File System disk images
|
||||
|
||||
Ever wished you could prepare a SPIFFS image offline and flash the whole
|
||||
thing onto your microprocessor's storage instead of painstakingly upload
|
||||
file-by-file through your app on the micro? With spiffsimg you can!
|
||||
|
||||
`Syntax: spiffsimg -f <filename> [-c size] [-l | -i | -r <scriptname> ]`
|
||||
|
||||
### Supported operations:
|
||||
|
||||
* Create (-c size) a blank disk image of the given size.
|
||||
* List (-l) the contents of the given disk image.
|
||||
* Interactive (-i) or scripted (-i) commands.
|
||||
|
||||
### Available commands:
|
||||
|
||||
* `ls` List contents. Output format is {type} {size} {name}.
|
||||
* `cat <filename>` Dump file contents to stdout.
|
||||
* `rm <filename>` Delete file.
|
||||
* `info` Display SPIFFS usage estimates.
|
||||
* `import <srcfile> <spiffsname>` Import a file into the disk image.
|
||||
* `export <spiffsname> <dstfile>` Export a file from the disk image.
|
||||
|
||||
### Example:
|
||||
```lua
|
||||
# spiffsimg -f flash.img -c 524288 -i
|
||||
> import myapp/lua/init.lua init.lua
|
||||
> import myapp/lua/httpd.lua httpd.lua
|
||||
> import myapp/html/index.html http/index.html
|
||||
> import myapp/html/favicon.ico http/favicon.ico
|
||||
> ls
|
||||
f 122 init.lua
|
||||
f 5169 httpd.lua
|
||||
f 2121 http/index.html
|
||||
f 880 http/favicon.ico
|
||||
>^D
|
||||
#
|
||||
```
|
||||
|
||||
### Known limitations:
|
||||
|
||||
* The file size has to be a multiple of the logical page size, 256.
|
||||
* The block & page sizes are currently hard-coded to 0x1000 and 0x100.
|
||||
* Error handling is not entirely consistent, some errors result in an
|
||||
early exit, others just print an error (both cause a non-zero exit though).
|
||||
* Only flat SPIFFS is supported.
|
||||
|
||||
|
||||
### See also:
|
||||
* The SPIFFS project: https://github.com/pellepl/spiffs
|
33
main.c
33
main.c
@ -1,3 +1,36 @@
|
||||
/*
|
||||
* Copyright 2015 Dius Computing Pty Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of the copyright holders nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @author Johny Mattsson <jmattsson@dius.com.au>
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user