ESP8266 Developer Zone The Official ESP8266 Forum 2015-11-19T12:00:51+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1396 2015-11-19T12:00:51+08:00 2015-11-19T12:00:51+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1396&p=4661#p4661 <![CDATA[Re: how to config the spiffs and put a html file in the spi flash?]]>
i am change the parameter, as like this

Code:

// spiffs file system size
#define SPIFFS_FLASH_SIZE     (256*1024) //512 KB
// spiffs file system offset in emulated spi flash
#define SPIFFS_PHYS_ADDR      (592*1024) //512KB

#define SECTOR_SIZE         4096         //4KB
#define PHYS_ERASE_BLOCK    SECTOR_SIZE//(SECTOR_SIZE*16) //64KB
#define LOG_BLOCK           SECTOR_SIZE//(SECTOR_SIZE*16) //128KB
#define LOG_PAGE            256//(LOG_BLOCK/256) //256 byte


#define FD_BUF_SIZE     32*4
#define CACHE_BUF_SIZE  (LOG_PAGE + 32)*4



when init spiffs , it was success, but before success there are a lot the read fail!!!

spi_flash_read failed: 1 (606460, 8)
spi_flash_read failed: 1 (610556, 8)
spi_flash_read failed: 1 (614652, 8)
spi_flash_read failed: 1 (618748, 8)
spi_flash_read failed: 1 (622844, 8)
spi_flash_read failed: 1 (626940, 8)
spi_flash_read failed: 1 (631036, 8)
spi_flash_read failed: 1 (635132, 8)
spi_flash_read failed: 1 (639228, 8)
spi_flash_read failed: 1 (643324, 8)
spi_flash_read failed: 1 (647420, 8)
spi_flash_read failed: 1 (651516, 8)
spi_flash_read failed: 1 (655612, 8)
spi_flash_read failed: 1 (659708, 8)
spi_flash_read failed: 1 (663804, 8)
spi_flash_read failed: 1 (667900, 8)
spi_flash_read failed: 1 (671996, 8)
spi_flash_read failed: 1 (676092, 8)
spi_flash_read failed: 1 (680188, 8)
spi_flash_read failed: 1 (684284, 8)
spi_flash_read failed: 1 (688380, 8)
spi_flash_read failed: 1 (692476, 8)
spi_flash_read failed: 1 (696572, 8)
spi_flash_read failed: 1 (700668, 8)
spi_flash_read failed: 1 (704764, 8)
spi_flash_read failed: 1 (708860, 8)
spi_flash_read failed: 1 (712956, 8)
spi_flash_read failed: 1 (717052, 8)
spi_flash_read failed: 1 (721148, 8)
spi_flash_read failed: 1 (725244, 8)
spi_flash_read failed: 1 (729340, 8)
spi_flash_read failed: 1 (733436, 8)
spi_flash_read failed: 1 (737532, 8)
spi_flash_read failed: 1 (741628, 8)
spi_flash_read failed: 1 (745724, 8)
spi_flash_read failed: 1 (749820, 8)
spi_flash_read failed: 1 (753916, 8)
spi_flash_read failed: 1 (758012, 8)
spi_flash_read failed: 1 (762108, 8)
spi_flash_read failed: 1 (766204, 8)
spi_flash_read failed: 1 (770300, 8)
spi_flash_read failed: 1 (774396, 8)
spi_flash_read failed: 1 (778492, 8)
spi_flash_read failed: 1 (782588, 8)
spi_flash_read failed: 1 (786684, 8)
spi_flash_read failed: 1 (790780, 8)
spi_flash_read failed: 1 (794876, 8)
spi_flash_read failed: 1 (798972, 8)
spi_flash_read failed: 1 (803068, 8)
spi_flash_read failed: 1 (807164, 8)
spi_flash_read failed: 1 (811260, 8)
spi_flash_read failed: 1 (815356, 8)
spi_flash_read failed: 1 (819452, 8)
spi_flash_read failed: 1 (823548, 8)
spi_flash_read failed: 1 (827644, 8)
spi_flash_read failed: 1 (831740, 8)
spi_flash_read failed: 1 (835836, 8)
spi_flash_read failed: 1 (839932, 8)
spi_flash_read failed: 1 (844028, 8)
spi_flash_read failed: 1 (848124, 8)
spi_flash_read failed: 1 (852220, 8)
spi_flash_read failed: 1 (856316, 8)
spi_flash_read failed: 1 (860412, 8)
spi_flash_read failed: 1 (864508, 8)
spi_flash_read failed: 1 (868604, 8)
spi_flash_read failed: 1 (872700, 8)
spi_flash_read failed: 1 (876796, 8)
spi_flash_read failed: 1 (880892, 8)
spi_flash_read failed: 1 (884988, 8)
spi_flash_read failed: 1 (889084, 8)
spi_flash_read failed: 1 (893180, 8)
spi_flash_read failed: 1 (897276, 8)
spi_flash_read failed: 1 (901372, 8)
spi_flash_read failed: 1 (905468, 8)
spi_flash_read failed: 1 (909564, 8)
spi_flash_read failed: 1 (913660, 8)
spi_flash_read failed: 1 (917756, 8)
spi_flash_read failed: 1 (921852, 8)
spi_flash_read failed: 1 (925948, 8)
spi_flash_read failed: 1 (930044, 8)
spi_flash_read failed: 1 (934140, 8)
spi_flash_read failed: 1 (938236, 8)
spi_flash_read failed: 1 (942332, 8)
spi_flash_read failed: 1 (946428, 8)
spi_flash_read failed: 1 (950524, 8)
spi_flash_read failed: 1 (954620, 8)
spi_flash_read failed: 1 (958716, 8)
spi_flash_read failed: 1 (962812, 8)
spi_flash_read failed: 1 (966908, 8)
spi_flash_read failed: 1 (971004, 8)
spi_flash_read failed: 1 (975100, 8)
spi_flash_read failed: 1 (979196, 8)
spi_flash_read failed: 1 (983292, 8)
spi_flash_read failed: 1 (987388, 8)
spi_flash_read failed: 1 (991484, 8)
spi_flash_read failed: 1 (995580, 8)
spi_flash_read failed: 1 (999676, 8)
spi_flash_read failed: 1 (1003772, 8)
spi_flash_read failed: 1 (1007868, 8)
spi_flash_read failed: 1 (1011964, 8)
spi_flash_read failed: 1 (1016060, 8)
spi_flash_read failed: 1 (1020156, 8)
spi_flash_read failed: 1 (1024252, 8)
spi_flash_read failed: 1 (1028348, 8)
spi_flash_read failed: 1 (1032444, 8)
spi_flash_read failed: 1 (1036540, 8)
spi_flash_read failed: 1 (1040636, 8)
spi_flash_read failed: 1 (1044732, 8)
spi_flash_read failed: 1 (1048828, 8)
spi_flash_read failed: 1 (1052924, 8)
spi_flash_read failed: 1 (1057020, 8)
spi_flash_read failed: 1 (1061116, 8)
spi_flash_read failed: 1 (1065212, 8)
spi_flash_read failed: 1 (1069308, 8)
spi_flash_read failed: 1 (1073404, 8)
spi_flash_read failed: 1 (1077500, 8)
spi_flash_read failed: 1 (1081596, 8)
spi_flash_read failed: 1 (1085692, 8)
spi_flash_read failed: 1 (1089788, 8)
spi_flash_read failed: 1 (1093884, 8)
spi_flash_read failed: 1 (1097980, 8)
spi_flash_read failed: 1 (1102076, 8)
spi_flash_read failed: 1 (1106172, 8)
spi_flash_read failed: 1 (1110268, 8)
spi_flash_read failed: 1 (1114364, 8)
spi_flash_read failed: 1 (1118460, 8)
spi_flash_read failed: 1 (1122556, 8)
spi_flash_read failed: 1 (1126652, 8)
spi_flash_read failed: 1 (1130748, 8)
spi_flash_read failed: 1 (1134844, 8)
spi_flash_read failed: 1 (1138940, 8)
spi_flash_read failed: 1 (1143036, 8)
spi_flash_read failed: 1 (1147132, 8)
spi_flash_read failed: 1 (1151228, 8)
spi_flash_read failed: 1 (1155324, 8)
spi_flash_read failed: 1 (1159420, 8)
spi_flash_read failed: 1 (1163516, 8)
spi_flash_read failed: 1 (1167612, 8)
spi_flash_read failed: 1 (1171708, 8)
spi_flash_read failed: 1 (1175804, 8)
spi_flash_read failed: 1 (1179900, 8)
spi_flash_read failed: 1 (1183996, 8)
spi_flash_read failed: 1 (1188092, 8)
spi_flash_read failed: 1 (1192188, 8)
spi_flash_read failed: 1 (1196284, 8)
spi_flash_read failed: 1 (1200380, 8)
spi_flash_read failed: 1 (1204476, 8)
spi_flash_read failed: 1 (1208572, 8)
spi_flash_read failed: 1 (1212668, 8)
spi_flash_read failed: 1 (1216764, 8)
spi_flash_read failed: 1 (1220860, 8)
spi_flash_read failed: 1 (1224956, 8)
spi_flash_read failed: 1 (1229052, 8)
spi_flash_read failed: 1 (1233148, 8)
spi_flash_read failed: 1 (1237244, 8)
spi_flash_read failed: 1 (1241340, 8)
spi_flash_read failed: 1 (1245436, 8)
spi_flash_read failed: 1 (1249532, 8)
spi_flash_read failed: 1 (1253628, 8)
spi_flash_read failed: 1 (1257724, 8)
spi_flash_read failed: 1 (1261820, 8)
spi_flash_read failed: 1 (1265916, 8)
spi_flash_read failed: 1 (1270012, 8)
spi_flash_read failed: 1 (1274108, 8)
spi_flash_read failed: 1 (1278204, 8)
spi_flash_read failed: 1 (1282300, 8)
spi_flash_read failed: 1 (1286396, 8)
spi_flash_read failed: 1 (1290492, 8)
spi_flash_read failed: 1 (1294588, 8)
spi_flash_read failed: 1 (1298684, 8)
spi_flash_read failed: 1 (1302780, 8)
spi_flash_read failed: 1 (1306876, 8)
spi_flash_read failed: 1 (1310972, 8)
spi_flash_read failed: 1 (1315068, 8)
spi_flash_read failed: 1 (1319164, 8)
spi_flash_read failed: 1 (1323260, 8)
spi_flash_read failed: 1 (1327356, 8)
spi_flash_read failed: 1 (1331452, 8)
spi_flash_read failed: 1 (1335548, 8)
spi_flash_read failed: 1 (1339644, 8)
spi_flash_read failed: 1 (1343740, 8)
spi_flash_read failed: 1 (1347836, 8)
spi_flash_read failed: 1 (1351932, 8)
spi_flash_read failed: 1 (1356028, 8)
spi_flash_read failed: 1 (1360124, 8)
spi_flash_read failed: 1 (1364220, 8)
spi_flash_read failed: 1 (1368316, 8)
spi_flash_read failed: 1 (1372412, 8)
spi_flash_read failed: 1 (1376508, 8)
spi_flash_read failed: 1 (1380604, 8)
spi_flash_read failed: 1 (1384700, 8)
spi_flash_read failed: 1 (1388796, 8)
spi_flash_read failed: 1 (1392892, 8)
spi_flash_read failed: 1 (1396988, 8)
spi_flash_read failed: 1 (1401084, 8)
spi_flash_read failed: 1 (1405180, 8)
spi_flash_read failed: 1 (1409276, 8)
spi_flash_read failed: 1 (1413372, 8)
spi_flash_read failed: 1 (1417468, 8)
spi_flash_read failed: 1 (1421564, 8)
spi_flash_read failed: 1 (1425660, 8)
spi_flash_read failed: 1 (1429756, 8)
spi_flash_read failed: 1 (1433852, 8)
spi_flash_read failed: 1 (1437948, 8)
spi_flash_read failed: 1 (1442044, 8)
spi_flash_read failed: 1 (1446140, 8)
spi_flash_read failed: 1 (1450236, 8)
spi_flash_read failed: 1 (1454332, 8)
spi_flash_read failed: 1 (1458428, 8)
spi_flash_read failed: 1 (1462524, 8)
spi_flash_read failed: 1 (1466620, 8)
spi_flash_read failed: 1 (1470716, 8)
spi_flash_read failed: 1 (1474812, 8)
spi_flash_read failed: 1 (1478908, 8)
spi_flash_read failed: 1 (1483004, 8)
spi_flash_read failed: 1 (1487100, 8)
spi_flash_read failed: 1 (1491196, 8)
spi_flash_read failed: 1 (1495292, 8)
spi_flash_read failed: 1 (1499388, 8)
spi_flash_read failed: 1 (1503484, 8)
spi_flash_read failed: 1 (1507580, 8)
spi_flash_read failed: 1 (1511676, 8)
spi_flash_read failed: 1 (1515772, 8)
spi_flash_read failed: 1 (1519868, 8)
spi_flash_read failed: 1 (1523964, 8)
spi_flash_read failed: 1 (1528060, 8)
spi_flash_read failed: 1 (1532156, 8)
spi_flash_read failed: 1 (1536252, 8)
spi_flash_read failed: 1 (1540348, 8)
spi_flash_read failed: 1 (1544444, 8)
spi_flash_read failed: 1 (1548540, 8)
spi_flash_read failed: 1 (1552636, 8)
spi_flash_read failed: 1 (1556732, 8)
spi_flash_read failed: 1 (1560828, 8)
spi_flash_read failed: 1 (1564924, 8)
spi_flash_read failed: 1 (1569020, 8)
spi_flash_read failed: 1 (1573116, 8)
spi_flash_read failed: 1 (1577212, 8)
spi_flash_read failed: 1 (1581308, 8)
spi_flash_read failed: 1 (1585404, 8)
spi_flash_read failed: 1 (1589500, 8)
spi_flash_read failed: 1 (1593596, 8)
spi_flash_read failed: 1 (1597692, 8)
spi_flash_read failed: 1 (1601788, 8)
spi_flash_read failed: 1 (1605884, 8)
spi_flash_read failed: 1 (1609980, 8)
spi_flash_read failed: 1 (1614076, 8)
spi_flash_read failed: 1 (1618172, 8)
spi_flash_read failed: 1 (1622268, 8)
spi_flash_read failed: 1 (1626364, 8)
spi_flash_read failed: 1 (1630460, 8)
spi_flash_read failed: 1 (1634556, 8)
spi_flash_read failed: 1 (1638652, 8)
spi_flash_read failed: 1 (1642748, 8)
spi_flash_read failed: 1 (1646844, 8)
spi_flash_read failed: 1 (1650940, 8)
spi_flash_read failed: 1 (606208, 260)
spiffs config succes

do you know why ?

Statistics: Posted by marhc_seven — Thu Nov 19, 2015 12:00 pm


]]>
2015-11-18T23:49:00+08:00 2015-11-18T23:49:00+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1396&p=4653#p4653 <![CDATA[Re: how to config the spiffs and put a html file in the spi flash?]]>
marhc_seven wrote:
2MB is this means the spiffs file system size or the actual flash IC capacity ?

I forgot to show how I mount the SPIFFS.

Code:

#define LOG_PAGE_SIZE                    256
#define FLASH_SECTOR_SIZE                4096

static s32_t flash_read(u32_t addr, u32_t size, u8_t *dst);
static s32_t flash_write(u32_t addr, u32_t size, u8_t *src);
static s32_t flash_erase(u32_t addr, u32_t size);

static u8_t spiffs_work_buf[LOG_PAGE_SIZE * 2];
static u8_t spiffs_fds[32 * 4];
static u8_t spiffs_cache_buf[(LOG_PAGE_SIZE + 32) * 4];

int16_t ZB_FUNC_ATTR_NORMAL
zbFlashMount(uint32_t addr, uint32_t size)
{
    int result;
    spiffs_config cfg;

    cfg.phys_size = size;
    cfg.phys_addr = addr;
    cfg.phys_erase_block = FLASH_SECTOR_SIZE;
    cfg.log_block_size = FLASH_SECTOR_SIZE;
    cfg.log_page_size = LOG_PAGE_SIZE;

    cfg.hal_read_f = flash_read;
    cfg.hal_write_f = flash_write;
    cfg.hal_erase_f = flash_erase;

    result = SPIFFS_mount(&zb_SPIFFS_fs, &cfg, spiffs_work_buf, spiffs_fds, sizeof(spiffs_fds),
            spiffs_cache_buf, sizeof(spiffs_cache_buf), NULL);
    return(result);
}

The starting address in the Flash and the size of the file system are passed in. The other parameters are hard-coded as you see. The helper functions flash_read(), flash_write(), and flash_erase() are intermediaries between SPIFFS and other routines that I used generally to read, write and erase Flash blocks.

marhc_seven wrote:
if there are more than one html file need to be stored. when i want to store them in the flash IC.
is that ordered ?which one should be put in the first and which one should be second, and so on ?
The order doesn't matter - it's a File System. You access the content using a file system metaphor, i.e. open by name, read content, close the file.

As for the linker script questions, there is ample documentation in many places on the Internet that describe gcc linker scripts. In my previous post I recommended looking at working code such as nodemcu. I reiterate that recommendation.

Statistics: Posted by dkinzer — Wed Nov 18, 2015 11:49 pm


]]>
2015-11-18T11:53:59+08:00 2015-11-18T11:53:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1396&p=4643#p4643 <![CDATA[Re: how to config the spiffs and put a html file in the spi flash?]]> but as your reply , i have som questions,i am looking forward your help .

Q1:

#define SPIFFS_CFG_PHYS_SZ(ignore) (1024*1024*2) ====》
2MB is this means the spiffs file system size or the actual flash IC capacity ?
(eg. W25X80 means this parameter should vauled 1024*1024*1 ) that made me so confused.


#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (65536) ===>
#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (65536) ===>
it is clear that the TECH_SPEC file noting as like below

“The boundary of a logical block must coincide with one or more physical blocks”

so i know this is related to the (hardware) flash IC data struction.
and the datasheet showing that the block size is 64KB .
so there is also not any problem with PHY_ERASE_SZ.

#define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (256)
and follow the TECH_SPC, it supply a the golden rule
~~~ Logical Page Size = Logical Block Size / 256 ~~~
maybe we could change whatever we want, but at this moment , we don't need to be entagled with it .
just do it !!!

Q2:

[/b]#define SPIFFS_CFG_PHYS_ADDR(ignore) (0) ===> [/b]
i konw this parameter will set SPIFFS area begins, but i don't konw the actual vualed how related with the actual flash address

eg:when it being set 0, is that mean SPIFFS begin 0x0000 =====》
OMG, 0x0000----->the first 4KB stroing the Bootloader , is it ? how could we alway set SPIFFS here ?
which part i make a mistake upstair ?

eg : OK, if we follow

https://github.com/pellepl/spiffs/blob/master/docs/TECH_SPEC
test code
#define SPIFFS_PHYS_ADDR (4*1024*1024)
#define SPIFFS_FLASH_SIZE (2*1024*1024)

is that mean SPIFFS Beigin 0X400000(4MB) -----------(2MB) -----------End 0X600000
so when we image a html file and want to flash, we should set the vual as 0x40210000+0x400000= 0x40610000

Q3


If you're using a the standard linker script, there is unused space between 0x10000 and 0x40000. That would allow a SPIFFS area as large as 192KB without needing to modify the linker script.


192KB is not enough for my application. so i think i should enlarge it.
so i choose to position SPIFFS just before the system parameters area, and therebefore i should make clear of the eagle.app.v6.ld
But although i have reading again and again ,but also confussed.

NOTICE:
6. system param area:
/* 1>. 512KB--->0x07b000*/ ========> 0x07b000 ==> 492KB ===> if we add 16KB (system param area size) ==>508KB ≠ 512KB
/* 2>. 1MB----->0x0fb000 */ ========> 0x0fb000 ==> 1004KB ===> if we add 16KB (system param area size) ==>1020KB ≠ 1024KB
/* 3>. 2MB----->0x1fb000 */ ....
/* 4>. 4MB----->0x3fb000 */ ....

all of them are less 4KB, so how could i set the offset value

eg: For ESP-01 board (1MB)
----> Calculate the begin of SPIFFS
1024KB-16KB(system param area size) - 256KB(SPIFFS size) = 752KB
----> transform beigin address
752KB =====> 0XBC000

-----> Logic map
|------------------------------------------------------------------------|-----------------------|---------|
^ 752KB ^ 256KB ^ 16KB ^
0x0000 (SPIFFS Begin)0XBC000 (End)

and my memory set

Code:

MEMORY
{
  dport0_0_seg :                         org = 0x3FF00000, len = 0x10
  dram0_0_seg :                          org = 0x3FFE8000, len = 0x18000
  iram1_0_seg :                          org = 0x40100000, len = 0x8000
  irom0_0_seg :                          org = 0x40210000, len = 0xfc000
}



code settinig

Code:

// total emulated spi flash size
#define PHYS_FLASH_SIZE       (1*1024*1024) //1MB
// spiffs file system size
#define SPIFFS_FLASH_SIZE     (256*1024) //512 KB
// spiffs file system offset in emulated spi flash
#define SPIFFS_PHYS_ADDR      (752*1024) //begin from 752KB  ====>  0xbc000

#define SECTOR_SIZE         4096         //4KB
#define PHYS_ERASE_BLOCK   (SECTOR_SIZE*16) //64KB
#define LOG_BLOCK           (SECTOR_SIZE*16) //128KB
#define LOG_PAGE            (LOG_BLOCK/256) //256 byte

#define FD_BUF_SIZE     64*6
#define CACHE_BUF_SIZE  (LOG_PAGE + 32)*8


and just doing the esp_spiffs_init(); it puts out

Code:

 
 spi_flash_read failed: 1 (1360380, 8)
spi_flash_read failed: 1 (1425916, 8)
spi_flash_read failed: 1 (1491452, 8)
spi_flash_read failed: 1 (1556988, 8)
spi_flash_read failed: 1 (1622524, 8)
spi_flash_read failed: 1 (1688060, 8)
spi_flash_read failed: 1 (1753596, 8)
spi_flash_read failed: 1 (770048, 260)
spiffs config succes
"Spiffs"(stack_size = 4,task handle = 3fff3848) overflow the heap_size.
"Spiffs"(stack_size = 4,task handle = 3fff3848) overflow the heap_size.
"Spiffs"(stack_size = 4,task handle = 3fff3848) overflow the heap_size.
...
...


like you said ,i get an error. but i don't konw what is the problem of this process!!!
which part i make a mistake ?



but if you don't modify the linker script to account for the Flash you removed for SPIFFS you won't get an error when the size of your application causes it to overlap the SPIFFS area.


this word make me confussed of how to change the linker script for fit the upstair case .



Q3:

What is the mean of org in eagle.app.v6.ld

org = 0x3FF00000 , is that the address ?



Q4:

if there are more than one html file need to be stored. when i want to store them in the flash IC.
is that ordered ?
what i mean is , which one should be put in the first and which one should be second, and so on ?
or just flash in the area after the begining of SPIFFS。

Statistics: Posted by marhc_seven — Wed Nov 18, 2015 11:53 am


]]>
2015-11-18T00:23:13+08:00 2015-11-18T00:23:13+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1396&p=4635#p4635 <![CDATA[Re: how to config the spiffs and put a html file in the spi flash?]]>
marhc_seven wrote:
I am using RTOS SDK which supply spiffs.h there are some parameters should be configed before we using spiffs
I would recommend looking at some code that uses SPIFFS, e.g. nodemcu. I use SPIFFS in my code but I use the SINGLETON mode where the configuration parameters are specified in spiffs_config.h:

Code:

#define SPIFFS_CFG_PHYS_SZ(ignore)        (1024*1024*2)
#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore)  (65536)
#define SPIFFS_CFG_PHYS_ADDR(ignore)      (0)
#define SPIFFS_CFG_LOG_PAGE_SZ(ignore)    (256)
#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore)   (65536)

marhc_seven wrote:
actually the datasheet of W25X80 (1MB flash)shows the block size only one type and it is 64KB
But if you read more carefully you'll see that 4KB blocks can be erased and written.

marhc_seven wrote:
what does SPIFFS_PHYS_ADDR mean, offset in the emulated spi flash
It means where in the Flash chips should the SPIFFS area begins, relative to address 0 of the Flash chip. Where you actually put it depends on how you link your ESP8266 application. You could position it just before the system parameters area (which is always located 16K from the end of Flash) but if you don't modify the linker script to account for the Flash you removed for SPIFFS you won't get an error when the size of your application causes it to overlap the SPIFFS area.

If you're using a the standard linker script, there is unused space between 0x10000 and 0x40000. That would allow a SPIFFS area as large as 192KB without needing to modify the linker script.

marhc_seven wrote:
if we want to put a html file in this file system, how could we do?
Search for "spiffy" on github. It's an application that builds a SPIFFS image using the files in a directory. After you have the image built you can install it in Flash at your chosen address using any of the available download tools.

Statistics: Posted by dkinzer — Wed Nov 18, 2015 12:23 am


]]>
2015-11-17T14:21:42+08:00 2015-11-17T14:21:42+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1396&p=4629#p4629 <![CDATA[how to config the spiffs and put a html file in the spi flash?]]>
I am using RTOS SDK which supply spiffs.h
there are some parameters should be configed before we using spiffs

Code:

struct esp_spiffs_config {
    uint32 phys_size;        /**< physical size of the SPI Flash */
    uint32 phys_addr;        /**< physical offset in spi flash used for spiffs, must be on block boundary */
    uint32 phys_erase_block; /**< physical size when erasing a block */

    uint32 log_block_size;   /**< logical size of a block, must be on physical block size boundary and must never be less than a physical block */
    uint32 log_page_size;    /**< logical size of a page, at least log_block_size/8  */

    uint32 fd_buf_size;      /**< file descriptor memory area size */
    uint32 cache_buf_size;   /**< cache buffer size */
};



when i using ESP-01(1MB flash), how could i init the parameter of spiffs
and how about ESP-12(4MB flash)

when i looking the github :https://github.com/pellepl/spiffs/blob/master/docs/TECH_SPEC

68 PHYSICAL FLASH BLOCKS SPIFFS LOGICAL BLOCKS: 128kB
69

70 +-----------------------+ - - - +-----------------------+
71 | Block 1 : 16kB | | Block 1 : 128kB |
72 +-----------------------+ | |
73 | Block 2 : 16kB | | |
74 +-----------------------+ | |
75 | Block 3 : 16kB | | |
76 +-----------------------+ | |
77 | Block 4 : 16kB | | |
78 +-----------------------+ | |
79 | Block 5 : 64kB | | |
80 +-----------------------+ - - - +-----------------------+
81 | Block 6 : 64kB | | Block 2 : 128kB |
82 +-----------------------+ | |
83 | Block 7 : 64kB | | |
84 +-----------------------+ - - - +-----------------------+
85 | Block 8 : 64kB | | Block 3 : 128kB |
86 +-----------------------+ | |
87 | Block 9 : 64kB | | |
88 +-----------------------+ - - - +-----------------------+
89 | ... | | ... |


1. why there is a block which size is 16kB? actually the datasheet of W25X80 (1MB flash)shows the block size only one type
and it is 64KB

pellepl has supply one test code , and it was config as below:

Code:

// total emulated spi flash size
 #define PHYS_FLASH_SIZE       (16*1024*1024)
// spiffs file system size
 #define SPIFFS_FLASH_SIZE     (2*1024*1024)
 // spiffs file system offset in emulated spi flash
 #define SPIFFS_PHYS_ADDR      (4*1024*1024)

#define SECTOR_SIZE         65536
#define LOG_BLOCK           (SECTOR_SIZE*2)
#define LOG_PAGE            (SECTOR_SIZE/256)

#define FD_BUF_SIZE     64*6
#define CACHE_BUF_SIZE  (LOG_PAGE + 32)*8


2. why does PHYS_FLASH_SIZE is 16MB, total emulated spi flash size ????
is that mean the extern flash IC size? W25X80(ESP-01)=====>PHYS_FLASH_SIZE ====>1MB
W25X32(ESP-12)=====>PHYS_FLASH_SIZE ====>4MB

3. what does SPIFFS_PHYS_ADDR mean, offset in the emulated spi flash?
i found that eagle.app.v6.ld files show below:
offset 4MB, could you please tell offset to where ????
from where to where????

/* Flash Map, support 512KB/1MB/2MB/4MB SPI Flash */
/* |......|..............................|..........................|.....|....| */
/* ^ ^ ^ ^ ^ */
/* |_flash.bin start(0x0000) |_irom0text.bin start(0x40000) | */
/* |_flash.bin end |_irom0text.bin end */
/* |_system param area(0x7b000) */

4. SECTOR_SIZE is 65536 ??? what does this mean ???
as i found that all of the flash IC sector size is 4KB (4096) ,what does this sector size mean???


ok we bakc for the config struct , if we want to put a html file in this file system, how could we do?

Statistics: Posted by marhc_seven — Tue Nov 17, 2015 2:21 pm


]]>