Skip to content

Commit bf427f1

Browse files
ficetoficeto
ficeto
authored and
ficeto
committed
fix missed edits
1 parent 55c2a71 commit bf427f1

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#define IRAM_ATTR __attribute__((section(".iram.text")))
2626
#define STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
2727
#define STORE_ATTR __attribute__((aligned(4)))
28-
#define debugf(fmt, ...) os_printf(fmt"\r\n", ##__VA_ARGS__)
29-
#define SYSTEM_ERROR(fmt, ...) os_printf("ERROR: " fmt "\r\n", ##__VA_ARGS__)
3028

3129
#define SPIFFS_CHACHE 0
3230

@@ -59,6 +57,8 @@ typedef uint8_t u8_t;
5957
#endif
6058

6159
// compile time switches
60+
#define debugf(fmt, ...) //os_printf(fmt"\r\n", ##__VA_ARGS__)
61+
#define SYSTEM_ERROR(fmt, ...) //os_printf("ERROR: " fmt "\r\n", ##__VA_ARGS__)
6262

6363
// Set generic spiffs debug output call.
6464
#ifndef SPIFFS_DGB

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c

+3-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
// Based on NodeMCU platform_flash
44
// https://github.com/nodemcu/nodemcu-firmware
55

6-
extern char _flash_code_end[];
76
extern uint32_t _SPIFFS_start;
8-
extern uint32_t _SPIFFS_end;
9-
10-
#define SPIFFS_PARTITION_SIZE() (uint32_t)(_SPIFFS_end - _SPIFFS_start)
11-
#define CAN_FIT_ON_SPIFFS(a,l) (((a+l)-_SPIFFS_start) <= SPIFFS_PARTITION_SIZE())
127

138
uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size )
149
{
15-
if(!CAN_FIT_ON_SPIFFS(toaddr,size)){
16-
os_printf("File Out Of Bounds\n");
17-
return 0;
18-
}
1910
uint32_t temp, rest, ssize = size;
2011
unsigned i;
2112
char tmpdata[ INTERNAL_FLASH_WRITE_UNIT_SIZE ];
@@ -62,10 +53,6 @@ uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size )
6253

6354
uint32_t flashmem_read( void *to, uint32_t fromaddr, uint32_t size )
6455
{
65-
if(!CAN_FIT_ON_SPIFFS(fromaddr,size)){
66-
os_printf("File Out Of Bounds\n");
67-
return 0;
68-
}
6956
uint32_t temp, rest, ssize = size;
7057
unsigned i;
7158
char tmpdata[ INTERNAL_FLASH_READ_UNIT_SIZE ];
@@ -224,13 +211,13 @@ uint32_t flashmem_read_internal( void *to, uint32_t fromaddr, uint32_t size )
224211
}
225212

226213
uint32_t flashmem_get_first_free_block_address(){
227-
if (_SPIFFS_start == 0){
228-
debugf("_SPIFFS_start:%08x\n", _SPIFFS_start);
214+
if ((uint32_t)&_SPIFFS_start == 0){
229215
return 0;
230216
}
217+
debugf("_SPIFFS_start:%08x\n", (uint32_t)&_SPIFFS_start);
231218

232219
// Round the total used flash size to the closest flash block address
233220
uint32_t end;
234-
flashmem_find_sector( _SPIFFS_start - 1, NULL, &end);
221+
flashmem_find_sector( (uint32_t)&_SPIFFS_start - 1, NULL, &end);
235222
return end + 1;
236223
}

0 commit comments

Comments
 (0)