Skip to content

Commit b41667b

Browse files
authored
Master drop #2486
Dev -> Master Release 10
2 parents f99f295 + 0abb261 commit b41667b

File tree

235 files changed

+6208
-115987
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+6208
-115987
lines changed

.gdbinit

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# This is very much a work in progress to show how we can use macros to make the
3+
# GDB interface a lot more useable. For example the next / step commands only
4+
# work if the stepper doesn't leave the current scope. Beyond that you have a
5+
# single hardware breakpoint which can be used as an hb or a wa. You have to
6+
# remember to delete the previous one, so the br macro does this for you.
7+
#
8+
file app/.output/eagle/debug/image/eagle.app.v6.out
9+
#set remotedebug 1
10+
set remotelogfile gdb_rsp_logfile.txt
11+
set serial baud 115200
12+
set remote hardware-breakpoint-limit 1
13+
set remote hardware-watchpoint-limit 1
14+
#set debug xtensa 4
15+
target remote /dev/ttyUSB0
16+
17+
set confirm off
18+
set print null-stop
19+
define br
20+
d
21+
hb $arg0
22+
end
23+
24+
define upto
25+
d
26+
hb $arg0
27+
c
28+
end
29+
30+
set pagination off
31+
set history filename ~/.gdb_history
32+
set history save on
33+
set history size 1000
34+

.gdbinitlua

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
2+
set pagination off
3+
set print null-stop
4+
5+
define prTS
6+
set $o = &(((TString *)($arg0))->tsv)
7+
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
8+
printf "String: hash = 0x%08x, len = %u : %s\n", $o->hash, $o->len, (char *)(&$o[1])
9+
end
10+
11+
define prTnodes
12+
set $o = (Table *)($arg0)
13+
set $n = 1<<($o->lsizenode)
14+
set $i = 0
15+
while $i < $n
16+
set $nd = ($o->node) + $i
17+
if $nd->i_key.nk.tt && $nd->i_val.tt
18+
if $nd->i_key.nk.tt == 6
19+
printf "%4u: %s %2i\n", $i, $nd->i_key.nk.tt , $nd->i_val.tt
20+
else
21+
printf "%4u: %2i %2i\n", $i, $nd->i_key.nk.tt , $nd->i_val.tt
22+
end
23+
end
24+
set $i = $i +1
25+
end
26+
end
27+
define prTV
28+
if $arg0
29+
set $type = ($arg0).tt
30+
set $val = ($arg0).value
31+
32+
if $type == 0
33+
# NIL
34+
printf "Nil\n"
35+
end
36+
if $type == 1
37+
# Boolean
38+
printf "Boolean: %u\n", $val.n
39+
end
40+
if $type == 2
41+
# ROTable
42+
printf "ROTable: %p\n", $val.p
43+
end
44+
if $type == 3
45+
# Light Function
46+
printf "Light Func: %p\n", $val.p
47+
end
48+
if $type == 4
49+
# Light User Data
50+
printf "Light Udata: %p\n", $val.p
51+
end
52+
if $type == 5
53+
# Number
54+
printf "Number: %u\n", $val.n
55+
end
56+
if $type == 6
57+
prTS $arg0
58+
end
59+
if $type == 7
60+
# Table
61+
set $o = &($val->gc.h)
62+
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
63+
printf "Nodes: %4i %p\n", 2<<($o->lsizenode), $o->node
64+
printf "Arry: %4i %p\n", $o->sizearray, $o->array
65+
end
66+
if $type == 8
67+
# Function
68+
set $o = &($val->gc.cl.c)
69+
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
70+
if $o->isC == 0
71+
set $o = &($val->gc.cl.l)
72+
printf "LClosure: nupvalues = %u, gclist = %p, env = %p, p = %p\n", \
73+
$o->nupvalues, $o->gclist, $o->env, $o->p
74+
else
75+
printf "CClosure: nupvalues = %u, gclist = %p, env = %p, f = %p\np", \
76+
$o->nupvalues, $o->gclist, $o->env, $o->f
77+
end
78+
end
79+
if $type == 9
80+
# UserData
81+
end
82+
if $type == 10
83+
# Thread
84+
end
85+
end
86+
end
87+
88+
define prT
89+
print *(Table*)($arg0)
90+
end
91+
92+
define prL
93+
if L > 0
94+
printf " stack: %u\n", L->top-L->base
95+
printf " hooking: %u, %u, %u, %u, %p\n", L->hookmask, L->allowhook, L->basehookcount, L->hookcount, L->hook
96+
end
97+
end
98+
99+
define dumpstrt
100+
set $st = $arg0
101+
set $i = 0
102+
while $i< $st->size
103+
set $o = &(((TString *)($st->hash[$i]))->tsv)
104+
while $o
105+
if $o->next
106+
printf "Slot: %5i %p %p %08x %02x %4u", \
107+
$i, $o, $o->next, $o->hash, $o->marked, $o->len
108+
else
109+
printf "Slot: %5i %p %08x %02x %4u", \
110+
$i, $o, $o->hash, $o->marked, $o->len
111+
end
112+
if $o->marked & 0x80
113+
printf "* %s\n", *(char **)($o+1)
114+
else
115+
printf " %s\n", (char *)($o+1)
116+
end
117+
set $o = &(((TString *)($o->next))->tsv)
118+
end
119+
set $i = $i + 1
120+
end
121+
end
122+
123+
define dumpRAMstrt
124+
dumpstrt &(L->l_G->strt)
125+
end
126+
127+
define dumpROstrt
128+
dumpstrt &(L->l_G->ROstrt)
129+
end
130+
131+
define graylist
132+
set $n = $arg0
133+
while $n
134+
printf "%p %2u %02X\n",$n, $n->gch.tt, $n->gch.marked
135+
set $n=$n->gch.next
136+
end
137+
end
138+
139+
define prPC
140+
printf "Excuting instruction %i: %08x\n", (pc - cl->p->code)+1-1, i
141+
end
142+
143+
144+
define where
145+
set $f=cl->p
146+
printf "<%s:%u,%u>, opcode %u\n",\
147+
(char *)$f->source+17, $f->linedefined, $f->lastlinedefined, pc - $f->code
148+
end
149+
150+
define callinfo
151+
printf "%p: ", L->ci
152+
print *L->ci
153+
end
154+
155+
define luastack
156+
set $i = 0
157+
set $ci = L->base_ci
158+
set $s = L->stack
159+
set $last = L->stack_last - L->stack
160+
printf "stack = %p, last: %i, size: %i, " , $s, $last, L->stacksize
161+
if $last+6==L->stacksize
162+
printf "(OK)\n"
163+
else
164+
printf "(MISMATCH)\n"
165+
end
166+
printf " Ndx top base func\n"
167+
while $ci <= L->ci
168+
printf "%3u %6i %6i %6i\n", $i++, $ci->top-$s, $ci->base-$s, ($ci++)->func-$s
169+
end
170+
end
171+
172+
define stacklen
173+
printf "%i top: %p, base: %p\n", \
174+
L->ci->top - L->base, L->ci->top, L->base
175+
end
176+
177+
define stackcheck
178+
set $ci = L->ci
179+
printf "Used: %i, Headroom: %i, Total: %i\n", \
180+
L->top-$ci->base-1, $ci->top-L->top+1, $ci->top-$ci->base
181+
end
182+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
sdk/
22
cache/
33
.ccache/
4+
local/
5+
luac.cross
46
user_config.h
57
server-ca.crt
68

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "app/u8g2lib/u8g2"]
2+
path = app/u8g2lib/u8g2
3+
url = https://github.com/olikraus/U8g2_Arduino.git

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@ addons:
55
packages:
66
- python-serial
77
- srecord
8-
- lua5.1
98
cache:
10-
- pip
119
- directories:
1210
- cache
13-
before_install:
14-
- pip install --user hererocks esptool
15-
- hererocks env --lua 5.1 -rlatest
16-
- source env/bin/activate
17-
- luarocks install luafilesystem
1811
install:
1912
- tar -Jxvf tools/esp-open-sdk.tar.xz
2013
- export PATH=$PATH:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
2114
script:
22-
- lua tools/cross-lua.lua || exit 1
2315
- export BUILD_DATE=$(date +%Y%m%d)
2416
- make EXTRA_CCFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" all
2517
- cd bin/

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Avoid intermediate merge commits. [Rebase](https://www.atlassian.com/git/tutoria
6363
1. `git push`
6464
1. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) (PR) on GitHub.
6565

66-
This is just one way of doing things. If you're proficient in Git matters you're free to choose your own. If you want to read more then the [GitHub chapter in the Git book](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project#The-GitHub-Flow) is a way to start. [GitHub's own documentation](https://help.github.com/categories/collaborating/) contains a wealth of information as well.
66+
This is just one way of doing things. If you're proficient in Git matters you're free to choose your own. If you want to read more then the [GitHub chapter in the Git book](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project#The-GitHub-Flow) is a way to start. [GitHub's own documentation](https://help.github.com/categories/collaborating-with-issues-and-pull-requests/) contains a wealth of information as well.
67+
68+
As a Windows or Mac user you could also resort to [GitHub Desktop](https://desktop.github.com/). It's a mature GUI application that supports most of the tasks outlined above.
6769

6870
### Keeping your fork in sync
6971
You need to sync your fork with the NodeMCU upstream repository from time to time, latest before you rebase (see flow above).

Makefile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
.NOTPARALLEL:
44

55
# SDK base version, as released by Espressif
6-
SDK_BASE_VER:=2.2.0
6+
SDK_BASE_VER:=2.2.1
77

88
# no patch: SDK_VER equals SDK_BASE_VER and sdk dir depends on sdk_extracted
9-
#SDK_VER:=$(SDK_BASE_VER)
10-
#SDK_DIR_DEPENDS:=sdk_extracted
9+
SDK_VER:=$(SDK_BASE_VER)
10+
SDK_DIR_DEPENDS:=sdk_extracted
1111

1212
# with patch: SDK_VER differs from SDK_BASE_VER and sdk dir depends on sdk_patched
13-
SDK_PATCH_VER:=f8f27ce
14-
SDK_VER:=$(SDK_BASE_VER)-$(SDK_PATCH_VER)
15-
SDK_DIR_DEPENDS:=sdk_patched
13+
#SDK_PATCH_VER:=f8f27ce
14+
#SDK_VER:=$(SDK_BASE_VER)-$(SDK_PATCH_VER)
15+
#SDK_DIR_DEPENDS:=sdk_patched
1616

1717
SDK_FILE_VER:=$(SDK_BASE_VER)
18-
SDK_FILE_SHA1:=8b63f1066d3560ff77f119e8ba30a9c39e7baaad
19-
SDK_PATCH_SHA1:=0bc21ec77b08488f04d3e1c9d161b711d07201a8
18+
SDK_FILE_SHA1:=48f2242d5895823709f222bf0fffce9d525996c8
19+
# SDK_PATCH_SHA1:=0bc21ec77b08488f04d3e1c9d161b711d07201a8
2020
# Ensure we search "our" SDK before the tool-chain's SDK (if any)
2121
TOP_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
2222
SDK_REL_DIR=sdk/esp_iot_sdk_v$(SDK_VER)
@@ -28,7 +28,7 @@ ifdef DEBUG
2828
CCFLAGS += -ggdb -O0
2929
LDFLAGS += -ggdb
3030
else
31-
CCFLAGS += -Os
31+
CCFLAGS += -O2
3232
endif
3333

3434
#############################################################
@@ -227,8 +227,8 @@ $(TOP_DIR)/sdk/.patched-$(SDK_VER): $(TOP_DIR)/cache/$(SDK_PATCH_VER).patch
227227

228228
$(TOP_DIR)/sdk/.pruned-$(SDK_VER):
229229
rm -f $(SDK_DIR)/lib/liblwip.a $(SDK_DIR)/lib/libssl.a $(SDK_DIR)/lib/libmbedtls.a
230-
ar d $(SDK_DIR)/lib/libmain.a time.o
231-
ar d $(SDK_DIR)/lib/libc.a lib_a-time.o
230+
$(AR) d $(SDK_DIR)/lib/libmain.a time.o
231+
$(AR) d $(SDK_DIR)/lib/libc.a lib_a-time.o
232232
touch $@
233233

234234
$(TOP_DIR)/cache/v$(SDK_FILE_VER).zip:
@@ -308,11 +308,11 @@ endif
308308

309309

310310
$(OBJODIR)/%.o: %.c
311-
@mkdir -p $(OBJODIR);
311+
@mkdir -p $(dir $@);
312312
$(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
313313

314314
$(OBJODIR)/%.d: %.c
315-
@mkdir -p $(OBJODIR);
315+
@mkdir -p $(dir $@);
316316
@echo DEPEND: $(CC) -M $(CFLAGS) $<
317317
@set -e; rm -f $@; \
318318
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
@@ -331,22 +331,22 @@ $(OBJODIR)/%.d: %.cpp
331331
rm -f $@.$$$$
332332

333333
$(OBJODIR)/%.o: %.s
334-
@mkdir -p $(OBJODIR);
334+
@mkdir -p $(dir $@);
335335
$(CC) $(CFLAGS) -o $@ -c $<
336336

337337
$(OBJODIR)/%.d: %.s
338-
@mkdir -p $(OBJODIR); \
338+
@mkdir -p $(dir $@); \
339339
set -e; rm -f $@; \
340340
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
341341
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
342342
rm -f $@.$$$$
343343

344344
$(OBJODIR)/%.o: %.S
345-
@mkdir -p $(OBJODIR);
345+
@mkdir -p $(dir $@);
346346
$(CC) $(CFLAGS) -D__ASSEMBLER__ -o $@ -c $<
347347

348348
$(OBJODIR)/%.d: %.S
349-
@mkdir -p $(OBJODIR); \
349+
@mkdir -p $(dir $@); \
350350
set -e; rm -f $@; \
351351
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
352352
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# **NodeMCU 2.2.0** #
1+
# **NodeMCU 2.2.1** #
22

33
[![Join the chat at https://gitter.im/nodemcu/nodemcu-firmware](https://img.shields.io/gitter/room/badges/shields.svg)](https://gitter.im/nodemcu/nodemcu-firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44
[![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware)
@@ -7,19 +7,22 @@
77

88
### A Lua based firmware for ESP8266 WiFi SOC
99

10-
NodeMCU is an [eLua](http://www.eluaproject.net/) based firmware for the [ESP8266 WiFi SOC from Espressif](http://espressif.com/en/products/esp8266/). The firmware is based on the [Espressif NON-OS SDK 2.2.0](https://github.com/espressif/ESP8266_NONOS_SDK/releases/tag/v2.2.0) and uses a file system based on [spiffs](https://github.com/pellepl/spiffs). The code repository consists of 98.1% C-code that glues the thin Lua veneer to the SDK.
10+
NodeMCU is an open source [Lua](https://www.lua.org/) based firmware for the [ESP8266 WiFi SOC from Espressif](http://espressif.com/en/products/esp8266/) and uses an on-module flash-based [SPIFFS](https://github.com/pellepl/spiffs) file system. NodeMCU is implemented in C and is layered on the [Espressif NON-OS SDK](https://github.com/espressif/ESP8266_NONOS_SDK).
1111

12-
The NodeMCU *firmware* is a companion project to the popular [NodeMCU dev kits](https://github.com/nodemcu/nodemcu-devkit-v1.0), ready-made open source development boards with ESP8266-12E chips.
12+
The firmware was initially developed as is a companion project to the popular ESP8266-based [NodeMCU development modules]((https://github.com/nodemcu/nodemcu-devkit-v1.0)), but the project is now community-supported, and the firmware can now be run on _any_ ESP module.
1313

1414
# Summary
1515

1616
- Easy to program wireless node and/or access point
17-
- Based on Lua 5.1.4 (without *debug, os* modules)
17+
- Based on Lua 5.1.4 (without `debug` & `os` modules)
1818
- Asynchronous event-driven programming model
19-
- more than 65 built-in modules
19+
- more than **65 built-in modules**
2020
- Firmware available with or without floating point support (integer-only uses less memory)
2121
- Up-to-date documentation at [https://nodemcu.readthedocs.io](https://nodemcu.readthedocs.io)
2222

23+
### LFS support
24+
In July 2018 support for a Lua Flash Store (LFS) was introduced. LFS allows Lua code and its associated constant data to be executed directly out of flash-memory; just as the firmware itself is executed. This now enables NodeMCU developers to create **Lua applications with up to 256Kb** Lua code and read-only constants executing out of flash. All of the RAM is available for read-write data!
25+
2326
# Programming Model
2427

2528
The NodeMCU programming model is similar to that of [Node.js](https://en.wikipedia.org/wiki/Node.js), only in Lua. It is asynchronous and event-driven. Many functions, therefore, have parameters for callback functions. To give you an idea what a NodeMCU program looks like study the short snippets below. For more extensive examples have a look at the [`/lua_examples`](lua_examples) folder in the repository on GitHub.

0 commit comments

Comments
 (0)