diff --git a/.travis.yml b/.travis.yml index effe094c3c..fe8bf1e6e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ install: fi - if [ "$SDK_VERSION" == "1.5.0" ]; then bsdtar -xf ${SDK_FILE_NAME} -C $TRAVIS_BUILD_DIR/opt/esp-alt-sdk; fi -- if [[ "$SDK_VERSION" != "1.5.0" && "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/nodemcu/nodemcu-firmware/raw/master/tools/esp-open-sdk.tar.xz; +- if [[ "$SDK_VERSION" != "1.5.0" && "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/nodemcu/nodemcu-firmware/raw/2d958750b56fc60297f564b4ec303e47928b5927/tools/esp-open-sdk.tar.xz; tar -Jxvf esp-open-sdk.tar.xz; ln -s `pwd`/esp-open-sdk/xtensa-lx106-elf $TRAVIS_BUILD_DIR/opt/esp-alt-sdk/. ; fi - if [ "$SDK_VERSION" == "2.0.0" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then wget diff --git a/Readme.md b/Readme.md index ef9727376a..dc54344165 100644 --- a/Readme.md +++ b/Readme.md @@ -71,7 +71,7 @@ This feature is still **experimental** which means that we do not recommend it i - **Custom heap allocation**: (default: OFF) If your application is experiencing heap fragmentation then you can try the [umm_malloc](https://github.com/rhempel/umm_malloc) heap allocation. To enable it compile Sming with `ENABLE_CUSTOM_HEAP=1`. In order to use it in your sample/application make sure to compile the sample with `ENABLE_CUSTOM_HEAP=1`. **Do not enable custom heap allocation and -mforce-l32 compiler flag at the same time**. - **Debug information log level and format**: There are four debug levels: debug=3, info=2, warn=1, error=0. Using `DEBUG_VERBOSE_LEVEL` you can set the desired level (0-3). For example `DEBUG_VERBOSE_LEVEL=2` will show only info messages and above. Another make directive is `DEBUG_PRINT_FILENAME_AND_LINE=1` which enables printing the filename and line number of every debug line. This will require extra space on flash. Note: you can compile the Sming library with a set of debug directives and your project with another settings, this way you can control debugging separately for Sming and your application code. - **Debug information for custom LWIP**: If you use custom LWIP (see above) some debug information will be printed for critical errors and situations. You can enable all debug information printing using `ENABLE_LWIPDEBUG=1`. To increase debugging for certain areas you can modify debug options in `third-party/esp-open-lwip/include/lwipopts.h`. -- **Interactive debugging on the device**: (default: OFF) In order to be able to debug live directly on the ESP8266 microcontroller you should re-compile the Sming library and your application with `ENABLE_GDB=1` directive. See [Basic_Debug](https://github.com/SmingHub/Sming/tree/develop/samples/Basic_Debug) sample for more details. +- **Interactive debugging on the device**: (default: OFF) In order to be able to debug live directly on the ESP8266 microcontroller you should re-compile the Sming library and your application with `ENABLE_GDB=1` directive. See [LiveDebug](https://github.com/SmingHub/Sming/tree/develop/samples/LiveDebug) sample for more details. - **CommandExecutor feature**: (default: ON) This feature enables execution of certain commands by registering token handlers for text received via serial, websocket or telnet connection. If this feature is not used additional RAM/Flash can be obtained by setting `ENABLE_CMD_EXECUTOR=0`. This will save ~1KB RAM and ~3KB of flash memory. - **SDK 3.0+**: (default: OFF) In order to use SDK 3.0.0 or newer you should set one environment variable before (re)compiling Sming AND applications based on it. The variable is SDK_BASE and it should point to `$SMING_HOME/third-party/ESP8266_NONOS_SDK`. diff --git a/Sming/Makefile b/Sming/Makefile index fb02d373fa..77b5dcdd59 100644 --- a/Sming/Makefile +++ b/Sming/Makefile @@ -283,7 +283,7 @@ ifeq ($(SMING_RELEASE),1) # for full list of optimization options CFLAGS += -Os -DSMING_RELEASE=1 -DLWIP_NOASSERT else ifeq ($(ENABLE_GDB), 1) - CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 + CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 -DGDBSTUB_CTRLC_BREAK=0 else CFLAGS += -Os -g endif diff --git a/Sming/Makefile-project.mk b/Sming/Makefile-project.mk index 9fc2c1af27..688d562d81 100644 --- a/Sming/Makefile-project.mk +++ b/Sming/Makefile-project.mk @@ -274,9 +274,9 @@ ifeq ($(SMING_RELEASE),1) # for full list of optimization options CFLAGS += -Os -DSMING_RELEASE=1 else ifeq ($(ENABLE_GDB), 1) - CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 - MODULES += $(THIRD_PARTY_DIR)/gdbstub - EXTRA_INCDIR += $(THIRD_PARTY_DIR)/gdbstub + CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 -DGDBSTUB_CTRLC_BREAK=0 + MODULES += $(THIRD_PARTY_DIR)/esp-gdbstub + EXTRA_INCDIR += $(THIRD_PARTY_DIR)/esp-gdbstub STRIP := @true else CFLAGS += -Os -g diff --git a/Sming/Makefile-rboot.mk b/Sming/Makefile-rboot.mk index 6bded4d91b..dc98123130 100644 --- a/Sming/Makefile-rboot.mk +++ b/Sming/Makefile-rboot.mk @@ -249,9 +249,9 @@ ifeq ($(SMING_RELEASE),1) # for full list of optimization options CFLAGS += -Os -DSMING_RELEASE=1 else ifeq ($(ENABLE_GDB), 1) - CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 - MODULES += $(THIRD_PARTY_DIR)/gdbstub - EXTRA_INCDIR += $(THIRD_PARTY_DIR)/gdbstub + CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 -DGDBSTUB_CTRLC_BREAK=0 + MODULES += $(THIRD_PARTY_DIR)/esp-gdbstub + EXTRA_INCDIR += $(THIRD_PARTY_DIR)/esp-gdbstub STRIP := @true else CFLAGS += -Os -g diff --git a/Sming/third-party/.patches/rboot.patch b/Sming/third-party/.patches/rboot.patch index eae544367b..842e350251 100644 --- a/Sming/third-party/.patches/rboot.patch +++ b/Sming/third-party/.patches/rboot.patch @@ -1,8 +1,26 @@ diff --git a/Makefile b/Makefile -index ca234de..f76fbaa 100644 +index ca234de..5f1c72b 100644 --- a/Makefile +++ b/Makefile -@@ -55,6 +55,16 @@ endif +@@ -22,10 +22,16 @@ else + Q := @ + endif + +-CFLAGS = -Os -O3 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH ++CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH + LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static + LD_SCRIPT = eagle.app.v6.ld + ++ifeq ($(ENABLE_GDB),1) ++ CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1 -DGDBSTUB_CTRLC_BREAK=0 ++else ++ CFLAGS += -Os -O3 ++endif ++ + E2_OPTS = -quiet -bin -boot0 + + ifeq ($(RBOOT_BIG_FLASH),1) +@@ -55,6 +61,16 @@ endif ifeq ($(RBOOT_IROM_CHKSUM),1) CFLAGS += -DBOOT_IROM_CHKSUM endif @@ -52,7 +70,7 @@ index 6e10a2f..03cc87b 100644 @@ -291,86 +309,94 @@ uint32 NOINLINE find_image(void) { ets_delay_us(BOOT_DELAY_MICROS); #endif - + - ets_printf("\r\nrBoot v1.4.2 - richardaburton@gmail.com\r\n"); +#ifndef BOOT_SILENT +#define echof(fmt, ...) ets_printf(fmt, ##__VA_ARGS__) @@ -61,10 +79,10 @@ index 6e10a2f..03cc87b 100644 +#endif + + echof("\r\nrBoot v1.4.2 - richardaburton@gmail.com\r\n"); - + // read rom header SPIRead(0, header, sizeof(rom_header)); - + // print and get flash size - ets_printf("Flash Size: "); + echof("Flash Size: "); @@ -103,7 +121,7 @@ index 6e10a2f..03cc87b 100644 // assume at least 4mbit flashsize = 0x80000; } - + // print spi mode - ets_printf("Flash Mode: "); + echof("Flash Mode: "); @@ -123,7 +141,7 @@ index 6e10a2f..03cc87b 100644 - ets_printf("unknown\r\n"); + echof("unknown\r\n"); } - + // print spi speed - ets_printf("Flash Speed: "); + echof("Flash Speed: "); @@ -138,7 +156,7 @@ index 6e10a2f..03cc87b 100644 + else if (flag == 2) echof("20 MHz\r\n"); + else if (flag == 0x0f) echof("80 MHz\r\n"); + else echof("unknown\r\n"); - + // print enabled options #ifdef BOOT_BIG_FLASH - ets_printf("rBoot Option: Big flash\r\n"); @@ -168,7 +186,7 @@ index 6e10a2f..03cc87b 100644 + echof("\r\n"); + +#undef echof - + // read boot config SPIRead(BOOT_CONFIG_SECTOR * SECTOR_SIZE, buffer, SECTOR_SIZE); diff --git a/rboot.h b/rboot.h @@ -181,6 +199,6 @@ index 93ae317..bd3ad6d 100644 // cannot be used at same time as BOOT_GPIO_ENABLED -#define BOOT_GPIO_SKIP_ENABLED +//#define BOOT_GPIO_SKIP_ENABLED - + // set the GPIO pin used by GPIO modes above (will default // to 16 if not manually set), only applicable when diff --git a/samples/Basic_Debug/.cproject b/samples/LiveDebug/.cproject similarity index 100% rename from samples/Basic_Debug/.cproject rename to samples/LiveDebug/.cproject diff --git a/samples/Basic_Debug/.project b/samples/LiveDebug/.project similarity index 96% rename from samples/Basic_Debug/.project rename to samples/LiveDebug/.project index c82d25f83e..449b510792 100644 --- a/samples/Basic_Debug/.project +++ b/samples/LiveDebug/.project @@ -1,6 +1,6 @@ - Basic_Debug + LiveDebug SmingFramework diff --git a/samples/Basic_Debug/Makefile b/samples/LiveDebug/Makefile similarity index 100% rename from samples/Basic_Debug/Makefile rename to samples/LiveDebug/Makefile diff --git a/samples/Basic_Debug/Makefile-user.mk b/samples/LiveDebug/Makefile-user.mk similarity index 94% rename from samples/Basic_Debug/Makefile-user.mk rename to samples/LiveDebug/Makefile-user.mk index ddc05d64c6..b3d02def5d 100644 --- a/samples/Basic_Debug/Makefile-user.mk +++ b/samples/LiveDebug/Makefile-user.mk @@ -26,6 +26,10 @@ MODULES = app # MacOS / Linux: # COM_PORT = /dev/tty.usbserial +DISABLE_SPIFFS = 1 + # Com port speed # COM_SPEED = 115200 ENABLE_GDB=1 + +export ENABLE_GDB diff --git a/samples/Basic_Debug/README.md b/samples/LiveDebug/README.md similarity index 100% rename from samples/Basic_Debug/README.md rename to samples/LiveDebug/README.md diff --git a/samples/Basic_Debug/app/application.cpp b/samples/LiveDebug/app/application.cpp similarity index 86% rename from samples/Basic_Debug/app/application.cpp rename to samples/LiveDebug/app/application.cpp index e9966be945..9f52a87070 100644 --- a/samples/Basic_Debug/app/application.cpp +++ b/samples/LiveDebug/app/application.cpp @@ -7,14 +7,14 @@ /* * This example uses the hardware timer for best timing accuracy. There is only one of these on the ESP8266, * so it may not be available if another module requires it. - * Most timing applicatons can use a SimpleTimer, which is good for intervals of up to about 268 seconds. + * Most timing applications can use a SimpleTimer, which is good for intervals of up to about 268 seconds. * For longer intervals, use a Timer. */ HardwareTimer procTimer; bool state = true; /* -* Notice: Software breakpoints work only on code that is in RAM. +* Notice: Software breakpoints work only on code that is in RAM. * In Sming you have to use the GDB_IRAM_ATTR to do this. */ void GDB_IRAM_ATTR blink()