parent
5ec77af844
commit
425e664114
|
@ -33,6 +33,9 @@ support floating point LUA.<br />
|
||||||
use macro LUA_NUMBER_INTEGRAL in user_config.h control this feature.<br />
|
use macro LUA_NUMBER_INTEGRAL in user_config.h control this feature.<br />
|
||||||
LUA_NUMBER_INTEGRAL to disable floating point support,<br />
|
LUA_NUMBER_INTEGRAL to disable floating point support,<br />
|
||||||
// LUA_NUMBER_INTEGRAL to enable floating point support.<br />
|
// LUA_NUMBER_INTEGRAL to enable floating point support.<br />
|
||||||
|
fix tmr.time(). #132<br />
|
||||||
|
fix filesystem length. #113<br />
|
||||||
|
fix ssl reboots. #134<br />
|
||||||
build pre_build bin.
|
build pre_build bin.
|
||||||
|
|
||||||
2015-01-26<br />
|
2015-01-26<br />
|
||||||
|
|
|
@ -26,7 +26,6 @@ SUBDIRS= \
|
||||||
driver \
|
driver \
|
||||||
lwip \
|
lwip \
|
||||||
json \
|
json \
|
||||||
ssl \
|
|
||||||
upgrade \
|
upgrade \
|
||||||
platform \
|
platform \
|
||||||
libc \
|
libc \
|
||||||
|
@ -73,7 +72,6 @@ COMPONENTS_eagle.app.v6 = \
|
||||||
driver/libdriver.a \
|
driver/libdriver.a \
|
||||||
lwip/liblwip.a \
|
lwip/liblwip.a \
|
||||||
json/libjson.a \
|
json/libjson.a \
|
||||||
ssl/libssl.a \
|
|
||||||
upgrade/libupgrade.a \
|
upgrade/libupgrade.a \
|
||||||
platform/libplatform.a \
|
platform/libplatform.a \
|
||||||
libc/liblibc.a \
|
libc/liblibc.a \
|
||||||
|
@ -102,6 +100,7 @@ LINKFLAGS_eagle.app.v6 = \
|
||||||
-lmain \
|
-lmain \
|
||||||
-ljson \
|
-ljson \
|
||||||
-lsmartconfig \
|
-lsmartconfig \
|
||||||
|
-lssl \
|
||||||
$(DEP_LIBS_eagle.app.v6) \
|
$(DEP_LIBS_eagle.app.v6) \
|
||||||
-Wl,--end-group
|
-Wl,--end-group
|
||||||
|
|
||||||
|
|
|
@ -148,31 +148,24 @@ static int tmr_wdclr( lua_State* L )
|
||||||
}
|
}
|
||||||
|
|
||||||
static os_timer_t rtc_timer_updator;
|
static os_timer_t rtc_timer_updator;
|
||||||
static unsigned rtc_second = 0; // TODO: load from rtc memory
|
|
||||||
static uint64_t cur_count = 0;
|
static uint64_t cur_count = 0;
|
||||||
static uint64_t rtc_count = 0;
|
static uint64_t rtc_us = 0;
|
||||||
void rtc_timer_update_cb(void *arg){
|
void rtc_timer_update_cb(void *arg){
|
||||||
uint64_t t = (uint64_t)system_get_rtc_time();
|
uint64_t t = (uint64_t)system_get_rtc_time();
|
||||||
|
uint64_t delta = (t>=cur_count)?(t - cur_count):(0x100000000 + t - cur_count);
|
||||||
// NODE_ERR("%x\n",t);
|
// NODE_ERR("%x\n",t);
|
||||||
if(t>=cur_count){
|
|
||||||
rtc_count += t - cur_count;
|
|
||||||
cur_count = t;
|
cur_count = t;
|
||||||
} else {
|
|
||||||
rtc_count += 0x100000000 + t - cur_count;
|
|
||||||
cur_count = t;
|
|
||||||
}
|
|
||||||
unsigned c = system_rtc_clock_cali_proc();
|
unsigned c = system_rtc_clock_cali_proc();
|
||||||
uint64_t itg = c >> 12;
|
uint64_t itg = c >> 12;
|
||||||
uint64_t dec = c & 0xFFF;
|
uint64_t dec = c & 0xFFF;
|
||||||
uint64_t second = (cur_count*itg + ((cur_count*dec)>>12)) / 1000000;
|
rtc_us += (delta*itg + ((delta*dec)>>12));
|
||||||
// NODE_ERR("%x\n",second);
|
// TODO: store rtc_us to rtc memory.
|
||||||
rtc_second = (unsigned)second;
|
|
||||||
// TODO: store rtc_count, rtc_second to rtc memory.
|
|
||||||
}
|
}
|
||||||
// Lua: time() , return rtc time in us
|
// Lua: time() , return rtc time in second
|
||||||
static int tmr_time( lua_State* L )
|
static int tmr_time( lua_State* L )
|
||||||
{
|
{
|
||||||
lua_pushinteger( L, rtc_second & 0x7FFFFFFF );
|
uint64_t local = rtc_us;
|
||||||
|
lua_pushinteger( L, ((uint32_t)(local/1000000)) & 0x7FFFFFFF );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ The small 4KB sectors allow for greater flexibility in applications th
|
||||||
void spiffs_mount() {
|
void spiffs_mount() {
|
||||||
spiffs_config cfg;
|
spiffs_config cfg;
|
||||||
cfg.phys_addr = ( u32_t )platform_flash_get_first_free_block_address( NULL );
|
cfg.phys_addr = ( u32_t )platform_flash_get_first_free_block_address( NULL );
|
||||||
|
cfg.phys_addr += 0x4000;
|
||||||
|
cfg.phys_addr &= 0xFFFFC000; // align to 4 sector.
|
||||||
cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS );
|
cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS );
|
||||||
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet
|
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet
|
||||||
cfg.log_block_size = INTERNAL_FLASH_SECTOR_SIZE; // let us not complicate things
|
cfg.log_block_size = INTERNAL_FLASH_SECTOR_SIZE; // let us not complicate things
|
||||||
|
@ -74,6 +76,8 @@ int myspiffs_format( void )
|
||||||
SPIFFS_unmount(&fs);
|
SPIFFS_unmount(&fs);
|
||||||
u32_t sect_first, sect_last;
|
u32_t sect_first, sect_last;
|
||||||
sect_first = ( u32_t )platform_flash_get_first_free_block_address( NULL );
|
sect_first = ( u32_t )platform_flash_get_first_free_block_address( NULL );
|
||||||
|
sect_first += 0x4000;
|
||||||
|
sect_first &= 0xFFFFC000; // align to 4 sector.
|
||||||
sect_first = platform_flash_get_sector_of_address(sect_first);
|
sect_first = platform_flash_get_sector_of_address(sect_first);
|
||||||
sect_last = INTERNAL_FLASH_SIZE + INTERNAL_FLASH_START_ADDRESS - 4;
|
sect_last = INTERNAL_FLASH_SIZE + INTERNAL_FLASH_START_ADDRESS - 4;
|
||||||
sect_last = platform_flash_get_sector_of_address(sect_last);
|
sect_last = platform_flash_get_sector_of_address(sect_last);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue