Merge branch 'dev096' of https://github.com/nodemcu/nodemcu-firmware
This commit is contained in:
commit
f51b47258d
|
@ -27,8 +27,8 @@ Tencent QQ group: 309957875<br />
|
||||||
- fix wifi smart connect
|
- fix wifi smart connect
|
||||||
- add spi module (done)
|
- add spi module (done)
|
||||||
- add mqtt module (done)
|
- add mqtt module (done)
|
||||||
- add coap module
|
- add coap module (in coap branch)
|
||||||
- cross compiler
|
- cross compiler (done)
|
||||||
|
|
||||||
# Change log
|
# Change log
|
||||||
2015-02-13<br />
|
2015-02-13<br />
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
#define NODE_VERSION_MAJOR 0U
|
#define NODE_VERSION_MAJOR 0U
|
||||||
#define NODE_VERSION_MINOR 9U
|
#define NODE_VERSION_MINOR 9U
|
||||||
#define NODE_VERSION_REVISION 5U
|
#define NODE_VERSION_REVISION 6U
|
||||||
#define NODE_VERSION_INTERNAL 0U
|
#define NODE_VERSION_INTERNAL 0U
|
||||||
|
|
||||||
#define NODE_VERSION "NodeMCU 0.9.5"
|
#define NODE_VERSION "NodeMCU 0.9.6"
|
||||||
#define BUILD_DATE "build 20150213"
|
#define BUILD_DATE "build 20150216"
|
||||||
|
|
||||||
// #define DEVKIT_VERSION_0_9 1 // define this only if you use NodeMCU devkit v0.9
|
// #define DEVKIT_VERSION_0_9 1 // define this only if you use NodeMCU devkit v0.9
|
||||||
|
|
||||||
|
@ -77,8 +77,6 @@
|
||||||
#endif /* LUA_USE_DEVICE_DRIVER */
|
#endif /* LUA_USE_DEVICE_DRIVER */
|
||||||
|
|
||||||
|
|
||||||
// #define LUA_NUMBER_INTEGRAL
|
|
||||||
|
|
||||||
#define LUA_OPTRAM
|
#define LUA_OPTRAM
|
||||||
#ifdef LUA_OPTRAM
|
#ifdef LUA_OPTRAM
|
||||||
#define LUA_OPTIMIZE_MEMORY 2
|
#define LUA_OPTIMIZE_MEMORY 2
|
||||||
|
|
|
@ -692,6 +692,8 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
|
||||||
lf.f = fs_open(filename, FS_RDONLY);
|
lf.f = fs_open(filename, FS_RDONLY);
|
||||||
if (lf.f < FS_OPEN_OK) return errfsfile(L, "open", fnameindex);
|
if (lf.f < FS_OPEN_OK) return errfsfile(L, "open", fnameindex);
|
||||||
}
|
}
|
||||||
|
// if(fs_size(lf.f)>LUAL_BUFFERSIZE)
|
||||||
|
// return luaL_error(L, "file is too big");
|
||||||
c = fs_getc(lf.f);
|
c = fs_getc(lf.f);
|
||||||
if (c == '#') { /* Unix exec. file? */
|
if (c == '#') { /* Unix exec. file? */
|
||||||
lf.extraline = 1;
|
lf.extraline = 1;
|
||||||
|
|
|
@ -542,7 +542,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
|
||||||
/*
|
/*
|
||||||
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
|
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
|
||||||
*/
|
*/
|
||||||
#define LUAL_BUFFERSIZE (BUFSIZ*4)
|
#define LUAL_BUFFERSIZE ((BUFSIZ)*4)
|
||||||
|
|
||||||
/* }================================================================== */
|
/* }================================================================== */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* FunctionName : espconn_init
|
||||||
|
* Description : dummy the espconn_init
|
||||||
|
* Parameters : none
|
||||||
|
* Returns : none
|
||||||
|
*******************************************************************************/
|
||||||
|
void espconn_init()
|
||||||
|
{
|
||||||
|
// dummy function, do nothing.
|
||||||
|
}
|
|
@ -1241,6 +1241,31 @@ static int net_socket_unhold( lua_State* L )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lua: ip,port = sk:getpeer()
|
||||||
|
static int net_socket_getpeer( lua_State* L )
|
||||||
|
{
|
||||||
|
lnet_userdata *nud;
|
||||||
|
const char *mt = "net.socket";
|
||||||
|
nud = (lnet_userdata *)luaL_checkudata(L, 1, mt);
|
||||||
|
luaL_argcheck(L, nud, 1, "Server/Socket expected");
|
||||||
|
|
||||||
|
if(nud!=NULL && nud->pesp_conn!=NULL ){
|
||||||
|
char temp[20] = {0};
|
||||||
|
c_sprintf(temp, IPSTR, IP2STR( &(nud->pesp_conn->proto.tcp->remote_ip) ) );
|
||||||
|
if ( nud->pesp_conn->proto.tcp->remote_port != 0 ) {
|
||||||
|
lua_pushstring( L, temp );
|
||||||
|
lua_pushinteger( L, nud->pesp_conn->proto.tcp->remote_port );
|
||||||
|
} else {
|
||||||
|
lua_pushnil( L );
|
||||||
|
lua_pushnil( L );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lua_pushnil( L );
|
||||||
|
lua_pushnil( L );
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
// Lua: socket:dns( string, function(ip) )
|
// Lua: socket:dns( string, function(ip) )
|
||||||
static int net_socket_dns( lua_State* L )
|
static int net_socket_dns( lua_State* L )
|
||||||
{
|
{
|
||||||
|
@ -1302,6 +1327,7 @@ static const LUA_REG_TYPE net_socket_map[] =
|
||||||
{ LSTRKEY( "hold" ), LFUNCVAL ( net_socket_hold ) },
|
{ LSTRKEY( "hold" ), LFUNCVAL ( net_socket_hold ) },
|
||||||
{ LSTRKEY( "unhold" ), LFUNCVAL ( net_socket_unhold ) },
|
{ LSTRKEY( "unhold" ), LFUNCVAL ( net_socket_unhold ) },
|
||||||
{ LSTRKEY( "dns" ), LFUNCVAL ( net_socket_dns ) },
|
{ LSTRKEY( "dns" ), LFUNCVAL ( net_socket_dns ) },
|
||||||
|
{ LSTRKEY( "getpeer" ), LFUNCVAL ( net_socket_getpeer ) },
|
||||||
// { LSTRKEY( "delete" ), LFUNCVAL ( net_socket_delete ) },
|
// { LSTRKEY( "delete" ), LFUNCVAL ( net_socket_delete ) },
|
||||||
{ LSTRKEY( "__gc" ), LFUNCVAL ( net_socket_delete ) },
|
{ LSTRKEY( "__gc" ), LFUNCVAL ( net_socket_delete ) },
|
||||||
#if LUA_OPTIMIZE_MEMORY > 0
|
#if LUA_OPTIMIZE_MEMORY > 0
|
||||||
|
|
|
@ -95,6 +95,7 @@ static int node_chipid( lua_State* L )
|
||||||
// Lua: readvdd33()
|
// Lua: readvdd33()
|
||||||
static int node_readvdd33( lua_State* L )
|
static int node_readvdd33( lua_State* L )
|
||||||
{
|
{
|
||||||
|
// uint32_t vdd33 = system_get_vdd33();
|
||||||
uint32_t vdd33 = readvdd33();
|
uint32_t vdd33 = readvdd33();
|
||||||
lua_pushinteger(L, vdd33);
|
lua_pushinteger(L, vdd33);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -24,6 +24,7 @@ SPIFlashInfo flash_get_info(void)
|
||||||
{
|
{
|
||||||
volatile SPIFlashInfo spi_flash_info ICACHE_STORE_ATTR;
|
volatile SPIFlashInfo spi_flash_info ICACHE_STORE_ATTR;
|
||||||
spi_flash_info = *((SPIFlashInfo *)(FLASH_MAP_START_ADDRESS));
|
spi_flash_info = *((SPIFlashInfo *)(FLASH_MAP_START_ADDRESS));
|
||||||
|
// spi_flash_read(0, (uint32 *)(& spi_flash_info), sizeof(spi_flash_info));
|
||||||
return spi_flash_info;
|
return spi_flash_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +57,11 @@ uint32_t flash_get_size_byte(void)
|
||||||
case SIZE_32MBIT:
|
case SIZE_32MBIT:
|
||||||
// 32Mbit, 4MByte
|
// 32Mbit, 4MByte
|
||||||
flash_size = 4 * 1024 * 1024;
|
flash_size = 4 * 1024 * 1024;
|
||||||
|
break;
|
||||||
case SIZE_64MBIT:
|
case SIZE_64MBIT:
|
||||||
// 64Mbit, 8MByte
|
// 64Mbit, 8MByte
|
||||||
flash_size = 8 * 1024 * 1024;
|
flash_size = 8 * 1024 * 1024;
|
||||||
|
break;
|
||||||
case SIZE_128MBIT:
|
case SIZE_128MBIT:
|
||||||
// 128Mbit, 16MByte
|
// 128Mbit, 16MByte
|
||||||
flash_size = 16 * 1024 * 1024;
|
flash_size = 16 * 1024 * 1024;
|
||||||
|
@ -131,7 +134,15 @@ bool flash_set_size_byte(uint32_t size)
|
||||||
|
|
||||||
uint16_t flash_get_sec_num(void)
|
uint16_t flash_get_sec_num(void)
|
||||||
{
|
{
|
||||||
return flash_get_size_byte() / SPI_FLASH_SEC_SIZE;
|
//static uint16_t sec_num = 0;
|
||||||
|
// return flash_get_size_byte() / (SPI_FLASH_SEC_SIZE);
|
||||||
|
// c_printf("\nflash_get_size_byte()=%d\n", ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) ));
|
||||||
|
// if( sec_num == 0 )
|
||||||
|
//{
|
||||||
|
// sec_num = 4 * 1024 * 1024 / (SPI_FLASH_SEC_SIZE);
|
||||||
|
//}
|
||||||
|
//return sec_num;
|
||||||
|
return ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t flash_get_mode(void)
|
uint8_t flash_get_mode(void)
|
||||||
|
@ -234,7 +245,8 @@ bool flash_self_destruct(void)
|
||||||
|
|
||||||
uint8_t byte_of_aligned_array(const uint8_t *aligned_array, uint32_t index)
|
uint8_t byte_of_aligned_array(const uint8_t *aligned_array, uint32_t index)
|
||||||
{
|
{
|
||||||
if( (((uint32_t)aligned_array)%4) != 0 ){
|
if ( (((uint32_t)aligned_array) % 4) != 0 )
|
||||||
|
{
|
||||||
NODE_DBG("aligned_array is not 4-byte aligned.\n");
|
NODE_DBG("aligned_array is not 4-byte aligned.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "ets_sys.h"
|
#include "ets_sys.h"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#include "cpu_esp8266.h"
|
#include "cpu_esp8266.h"
|
||||||
|
|
||||||
#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS)
|
#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -29,8 +30,8 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t unknown0;
|
uint8_t e9;
|
||||||
uint8_t unknown1;
|
uint8_t segments;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MODE_QIO = 0,
|
MODE_QIO = 0,
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#define fs_format myspiffs_format
|
#define fs_format myspiffs_format
|
||||||
#define fs_check myspiffs_check
|
#define fs_check myspiffs_check
|
||||||
#define fs_rename myspiffs_rename
|
#define fs_rename myspiffs_rename
|
||||||
|
#define fs_size myspiffs_size
|
||||||
|
|
||||||
#define FS_NAME_MAX_LENGTH SPIFFS_OBJ_NAME_LEN
|
#define FS_NAME_MAX_LENGTH SPIFFS_OBJ_NAME_LEN
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,9 @@ void myspiffs_clearerr( int fd ){
|
||||||
int myspiffs_rename( const char *old, const char *newname ){
|
int myspiffs_rename( const char *old, const char *newname ){
|
||||||
return SPIFFS_rename(&fs, (char *)old, (char *)newname);
|
return SPIFFS_rename(&fs, (char *)old, (char *)newname);
|
||||||
}
|
}
|
||||||
|
size_t myspiffs_size( int fd ){
|
||||||
|
return SPIFFS_size(&fs, (spiffs_file)fd);
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
void test_spiffs() {
|
void test_spiffs() {
|
||||||
char buf[12];
|
char buf[12];
|
||||||
|
|
|
@ -423,6 +423,7 @@ s32_t SPIFFS_check(spiffs *fs);
|
||||||
*/
|
*/
|
||||||
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh);
|
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh);
|
||||||
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh);
|
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh);
|
||||||
|
s32_t SPIFFS_size(spiffs *fs, spiffs_file fh);
|
||||||
|
|
||||||
#if SPIFFS_TEST_VISUALISATION
|
#if SPIFFS_TEST_VISUALISATION
|
||||||
/**
|
/**
|
||||||
|
@ -465,5 +466,6 @@ int myspiffs_error( int fd );
|
||||||
void myspiffs_clearerr( int fd );
|
void myspiffs_clearerr( int fd );
|
||||||
int myspiffs_check( void );
|
int myspiffs_check( void );
|
||||||
int myspiffs_rename( const char *old, const char *newname );
|
int myspiffs_rename( const char *old, const char *newname );
|
||||||
|
size_t myspiffs_size( int fd );
|
||||||
|
|
||||||
#endif /* SPIFFS_H_ */
|
#endif /* SPIFFS_H_ */
|
||||||
|
|
|
@ -798,6 +798,25 @@ s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32_t SPIFFS_size(spiffs *fs, spiffs_file fh) {
|
||||||
|
SPIFFS_API_CHECK_MOUNT(fs);
|
||||||
|
SPIFFS_LOCK(fs);
|
||||||
|
|
||||||
|
spiffs_fd *fd;
|
||||||
|
s32_t res;
|
||||||
|
res = spiffs_fd_get(fs, fh, &fd);
|
||||||
|
SPIFFS_API_CHECK_RES(fs, res);
|
||||||
|
|
||||||
|
#if SPIFFS_CACHE_WR
|
||||||
|
spiffs_fflush_cache(fs, fh);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
res = fd->size;
|
||||||
|
|
||||||
|
SPIFFS_UNLOCK(fs);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
#if SPIFFS_TEST_VISUALISATION
|
#if SPIFFS_TEST_VISUALISATION
|
||||||
s32_t SPIFFS_vis(spiffs *fs) {
|
s32_t SPIFFS_vis(spiffs *fs) {
|
||||||
s32_t res = SPIFFS_OK;
|
s32_t res = SPIFFS_OK;
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef struct _esp_tcp {
|
||||||
espconn_connect_callback connect_callback;
|
espconn_connect_callback connect_callback;
|
||||||
espconn_reconnect_callback reconnect_callback;
|
espconn_reconnect_callback reconnect_callback;
|
||||||
espconn_connect_callback disconnect_callback;
|
espconn_connect_callback disconnect_callback;
|
||||||
|
espconn_connect_callback write_finish_fn;
|
||||||
} esp_tcp;
|
} esp_tcp;
|
||||||
|
|
||||||
typedef struct _esp_udp {
|
typedef struct _esp_udp {
|
||||||
|
@ -90,8 +91,10 @@ struct espconn {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum espconn_option{
|
enum espconn_option{
|
||||||
ESPCONN_REUSEADDR = 1,
|
ESPCONN_START = 0x00,
|
||||||
ESPCONN_NODELAY,
|
ESPCONN_REUSEADDR = 0x01,
|
||||||
|
ESPCONN_NODELAY = 0x02,
|
||||||
|
ESPCONN_COPY = 0x04,
|
||||||
ESPCONN_END
|
ESPCONN_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,6 +212,18 @@ sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_in
|
||||||
|
|
||||||
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
|
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* FunctionName : espconn_regist_sentcb
|
||||||
|
* Description : Used to specify the function that should be called when data
|
||||||
|
* has been successfully delivered to the remote host.
|
||||||
|
* Parameters : espconn -- espconn to set the sent callback
|
||||||
|
* sent_cb -- sent callback function to call for this espconn
|
||||||
|
* when data is successfully sent
|
||||||
|
* Returns : none
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* FunctionName : espconn_sent
|
* FunctionName : espconn_sent
|
||||||
* Description : sent data for client or server
|
* Description : sent data for client or server
|
||||||
|
|
|
@ -89,6 +89,7 @@ bool system_rtc_mem_write(uint8 des_addr, const void *src_addr, uint16 save_size
|
||||||
void system_uart_swap(void);
|
void system_uart_swap(void);
|
||||||
|
|
||||||
uint16 system_adc_read(void);
|
uint16 system_adc_read(void);
|
||||||
|
uint16 system_get_vdd33(void);
|
||||||
|
|
||||||
const char *system_get_sdk_version(void);
|
const char *system_get_sdk_version(void);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ SECTIONS
|
||||||
_irom0_text_start = ABSOLUTE(.);
|
_irom0_text_start = ABSOLUTE(.);
|
||||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||||
*(.literal.* .text.*)
|
*(.literal.* .text.*)
|
||||||
*(.rodata2.text)
|
|
||||||
_irom0_text_end = ABSOLUTE(.);
|
_irom0_text_end = ABSOLUTE(.);
|
||||||
_flash_used_end = ABSOLUTE(.);
|
_flash_used_end = ABSOLUTE(.);
|
||||||
} >irom0_0_seg :irom0_0_phdr
|
} >irom0_0_seg :irom0_0_phdr
|
||||||
|
|
BIN
lib/libat.a
BIN
lib/libat.a
Binary file not shown.
BIN
lib/libjson.a
BIN
lib/libjson.a
Binary file not shown.
BIN
lib/liblwip.a
BIN
lib/liblwip.a
Binary file not shown.
BIN
lib/libmain.a
BIN
lib/libmain.a
Binary file not shown.
Binary file not shown.
BIN
lib/libphy.a
BIN
lib/libphy.a
Binary file not shown.
BIN
lib/libpp.a
BIN
lib/libpp.a
Binary file not shown.
Binary file not shown.
BIN
lib/libssl.a
BIN
lib/libssl.a
Binary file not shown.
BIN
lib/libupgrade.a
BIN
lib/libupgrade.a
Binary file not shown.
BIN
lib/libwpa.a
BIN
lib/libwpa.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue