Skip to content

Commit

Permalink
Master drop #2486
Browse files Browse the repository at this point in the history
Dev -> Master Release 10
  • Loading branch information
marcelstoer authored Sep 15, 2018
2 parents f99f295 + 0abb261 commit b41667b
Show file tree
Hide file tree
Showing 235 changed files with 6,208 additions and 115,987 deletions.
34 changes: 34 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# This is very much a work in progress to show how we can use macros to make the
# GDB interface a lot more useable. For example the next / step commands only
# work if the stepper doesn't leave the current scope. Beyond that you have a
# single hardware breakpoint which can be used as an hb or a wa. You have to
# remember to delete the previous one, so the br macro does this for you.
#
file app/.output/eagle/debug/image/eagle.app.v6.out
#set remotedebug 1
set remotelogfile gdb_rsp_logfile.txt
set serial baud 115200
set remote hardware-breakpoint-limit 1
set remote hardware-watchpoint-limit 1
#set debug xtensa 4
target remote /dev/ttyUSB0

set confirm off
set print null-stop
define br
d
hb $arg0
end

define upto
d
hb $arg0
c
end

set pagination off
set history filename ~/.gdb_history
set history save on
set history size 1000

182 changes: 182 additions & 0 deletions .gdbinitlua
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@

set pagination off
set print null-stop

define prTS
set $o = &(((TString *)($arg0))->tsv)
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
printf "String: hash = 0x%08x, len = %u : %s\n", $o->hash, $o->len, (char *)(&$o[1])
end

define prTnodes
set $o = (Table *)($arg0)
set $n = 1<<($o->lsizenode)
set $i = 0
while $i < $n
set $nd = ($o->node) + $i
if $nd->i_key.nk.tt && $nd->i_val.tt
if $nd->i_key.nk.tt == 6
printf "%4u: %s %2i\n", $i, $nd->i_key.nk.tt , $nd->i_val.tt
else
printf "%4u: %2i %2i\n", $i, $nd->i_key.nk.tt , $nd->i_val.tt
end
end
set $i = $i +1
end
end
define prTV
if $arg0
set $type = ($arg0).tt
set $val = ($arg0).value

if $type == 0
# NIL
printf "Nil\n"
end
if $type == 1
# Boolean
printf "Boolean: %u\n", $val.n
end
if $type == 2
# ROTable
printf "ROTable: %p\n", $val.p
end
if $type == 3
# Light Function
printf "Light Func: %p\n", $val.p
end
if $type == 4
# Light User Data
printf "Light Udata: %p\n", $val.p
end
if $type == 5
# Number
printf "Number: %u\n", $val.n
end
if $type == 6
prTS $arg0
end
if $type == 7
# Table
set $o = &($val->gc.h)
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
printf "Nodes: %4i %p\n", 2<<($o->lsizenode), $o->node
printf "Arry: %4i %p\n", $o->sizearray, $o->array
end
if $type == 8
# Function
set $o = &($val->gc.cl.c)
printf "Common header: next = %p, marked = 0x%01x\n", $o->next, $o->marked
if $o->isC == 0
set $o = &($val->gc.cl.l)
printf "LClosure: nupvalues = %u, gclist = %p, env = %p, p = %p\n", \
$o->nupvalues, $o->gclist, $o->env, $o->p
else
printf "CClosure: nupvalues = %u, gclist = %p, env = %p, f = %p\np", \
$o->nupvalues, $o->gclist, $o->env, $o->f
end
end
if $type == 9
# UserData
end
if $type == 10
# Thread
end
end
end

define prT
print *(Table*)($arg0)
end

define prL
if L > 0
printf " stack: %u\n", L->top-L->base
printf " hooking: %u, %u, %u, %u, %p\n", L->hookmask, L->allowhook, L->basehookcount, L->hookcount, L->hook
end
end

define dumpstrt
set $st = $arg0
set $i = 0
while $i< $st->size
set $o = &(((TString *)($st->hash[$i]))->tsv)
while $o
if $o->next
printf "Slot: %5i %p %p %08x %02x %4u", \
$i, $o, $o->next, $o->hash, $o->marked, $o->len
else
printf "Slot: %5i %p %08x %02x %4u", \
$i, $o, $o->hash, $o->marked, $o->len
end
if $o->marked & 0x80
printf "* %s\n", *(char **)($o+1)
else
printf " %s\n", (char *)($o+1)
end
set $o = &(((TString *)($o->next))->tsv)
end
set $i = $i + 1
end
end

define dumpRAMstrt
dumpstrt &(L->l_G->strt)
end

define dumpROstrt
dumpstrt &(L->l_G->ROstrt)
end

define graylist
set $n = $arg0
while $n
printf "%p %2u %02X\n",$n, $n->gch.tt, $n->gch.marked
set $n=$n->gch.next
end
end

define prPC
printf "Excuting instruction %i: %08x\n", (pc - cl->p->code)+1-1, i
end


define where
set $f=cl->p
printf "<%s:%u,%u>, opcode %u\n",\
(char *)$f->source+17, $f->linedefined, $f->lastlinedefined, pc - $f->code
end

define callinfo
printf "%p: ", L->ci
print *L->ci
end

define luastack
set $i = 0
set $ci = L->base_ci
set $s = L->stack
set $last = L->stack_last - L->stack
printf "stack = %p, last: %i, size: %i, " , $s, $last, L->stacksize
if $last+6==L->stacksize
printf "(OK)\n"
else
printf "(MISMATCH)\n"
end
printf " Ndx top base func\n"
while $ci <= L->ci
printf "%3u %6i %6i %6i\n", $i++, $ci->top-$s, $ci->base-$s, ($ci++)->func-$s
end
end

define stacklen
printf "%i top: %p, base: %p\n", \
L->ci->top - L->base, L->ci->top, L->base
end

define stackcheck
set $ci = L->ci
printf "Used: %i, Headroom: %i, Total: %i\n", \
L->top-$ci->base-1, $ci->top-L->top+1, $ci->top-$ci->base
end

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
sdk/
cache/
.ccache/
local/
luac.cross
user_config.h
server-ca.crt

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "app/u8g2lib/u8g2"]
path = app/u8g2lib/u8g2
url = https://github.com/olikraus/U8g2_Arduino.git
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ addons:
packages:
- python-serial
- srecord
- lua5.1
cache:
- pip
- directories:
- cache
before_install:
- pip install --user hererocks esptool
- hererocks env --lua 5.1 -rlatest
- source env/bin/activate
- luarocks install luafilesystem
install:
- tar -Jxvf tools/esp-open-sdk.tar.xz
- export PATH=$PATH:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
script:
- lua tools/cross-lua.lua || exit 1
- export BUILD_DATE=$(date +%Y%m%d)
- make EXTRA_CCFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" all
- cd bin/
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ Avoid intermediate merge commits. [Rebase](https://www.atlassian.com/git/tutoria
1. `git push`
1. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) (PR) on GitHub.

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.
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.

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.

### Keeping your fork in sync
You need to sync your fork with the NodeMCU upstream repository from time to time, latest before you rebase (see flow above).
Expand Down
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
.NOTPARALLEL:

# SDK base version, as released by Espressif
SDK_BASE_VER:=2.2.0
SDK_BASE_VER:=2.2.1

# no patch: SDK_VER equals SDK_BASE_VER and sdk dir depends on sdk_extracted
#SDK_VER:=$(SDK_BASE_VER)
#SDK_DIR_DEPENDS:=sdk_extracted
SDK_VER:=$(SDK_BASE_VER)
SDK_DIR_DEPENDS:=sdk_extracted

# with patch: SDK_VER differs from SDK_BASE_VER and sdk dir depends on sdk_patched
SDK_PATCH_VER:=f8f27ce
SDK_VER:=$(SDK_BASE_VER)-$(SDK_PATCH_VER)
SDK_DIR_DEPENDS:=sdk_patched
#SDK_PATCH_VER:=f8f27ce
#SDK_VER:=$(SDK_BASE_VER)-$(SDK_PATCH_VER)
#SDK_DIR_DEPENDS:=sdk_patched

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

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

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

$(TOP_DIR)/cache/v$(SDK_FILE_VER).zip:
Expand Down Expand Up @@ -308,11 +308,11 @@ endif


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

$(OBJODIR)/%.d: %.c
@mkdir -p $(OBJODIR);
@mkdir -p $(dir $@);
@echo DEPEND: $(CC) -M $(CFLAGS) $<
@set -e; rm -f $@; \
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
Expand All @@ -331,22 +331,22 @@ $(OBJODIR)/%.d: %.cpp
rm -f $@.$$$$

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

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

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

$(OBJODIR)/%.d: %.S
@mkdir -p $(OBJODIR); \
@mkdir -p $(dir $@); \
set -e; rm -f $@; \
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **NodeMCU 2.2.0** #
# **NodeMCU 2.2.1** #

[![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)
[![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware)
Expand All @@ -7,19 +7,22 @@

### A Lua based firmware for ESP8266 WiFi SOC

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.
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).

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.
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.

# Summary

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

### LFS support
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!

# Programming Model

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.
Expand Down
Loading

0 comments on commit b41667b

Please sign in to comment.