Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
f1b5dfc3
Unverified
Commit
f1b5dfc3
authored
May 17, 2019
by
Terry Ellison
Committed by
GitHub
May 17, 2019
Browse files
SDK-3.0 tranche updates (#2757)
includes some dRAM -> iRAM optimisations
parent
1990f957
Changes
12
Show whitespace changes
Inline
Side-by-side
Makefile
View file @
f1b5dfc3
...
@@ -9,18 +9,23 @@ TOP_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
...
@@ -9,18 +9,23 @@ TOP_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
# RELEASE = lastest pulls the latest V3.0.0 branch version as at the issue of this make
# RELEASE = lastest pulls the latest V3.0.0 branch version as at the issue of this make
# otherwise it pulls the labelled version in the SDK version's release directory
# otherwise it pulls the labelled version in the SDK version's release directory
#
#
ifeq
("$(RELEASE)","latest")
ifeq
("$(RELEASE)","latest-3.0")
export
RELEASE
:=
$(RELEASE)
SDK_VER
:=
3.0.0
SDK_VER
:=
3.0.0-dev-190412
SDK_FILE_SHA1
:=
NA
SDK_COMMIT_SHA1
:=
39ec2d4573eb77fda73f6afcf6dd1b3c41e74fcd
SDK_ZIP_ROOT
:=
ESP8266_NONOS_SDK-release-v
$(SDK_VER)
SDK_FILE_SHA1
:=
44f7724490739536526fc4298d6fcc2fa2d29471
SDK_FILE_VER
:=
release/v
$(SDK_VER)
SDK_ZIP_ROOT
:=
ESP8266_NONOS_SDK-
$(SDK_COMMIT_SHA1)
else
ifeq
("$(RELEASE)","master")
SDK_FILE_VER
:=
$(SDK_COMMIT_SHA1)
SDK_VER
:=
master
else
SDK_FILE_SHA1
:=
NA
SDK_VER
:=
3.0
SDK_FILE_SHA1
:=
029fc23fe87e03c9852de636490b2d7b9e07f01a
SDK_ZIP_ROOT
:=
ESP8266_NONOS_SDK-
$(SDK_VER)
SDK_ZIP_ROOT
:=
ESP8266_NONOS_SDK-
$(SDK_VER)
SDK_FILE_VER
:=
v
$(SDK_VER)
SDK_FILE_VER
:=
$(SDK_VER)
else
# SDK_VER := 3.0
# SDK_FILE_VER := v$(SDK_VER)
SDK_FILE_VER
:=
e4434aa730e78c63040ace360493aef420ec267c
SDK_VER
:=
3.0-e4434aa
SDK_FILE_SHA1
:=
ac6528a6a206d3d4c220e4035ced423eb314cfbf
SDK_ZIP_ROOT
:=
ESP8266_NONOS_SDK-
$(SDK_FILE_VER)
endif
endif
SDK_REL_DIR
:=
sdk/esp_iot_sdk_v
$(SDK_VER)
SDK_REL_DIR
:=
sdk/esp_iot_sdk_v
$(SDK_VER)
SDK_DIR
:=
$(TOP_DIR)
/
$(SDK_REL_DIR)
SDK_DIR
:=
$(TOP_DIR)
/
$(SDK_REL_DIR)
...
@@ -314,10 +319,10 @@ $(TOP_DIR)/sdk/.extracted-$(SDK_VER): $(TOP_DIR)/cache/$(SDK_FILE_VER).zip
...
@@ -314,10 +319,10 @@ $(TOP_DIR)/sdk/.extracted-$(SDK_VER): $(TOP_DIR)/cache/$(SDK_FILE_VER).zip
(
cd
"
$(
dir
$@
)
"
&&
\
(
cd
"
$(
dir
$@
)
"
&&
\
rm
-fr
esp_iot_sdk_v
$(SDK_VER)
ESP8266_NONOS_SDK-
*
&&
\
rm
-fr
esp_iot_sdk_v
$(SDK_VER)
ESP8266_NONOS_SDK-
*
&&
\
unzip
$(TOP_DIR)
/cache/
$(SDK_FILE_VER)
.zip
\
unzip
$(TOP_DIR)
/cache/
$(SDK_FILE_VER)
.zip
\
'
$(SDK_ZIP_ROOT)
/lib/*'
\
'
*
/lib/*'
\
'
$(SDK_ZIP_ROOT)
/ld/*.v6.ld'
\
'
*
/ld/*.v6.ld'
\
'
$(SDK_ZIP_ROOT)
/include/*'
\
'
*
/include/*'
\
'
$(SDK_ZIP_ROOT)
/bin/esp_init_data_default_v05.bin'
\
'
*
/bin/esp_init_data_default_v05.bin'
\
)
)
mv
$(
dir
$@
)
/
$(SDK_ZIP_ROOT)
$(
dir
$@
)
/esp_iot_sdk_v
$(SDK_VER)
mv
$(
dir
$@
)
/
$(SDK_ZIP_ROOT)
$(
dir
$@
)
/esp_iot_sdk_v
$(SDK_VER)
touch
$@
touch
$@
...
@@ -334,7 +339,7 @@ $(TOP_DIR)/cache/$(SDK_FILE_VER).zip:
...
@@ -334,7 +339,7 @@ $(TOP_DIR)/cache/$(SDK_FILE_VER).zip:
mkdir
-p
"
$(
dir
$@
)
"
mkdir
-p
"
$(
dir
$@
)
"
$(summary)
WGET
$(
patsubst
$(TOP_DIR)
/%,%,
$@
)
$(summary)
WGET
$(
patsubst
$(TOP_DIR)
/%,%,
$@
)
$(WGET)
$(GITHUB_SDK)
/archive/
$(SDK_FILE_VER)
.zip
-O
$@
||
{
rm
-f
"
$@
"
;
exit
1
;
}
$(WGET)
$(GITHUB_SDK)
/archive/
$(SDK_FILE_VER)
.zip
-O
$@
||
{
rm
-f
"
$@
"
;
exit
1
;
}
(
echo
"
$(SDK_FILE_SHA1)
$@
"
|
sha1sum
-c
-
)
||
{
rm
-f
"
$@
"
;
exit
1
;
}
if
test
"
$(SDK_FILE_SHA1)
"
!=
"NA"
;
then
echo
"
$(SDK_FILE_SHA1)
$@
"
|
sha1sum
-c
-
||
{
rm
-f
"
$@
"
;
exit
1
;
}
;
fi
clean
:
clean
:
$(
foreach
d,
$(SUBDIRS)
,
$(MAKE)
-C
$(d)
clean
;
)
$(
foreach
d,
$(SUBDIRS)
,
$(MAKE)
-C
$(d)
clean
;
)
...
...
app/Makefile
View file @
f1b5dfc3
...
@@ -143,6 +143,7 @@ CONFIGURATION_DEFINES = -D__ets__ \
...
@@ -143,6 +143,7 @@ CONFIGURATION_DEFINES = -D__ets__ \
-DEBUF_LWIP
\
-DEBUF_LWIP
\
-DUSE_OPTIMIZE_PRINTF
\
-DUSE_OPTIMIZE_PRINTF
\
-DMBEDTLS_USER_CONFIG_FILE
=
\"
user_mbedtls.h
\"
\
-DMBEDTLS_USER_CONFIG_FILE
=
\"
user_mbedtls.h
\"
\
-DMEM_DEFAULT_USE_DRAM
DEFINES
+=
\
DEFINES
+=
\
$(UNIVERSAL_TARGET_DEFINES)
\
$(UNIVERSAL_TARGET_DEFINES)
\
...
...
app/esp-gdbstub/gdbstub.c
View file @
f1b5dfc3
...
@@ -107,7 +107,7 @@ extern void xthal_set_intenable(int);
...
@@ -107,7 +107,7 @@ extern void xthal_set_intenable(int);
#define OBUFLEN 32
#define OBUFLEN 32
//The asm stub saves the Xtensa registers here when a debugging exception happens.
//The asm stub saves the Xtensa registers here when a debugging exception happens.
struct
XTensa_exception_frame_s
gdbstub_savedRegs
;
struct
XTensa_exception_frame_s
IRAM_DATA_ATTR
gdbstub_savedRegs
;
#if GDBSTUB_USE_OWN_STACK
#if GDBSTUB_USE_OWN_STACK
//This is the debugging exception stack.
//This is the debugging exception stack.
int
exceptionStack
[
256
];
int
exceptionStack
[
256
];
...
...
app/include/user_config.h
View file @
f1b5dfc3
...
@@ -278,6 +278,8 @@ extern void luaL_dbgbreak(void);
...
@@ -278,6 +278,8 @@ extern void luaL_dbgbreak(void);
#define ICACHE_FLASH_RESERVED_ATTR \
#define ICACHE_FLASH_RESERVED_ATTR \
__attribute__((section(".irom.reserved." __FILE__ "." ICACHE_STRING(__LINE__)),\
__attribute__((section(".irom.reserved." __FILE__ "." ICACHE_STRING(__LINE__)),\
used,unused,aligned(INTERNAL_FLASH_SECTOR_SIZE)))
used,unused,aligned(INTERNAL_FLASH_SECTOR_SIZE)))
#define IRAM_DATA_ATTR \
__attribute__((section(".iram0.data." __FILE__ "." ICACHE_STRING(__LINE__))))
#ifdef GPIO_SAFE_NO_INTR_ENABLE
#ifdef GPIO_SAFE_NO_INTR_ENABLE
#define NO_INTR_CODE ICACHE_RAM_ATTR __attribute__ ((noinline))
#define NO_INTR_CODE ICACHE_RAM_ATTR __attribute__ ((noinline))
...
...
app/lua/lauxlib.c
View file @
f1b5dfc3
...
@@ -918,6 +918,11 @@ static int l_check_memlimit(lua_State *L, size_t needbytes) {
...
@@ -918,6 +918,11 @@ static int l_check_memlimit(lua_State *L, size_t needbytes) {
return
(
g
->
totalbytes
>=
limit
)
?
1
:
0
;
return
(
g
->
totalbytes
>=
limit
)
?
1
:
0
;
}
}
#ifndef LUA_CROSS_COMPILER
#define REALLOC(p,o,n) (void *) this_realloc(p,o,n)
#else
#define REALLOC(p,o,n) (void *) (ptr? this_realloc(p,o,n) : c_malloc(n))
#endif
static
void
*
l_alloc
(
void
*
ud
,
void
*
ptr
,
size_t
osize
,
size_t
nsize
)
{
static
void
*
l_alloc
(
void
*
ud
,
void
*
ptr
,
size_t
osize
,
size_t
nsize
)
{
lua_State
*
L
=
(
lua_State
*
)
ud
;
lua_State
*
L
=
(
lua_State
*
)
ud
;
...
@@ -946,10 +951,11 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
...
@@ -946,10 +951,11 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
if
(
G
(
L
)
->
memlimit
>
0
&&
(
mode
&
EGC_ON_MEM_LIMIT
)
&&
l_check_memlimit
(
L
,
nsize
-
osize
))
if
(
G
(
L
)
->
memlimit
>
0
&&
(
mode
&
EGC_ON_MEM_LIMIT
)
&&
l_check_memlimit
(
L
,
nsize
-
osize
))
return
NULL
;
return
NULL
;
}
}
nptr
=
(
void
*
)
this_realloc
(
ptr
,
osize
,
nsize
);
nptr
=
REALLOC
(
ptr
,
osize
,
nsize
);
if
(
nptr
==
NULL
&&
L
!=
NULL
&&
(
mode
&
EGC_ON_ALLOC_FAILURE
))
{
if
(
nptr
==
NULL
&&
L
!=
NULL
&&
(
mode
&
EGC_ON_ALLOC_FAILURE
))
{
dbg_printf
(
"Emergency full collection
\n
"
);
/**** DEBUG ***/
luaC_fullgc
(
L
);
/* emergency full collection. */
luaC_fullgc
(
L
);
/* emergency full collection. */
nptr
=
(
void
*
)
this_realloc
(
ptr
,
osize
,
nsize
);
/* try allocation again */
nptr
=
REALLOC
(
ptr
,
osize
,
nsize
);
/* try allocation again */
}
}
return
nptr
;
return
nptr
;
}
}
...
...
app/lua/lrotable.c
View file @
f1b5dfc3
...
@@ -14,6 +14,12 @@
...
@@ -14,6 +14,12 @@
#else
#else
#define ALIGNED_STRING (__attribute__((aligned(4))) char *)
#define ALIGNED_STRING (__attribute__((aligned(4))) char *)
#endif
#endif
#ifdef LUA_CROSS_COMPILER
#undef IRAM_DATA_ATTR
#define IRAM_DATA_ATTR
#endif
#define LA_LINES 32
#define LA_LINES 32
#define LA_SLOTS 4
#define LA_SLOTS 4
//#define COLLECT_STATS
//#define COLLECT_STATS
...
@@ -36,13 +42,15 @@
...
@@ -36,13 +42,15 @@
* Note that this hash does a couple of prime multiples and a modulus 2^X
* Note that this hash does a couple of prime multiples and a modulus 2^X
* with is all evaluated in H/W, and adequately randomizes the lookup.
* with is all evaluated in H/W, and adequately randomizes the lookup.
*/
*/
#define HASH(a,b) ((((519*(size_t)(a)))>>4) + ((b) ? (b)->tsv.hash: 0))
#define HASH(a,b)
(unsigned)
((((519*(size_t)(a)))>>4) + ((b) ? (b)->tsv.hash: 0))
static
struct
{
typedef
struct
{
unsigned
hash
;
unsigned
hash
;
unsigned
addr
:
24
;
unsigned
addr
:
24
;
unsigned
ndx
:
8
;
unsigned
ndx
:
8
;
}
cache
[
LA_LINES
][
LA_SLOTS
];
}
cache_line_t
;
static
cache_line_t
IRAM_DATA_ATTR
cache
[
LA_LINES
][
LA_SLOTS
];
#ifdef COLLECT_STATS
#ifdef COLLECT_STATS
unsigned
cache_stats
[
3
];
unsigned
cache_stats
[
3
];
...
@@ -55,10 +63,10 @@ static int lookup_cache(unsigned hash, ROTable *rotable) {
...
@@ -55,10 +63,10 @@ static int lookup_cache(unsigned hash, ROTable *rotable) {
int
i
=
(
hash
>>
2
)
&
(
LA_LINES
-
1
),
j
;
int
i
=
(
hash
>>
2
)
&
(
LA_LINES
-
1
),
j
;
for
(
j
=
0
;
j
<
LA_SLOTS
;
j
++
)
{
for
(
j
=
0
;
j
<
LA_SLOTS
;
j
++
)
{
if
(
cache
[
i
][
j
].
hash
==
hash
&&
cache_line_t
cl
=
cache
[
i
][
j
];
((
size_t
)
rotable
&
0xffffffu
)
==
c
ache
[
i
][
j
]
.
addr
)
{
if
(
cl
.
hash
==
hash
&&
((
size_t
)
rotable
&
0xffffffu
)
==
c
l
.
addr
)
{
COUNT
(
0
);
COUNT
(
0
);
return
c
ache
[
i
][
j
]
.
ndx
;
return
c
l
.
ndx
;
}
}
}
}
COUNT
(
1
);
COUNT
(
1
);
...
@@ -67,14 +75,21 @@ static int lookup_cache(unsigned hash, ROTable *rotable) {
...
@@ -67,14 +75,21 @@ static int lookup_cache(unsigned hash, ROTable *rotable) {
static
void
update_cache
(
unsigned
hash
,
ROTable
*
rotable
,
unsigned
ndx
)
{
static
void
update_cache
(
unsigned
hash
,
ROTable
*
rotable
,
unsigned
ndx
)
{
int
i
=
(
hash
)
>>
2
&
(
LA_LINES
-
1
),
j
;
int
i
=
(
hash
)
>>
2
&
(
LA_LINES
-
1
),
j
;
#ifndef _MSC_VER
cache_line_t
cl
=
{
hash
,
(
size_t
)
rotable
,
ndx
};
#else
cache_line_t
cl
;
// MSC doesn't allow non-scalar initialisers, which
cl
.
hash
=
hash
;
// is a pity because xtensa gcc generates optimum
cl
.
addr
=
(
size_t
)
rotable
;
// code using them.
cl
.
ndx
=
ndx
;
#endif
COUNT
(
2
);
COUNT
(
2
);
if
(
ndx
>
0xffu
)
if
(
ndx
>
0xffu
)
return
;
return
;
for
(
j
=
LA_SLOTS
-
1
;
j
>
0
;
j
--
)
for
(
j
=
LA_SLOTS
-
1
;
j
>
0
;
j
--
)
cache
[
i
][
j
]
=
cache
[
i
][
j
-
1
];
cache
[
i
][
j
]
=
cache
[
i
][
j
-
1
];
cache
[
i
][
0
].
hash
=
hash
;
cache
[
i
][
0
]
=
cl
;
cache
[
i
][
0
].
addr
=
(
size_t
)
rotable
;
cache
[
i
][
0
].
ndx
=
ndx
;
}
}
/*
/*
* Find a string key entry in a rotable and return it. Note that this internally
* Find a string key entry in a rotable and return it. Note that this internally
...
...
app/lwip/core/dns.c
View file @
f1b5dfc3
...
@@ -222,7 +222,7 @@ static void dns_check_entries(void);
...
@@ -222,7 +222,7 @@ static void dns_check_entries(void);
/* DNS variables */
/* DNS variables */
static
struct
udp_pcb
*
dns_pcb
;
static
struct
udp_pcb
*
dns_pcb
;
static
u8_t
dns_seqno
;
static
u8_t
dns_seqno
;
static
struct
dns_table_entry
dns_table
[
DNS_TABLE_SIZE
];
static
struct
dns_table_entry
IRAM_DATA_ATTR
dns_table
[
DNS_TABLE_SIZE
];
static
ip_addr_t
dns_servers
[
DNS_MAX_SERVERS
];
static
ip_addr_t
dns_servers
[
DNS_MAX_SERVERS
];
/** Contiguous buffer for processing responses */
/** Contiguous buffer for processing responses */
//static u8_t dns_payload_buffer[LWIP_MEM_ALIGN_BUFFER(DNS_MSG_SIZE)];
//static u8_t dns_payload_buffer[LWIP_MEM_ALIGN_BUFFER(DNS_MSG_SIZE)];
...
...
app/modules/node.c
View file @
f1b5dfc3
...
@@ -771,7 +771,7 @@ LROT_BEGIN(node)
...
@@ -771,7 +771,7 @@ LROT_BEGIN(node)
LROT_FUNCENTRY
(
dsleepMax
,
dsleepMax
)
LROT_FUNCENTRY
(
dsleepMax
,
dsleepMax
)
LROT_FUNCENTRY
(
sleep
,
node_sleep
)
LROT_FUNCENTRY
(
sleep
,
node_sleep
)
#ifdef PMSLEEP_ENABLE
#ifdef PMSLEEP_ENABLE
PMSLEEP_INT_MAP
,
PMSLEEP_INT_MAP
#endif
#endif
#ifdef DEVELOPMENT_TOOLS
#ifdef DEVELOPMENT_TOOLS
LROT_FUNCENTRY
(
readrcr
,
node_readrcr
)
LROT_FUNCENTRY
(
readrcr
,
node_readrcr
)
...
...
app/spiffs/spiffs.c
View file @
f1b5dfc3
...
@@ -28,10 +28,10 @@ static spiffs fs;
...
@@ -28,10 +28,10 @@ static spiffs fs;
#define MASK_1MB (0x100000-1)
#define MASK_1MB (0x100000-1)
#define ALIGN (0x2000)
#define ALIGN (0x2000)
static
u8_t
spiffs_work_buf
[
LOG_PAGE_SIZE
*
2
];
static
u8_t
IRAM_DATA_ATTR
spiffs_work_buf
[
LOG_PAGE_SIZE
*
2
];
static
u8_t
spiffs_fds
[
sizeof
(
spiffs_fd
)
*
SPIFFS_MAX_OPEN_FILES
];
static
u8_t
spiffs_fds
[
sizeof
(
spiffs_fd
)
*
SPIFFS_MAX_OPEN_FILES
];
#if SPIFFS_CACHE
#if SPIFFS_CACHE
static
u8_t
myspiffs_cache
[
20
+
(
LOG_PAGE_SIZE
+
20
)
*
4
];
static
u8_t
IRAM_DATA_ATTR
myspiffs_cache
[
20
+
(
LOG_PAGE_SIZE
+
20
)
*
4
];
#endif
#endif
static
s32_t
my_spiffs_read
(
u32_t
addr
,
u32_t
size
,
u8_t
*
dst
)
{
static
s32_t
my_spiffs_read
(
u32_t
addr
,
u32_t
size
,
u8_t
*
dst
)
{
...
...
app/user/user_main.c
View file @
f1b5dfc3
...
@@ -144,7 +144,7 @@ void user_pre_init(void) {
...
@@ -144,7 +144,7 @@ void user_pre_init(void) {
os_printf
(
"system SPI FI size:%u, Flash size: %u
\n
"
,
fs_size_code
,
flash_size
);
os_printf
(
"system SPI FI size:%u, Flash size: %u
\n
"
,
fs_size_code
,
flash_size
);
}
}
pt
=
os_malloc
(
i
);
// We will work on and register a
RAM
copy of the PT
pt
=
os_malloc
_iram
(
i
);
// We will work on and register a copy of the PT
in iRAM
// Return if anything is amiss; The SDK will halt if the PT hasn't been registered
// Return if anything is amiss; The SDK will halt if the PT hasn't been registered
if
(
!
rcr_pt
||
!
pt
||
n
*
sizeof
(
partition_item_t
)
!=
i
)
{
if
(
!
rcr_pt
||
!
pt
||
n
*
sizeof
(
partition_item_t
)
!=
i
)
{
return
;
return
;
...
...
ld/nodemcu.ld
View file @
f1b5dfc3
...
@@ -124,6 +124,7 @@ SECTIONS
...
@@ -124,6 +124,7 @@ SECTIONS
/* *libwps.a:*(.literal .text) - tested that safe to keep in iROM */
/* *libwps.a:*(.literal .text) - tested that safe to keep in iROM */
*(.iram.text .iram0.text .iram0.text.*)
*(.iram.text .iram0.text .iram0.text.*)
*(.iram0.data.*)
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
...
...
tools/nodemcu-partition.py
View file @
f1b5dfc3
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
import
os
import
os
import
sys
import
sys
sys
.
path
.
append
(
os
.
path
.
realpath
(
os
.
path
.
dirname
(
__file__
)
+
'/toolchains/'
))
print
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
'/toolchains/'
)
import
esptool
import
esptool
import
io
import
io
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment