Skip to content

Commit 00eadea

Browse files
committed
Fix warnings, update readme, display version
1 parent b7a1332 commit 00eadea

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,29 @@ Tool to build and unpack [SPIFFS](https://github.com/pellepl/spiffs) images.
77

88
```
99
10-
./make_spiffs {-c <pack_dir>|-l} [-s <number>] [--] [--version] [-h]
11-
<image_file>
10+
./mkspiffs {-c <pack_dir>|-l|-i} [-b <number>] [-p <number>] [-s
11+
<number>] [--] [--version] [-h] <image_file>
1212
1313
1414
Where:
1515
1616
-c <pack_dir>, --create <pack_dir>
17-
(OR required) create spiffs image from a directory
17+
create spiffs image from a directory
1818
-- OR --
1919
-l, --list
20-
(OR required) list spiffs image to a directory
20+
list files in spiffs image
21+
-- OR --
22+
-i, --visualize
23+
visualize spiffs image
24+
2125
26+
-b <number>, --block <number>
27+
fs block size, in bytes
2228
23-
-s <number>, --fs_size <number>
29+
-p <number>, --page <number>
30+
fs page size, in bytes
31+
32+
-s <number>, --size <number>
2433
fs image size, in bytes
2534
2635
--, --ignore_rest
@@ -35,6 +44,7 @@ Where:
3544
<image_file>
3645
(required) spiffs image file
3746
47+
3848
```
3949

4050
## License
@@ -44,8 +54,7 @@ MIT
4454
## To do
4555

4656
- Error handling
47-
- Block and page size are hardcoded
48-
- Determing the image size automatically when opening a file
57+
- Determine the image size automatically when opening a file
4958
- Unpack
5059
- Automated builds
5160
- Code cleanup

main.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,15 @@ void spiffsMount(bool init)
8383
s_spiffsCache.resize((32 + s_pageSize) * maxOpenFiles);
8484

8585

86-
int res = SPIFFS_mount(&s_fs,
87-
&cfg,
88-
&s_spiffsWorkBuf[0],
89-
&s_spiffsFds[0],
90-
s_spiffsFds.size(),
91-
&s_spiffsCache[0],
92-
s_spiffsCache.size(),
93-
NULL);
86+
SPIFFS_mount(&s_fs, &cfg,
87+
&s_spiffsWorkBuf[0],
88+
&s_spiffsFds[0], s_spiffsFds.size(),
89+
&s_spiffsCache[0], s_spiffsCache.size(),
90+
NULL);
9491

9592
// debugf("mount res: %d\n", res);
9693
if (init) {
97-
spiffs_file fd = SPIFFS_open(&s_fs, "tmp", SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);
94+
spiffs_file fd = SPIFFS_open(&s_fs, (char*) "tmp", SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);
9895
uint8_t tmp = 0xff;
9996
SPIFFS_write(&s_fs, fd, &tmp, 1);
10097
SPIFFS_fremove(&s_fs, fd);
@@ -187,7 +184,7 @@ void listFiles() {
187184
spiffs_DIR dir;
188185
spiffs_dirent ent;
189186

190-
spiffs_DIR* res = SPIFFS_opendir(&s_fs, 0, &dir);
187+
SPIFFS_opendir(&s_fs, 0, &dir);
191188
spiffs_dirent* it;
192189
while (true) {
193190
it = SPIFFS_readdir(&dir, &ent);
@@ -264,7 +261,7 @@ int actionVisualize() {
264261

265262
void processArgs(int argc, const char** argv) {
266263

267-
TCLAP::CmdLine cmd("", ' ', "0.1");
264+
TCLAP::CmdLine cmd("", ' ', VERSION);
268265
TCLAP::ValueArg<std::string> packArg( "c", "create", "create spiffs image from a directory", true, "", "pack_dir");
269266
TCLAP::SwitchArg listArg( "l", "list", "list files in spiffs image", false);
270267
TCLAP::SwitchArg visualizeArg( "i", "visualize", "visualize spiffs image", false);

spiffs/spiffs_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ s32_t spiffs_phys_wr(
195195
cache->last_access++;
196196
cp->last_access = cache->last_access;
197197

198-
if (cp->flags && SPIFFS_CACHE_FLAG_WRTHRU) {
198+
if (cp->flags & SPIFFS_CACHE_FLAG_WRTHRU) {
199199
// page is being updated, no write-cache, just pass thru
200200
return fs->cfg.hal_write_f(addr, len, src);
201201
} else {

0 commit comments

Comments
 (0)