1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

fix missed edits

This commit is contained in:
ficeto 2015-05-14 01:06:55 +03:00
parent 5d1ee7ace6
commit cfac2cacb1
2 changed files with 5 additions and 18 deletions

View File

@ -25,8 +25,6 @@
#define IRAM_ATTR __attribute__((section(".iram.text")))
#define STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
#define STORE_ATTR __attribute__((aligned(4)))
#define debugf(fmt, ...) os_printf(fmt"\r\n", ##__VA_ARGS__)
#define SYSTEM_ERROR(fmt, ...) os_printf("ERROR: " fmt "\r\n", ##__VA_ARGS__)
#define SPIFFS_CHACHE 0
@ -59,6 +57,8 @@ typedef uint8_t u8_t;
#endif
// compile time switches
#define debugf(fmt, ...) //os_printf(fmt"\r\n", ##__VA_ARGS__)
#define SYSTEM_ERROR(fmt, ...) //os_printf("ERROR: " fmt "\r\n", ##__VA_ARGS__)
// Set generic spiffs debug output call.
#ifndef SPIFFS_DGB

View File

@ -3,19 +3,10 @@
// Based on NodeMCU platform_flash
// https://github.com/nodemcu/nodemcu-firmware
extern char _flash_code_end[];
extern uint32_t _SPIFFS_start;
extern uint32_t _SPIFFS_end;
#define SPIFFS_PARTITION_SIZE() (uint32_t)(_SPIFFS_end - _SPIFFS_start)
#define CAN_FIT_ON_SPIFFS(a,l) (((a+l)-_SPIFFS_start) <= SPIFFS_PARTITION_SIZE())
uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size )
{
if(!CAN_FIT_ON_SPIFFS(toaddr,size)){
os_printf("File Out Of Bounds\n");
return 0;
}
uint32_t temp, rest, ssize = size;
unsigned i;
char tmpdata[ INTERNAL_FLASH_WRITE_UNIT_SIZE ];
@ -62,10 +53,6 @@ uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size )
uint32_t flashmem_read( void *to, uint32_t fromaddr, uint32_t size )
{
if(!CAN_FIT_ON_SPIFFS(fromaddr,size)){
os_printf("File Out Of Bounds\n");
return 0;
}
uint32_t temp, rest, ssize = size;
unsigned i;
char tmpdata[ INTERNAL_FLASH_READ_UNIT_SIZE ];
@ -224,13 +211,13 @@ uint32_t flashmem_read_internal( void *to, uint32_t fromaddr, uint32_t size )
}
uint32_t flashmem_get_first_free_block_address(){
if (_SPIFFS_start == 0){
debugf("_SPIFFS_start:%08x\n", _SPIFFS_start);
if ((uint32_t)&_SPIFFS_start == 0){
return 0;
}
debugf("_SPIFFS_start:%08x\n", (uint32_t)&_SPIFFS_start);
// Round the total used flash size to the closest flash block address
uint32_t end;
flashmem_find_sector( _SPIFFS_start - 1, NULL, &end);
flashmem_find_sector( (uint32_t)&_SPIFFS_start - 1, NULL, &end);
return end + 1;
}