Skip to content

Commit 3c46e0b

Browse files
author
David Betz
committed
Add preliminary support for 1MB flash modules. The user filesystem
is very small in this case, less than 128k.
1 parent ab0d9c9 commit 3c46e0b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

parallax/roffs.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Connector to let httpd use the espfs filesystem to serve the files in it.
3030
#include "roffsformat.h"
3131

3232
// default filesystem base address in flash
33-
#define FLASH_FILESYSTEM_BASE 0x100000
33+
#define FLASH_FILESYSTEM_BASE_1M (1024*1024 - 128*1024)
34+
#define FLASH_FILESYSTEM_BASE_2M (1024*1024)
3435

3536
// open file structure
3637
struct ROFFS_FILE_STRUCT {
@@ -53,7 +54,20 @@ static int updateFlash(uint32_t addr, void *buf, int size);
5354

5455
uint32_t roffs_base_address(void)
5556
{
56-
return FLASH_FILESYSTEM_BASE;
57+
uint32_t base;
58+
switch (system_get_flash_size_map()) {
59+
case FLASH_SIZE_8M_MAP_512_512:
60+
base = FLASH_FILESYSTEM_BASE_1M;
61+
break;
62+
case FLASH_SIZE_16M_MAP_512_512:
63+
case FLASH_SIZE_32M_MAP_512_512:
64+
base = FLASH_FILESYSTEM_BASE_2M;
65+
break;
66+
default:
67+
base = 0;
68+
break;
69+
}
70+
return base;
5771
}
5872

5973
int ICACHE_FLASH_ATTR roffs_mount(uint32_t flashAddress)

0 commit comments

Comments
 (0)