From 7f8055277d4a5c77511a2cc14d6dc80e21297d94 Mon Sep 17 00:00:00 2001 From: Rainer Poisel Date: Thu, 11 Feb 2016 18:40:25 +0000 Subject: [PATCH 1/4] assembler flags corrected --- arduino/CMakeLists.txt | 7 ++++--- arduino/libraries/GDBStub/CMakeLists.txt | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/arduino/CMakeLists.txt b/arduino/CMakeLists.txt index 7412121..2549333 100644 --- a/arduino/CMakeLists.txt +++ b/arduino/CMakeLists.txt @@ -51,17 +51,18 @@ file(GLOB_RECURSE ARDUINO_SRC ${ARDUINO_ESP8266_DIR}/cores/esp8266/*.cpp ) -file(GLOB ARDUINO_ASM_SRC +file(GLOB ARDUINO_SRC_ASM ${ARDUINO_ESP8266_DIR}/cores/esp8266/*.S ) -set_source_files_properties(${ARDUINO_ASM_SRC} PROPERTIES +set_source_files_properties(${ARDUINO_SRC_ASM} PROPERTIES LANGUAGE ASM + COMPILE_FLAGS ${CMAKE_C_FLAGS} ) add_library(arduino STATIC ${ARDUINO_SRC} - ${ARDUINO_ASM_SRC} + ${ARDUINO_SRC_ASM} ) target_include_directories(arduino PUBLIC diff --git a/arduino/libraries/GDBStub/CMakeLists.txt b/arduino/libraries/GDBStub/CMakeLists.txt index a3aaeb8..af8a0b4 100644 --- a/arduino/libraries/GDBStub/CMakeLists.txt +++ b/arduino/libraries/GDBStub/CMakeLists.txt @@ -3,8 +3,18 @@ file(GLOB GDBSTUB_LIB_SRC ${ARDUINO_ESP8266_DIR}/libraries/GDBStub/src/internal/*.S ) +file(GLOB GDBSTUB_LIB_SRC_ASM + ${ARDUINO_ESP8266_DIR}/libraries/GDBStub/src/internal/*.S +) + +set_source_files_properties(${GDBSTUB_LIB_SRC_ASM} PROPERTIES + LANGUAGE ASM + COMPILE_FLAGS ${CMAKE_C_FLAGS} +) + add_library(esp8266gdbstub STATIC ${GDBSTUB_LIB_SRC} + ${GDBSTUB_LIB_SRC_ASM} ) target_include_directories(esp8266gdbstub PUBLIC @@ -14,9 +24,12 @@ target_include_directories(esp8266gdbstub PUBLIC ${ARDUINO_ESP8266_DIR}/libraries/GDBStub/src/xtensa/config ) -target_link_libraries(esp8266gdbstub PUBLIC - arduino +target_compile_definitions(esp8266gdbstub PUBLIC + -DGDBSTUB_REDIRECT_CONSOLE_OUTPUT + -DGDBSTUB_CTRLC_BREAK + -DGDBSTUB_BREAK_ON_INIT ) - - +target_link_libraries(esp8266gdbstub + arduino +) From 370018f83c7b1e3fb3735569b186d889efd15ac9 Mon Sep 17 00:00:00 2001 From: Rainer Poisel Date: Fri, 12 Feb 2016 06:35:55 +0000 Subject: [PATCH 2/4] Debugging experience improved --- arduino/CMakeLists.txt | 2 +- arduino/libraries/GDBStub/CMakeLists.txt | 2 +- cmake/toolchain.ESP8266.cmake | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arduino/CMakeLists.txt b/arduino/CMakeLists.txt index 2549333..6326dd0 100644 --- a/arduino/CMakeLists.txt +++ b/arduino/CMakeLists.txt @@ -57,7 +57,7 @@ file(GLOB ARDUINO_SRC_ASM set_source_files_properties(${ARDUINO_SRC_ASM} PROPERTIES LANGUAGE ASM - COMPILE_FLAGS ${CMAKE_C_FLAGS} + COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}" ) add_library(arduino STATIC diff --git a/arduino/libraries/GDBStub/CMakeLists.txt b/arduino/libraries/GDBStub/CMakeLists.txt index af8a0b4..4c26920 100644 --- a/arduino/libraries/GDBStub/CMakeLists.txt +++ b/arduino/libraries/GDBStub/CMakeLists.txt @@ -9,7 +9,7 @@ file(GLOB GDBSTUB_LIB_SRC_ASM set_source_files_properties(${GDBSTUB_LIB_SRC_ASM} PROPERTIES LANGUAGE ASM - COMPILE_FLAGS ${CMAKE_C_FLAGS} + COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}" ) add_library(esp8266gdbstub STATIC diff --git a/cmake/toolchain.ESP8266.cmake b/cmake/toolchain.ESP8266.cmake index e9ab3cf..41c6642 100644 --- a/cmake/toolchain.ESP8266.cmake +++ b/cmake/toolchain.ESP8266.cmake @@ -38,8 +38,16 @@ message("Using " ${ESP8266_ESPTOOL} " esptool binary.") CMAKE_FORCE_C_COMPILER(${ESP8266_XTENSA_C_COMPILER} GNU_C) CMAKE_FORCE_CXX_COMPILER(${ESP8266_XTENSA_CXX_COMPILER} GNU_CXX) -set(CMAKE_C_FLAGS "-Os -g -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wundef -pipe -D__ets__ -DICACHE_FLASH -fno-inline-functions -ffunction-sections -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -fdata-sections") -set(CMAKE_CXX_FLAGS "-Os -g -D__ets__ -DICACHE_FLASH -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections") +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(CMAKE_C_FLAGS "-std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wundef -pipe -D__ets__ -DICACHE_FLASH -fno-inline-functions -ffunction-sections -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -fdata-sections" CACHE STRING "") +set(CMAKE_C_FLAGS_DEBUG " -Og -ggdb3 -DUSE_GDBSTUB" CACHE STRING "") +set(CMAKE_C_FLAGS_RELEASE " -Os -g" CACHE STRING "") + +set(CMAKE_CXX_FLAGS "-D__ets__ -DICACHE_FLASH -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections" CACHE STRING "") +set(CMAKE_CXX_FLAGS_DEBUG "-Og -ggdb3 -DUSE_GDBSTUB" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELEASE "-Os -g" CACHE STRING "") + set(CMAKE_EXE_LINKER_FLAGS "-nostdlib -Wl,--no-check-sections -Wl,-static -Wl,--gc-sections") set(CMAKE_C_LINK_EXECUTABLE " -o -Wl,--start-group -Wl,--end-group") From 5d10611aa13eb833700617bbac6e4d7daab093c5 Mon Sep 17 00:00:00 2001 From: Rainer Poisel Date: Tue, 29 Mar 2016 20:58:57 +0000 Subject: [PATCH 3/4] Default Arduino framework version increased to 2.1.0 --- arduino/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino/CMakeLists.txt b/arduino/CMakeLists.txt index 6326dd0..4b339ea 100644 --- a/arduino/CMakeLists.txt +++ b/arduino/CMakeLists.txt @@ -1,4 +1,4 @@ -set(ARDUINO_ESP8266_DIR ${ARDUINO_DIR}/packages/esp8266/hardware/esp8266/2.0.0 CACHE PATH "Path to the directory containing ESP8266 specific arduino files") +set(ARDUINO_ESP8266_DIR ${ARDUINO_DIR}/packages/esp8266/hardware/esp8266/2.1.0 CACHE PATH "Path to the directory containing ESP8266 specific arduino files") if (ARDUINO_ESP8266_DIR STREQUAL "") message(FATAL_ERROR "ARDUINO_ESP8266_DIR has not been set.") endif () From 913004565a34f41d88dc7b1d65d587a2449373e4 Mon Sep 17 00:00:00 2001 From: Rainer Poisel Date: Sat, 23 Apr 2016 14:02:37 +0000 Subject: [PATCH 4/4] Linker script made into variable --- cmake/toolchain.ESP8266.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/toolchain.ESP8266.cmake b/cmake/toolchain.ESP8266.cmake index 41c6642..a3b007e 100644 --- a/cmake/toolchain.ESP8266.cmake +++ b/cmake/toolchain.ESP8266.cmake @@ -6,6 +6,7 @@ set(CMAKE_SYSTEM_VERSION 1) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules") set (ESP8266_FLASH_SIZE "512K" CACHE STRING "Size of flash") +set (ESP8266_LINKER_SCRIPT "eagle.flash.512k0.ld" CACHE STRING "Name of linker script") if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") set(USER_HOME $ENV{HOME})