From 629678adc69b1ae0e38c6a4c11f07ed2ef9d38a5 Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 25 Mar 2024 14:55:09 +0000 Subject: [PATCH] Address CI build warnings (#2742) This PR addresses warnings which have crept into the CI build logs. Worst case is probably esp32 with IDF 5.2 (GCC 13.2) producing 350 warnings, now 65. **General fixes** - Remove deprecated calls to command processing library from samples - Fix initialisation order and type names: still some instances of e.g. `uint8` which should be `uint8_t`. - Discovered component samples aren't built for Host in CI! Fixed this - note build time extended accordingly. - Simplify nested conditionals https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f56-avoid-unnecessary-condition-nesting **Fix compiler warnings/errors** Replaced a few more instances of printf with streaming operators, simpler and type-safe. Fixed `Overloaded virtual` warnings. **Note**: See remaining warnings for NimBLE (submodule) which need attention. **Graphics library fixes** - Fix control rendering: Should use their own bounds for positioning, set button font - Fix const parameters - use unique_ptr for getGlyph calls - Use `std::make_unique` and assignment instead of reset() - Avoid printf - Demote `reinterpret_cast` to `static_cast` where appropriate - Apply coding style to samples - Fix compiler warnings **Disable esp32 warning about RWX segments** Check introduced with linker (LD, binutils 2.39) from IDF 5.2 onwards This specifically refers to IRAM, which we do actually need to be writeable and executable. (IDF link code disables this warning also.) --- Sming/Arch/Esp32/app.mk | 5 ++++ .../Components/esp8266/include/ets_sys.h | 4 +-- .../Components/esp8266/include/sdk/mem.h | 6 ++-- .../Esp8266/Components/spi_flash/flashmem.c | 4 +-- Sming/Arch/Esp8266/Core/Digital.cpp | 4 +-- Sming/Arch/Esp8266/Core/Interrupts.cpp | 6 ++-- Sming/Arch/Esp8266/Platform/RTC.cpp | 4 +-- Sming/Arch/Host/Components/esp_hal/clk.c | 4 +-- .../Host/Components/esp_hal/include/esp_clk.h | 2 +- .../Components/esp_hal/include/esp_sleep.h | 2 +- .../Components/esp_hal/include/esp_system.h | 2 +- Sming/Arch/Host/Components/esp_hal/sleep.c | 2 +- Sming/Arch/Host/Components/esp_hal/system.cpp | 2 +- .../Host/Components/spi_flash/flashmem.cpp | 2 +- Sming/Arch/Host/Core/Digital.cpp | 2 +- Sming/Arch/Host/Tools/ci/build.run.sh | 1 + .../Arch/Esp8266/Platform/AccessPointImpl.cpp | 2 +- .../Arch/Esp8266/Platform/StationImpl.cpp | 2 +- .../Arch/Host/Platform/StationImpl.cpp | 30 ++++++++++--------- .../src/Network/Http/HttpServerConnection.h | 7 ++++- .../samples/Arducam/app/ArduCamCommand.cpp | 4 +-- .../samples/Arducam/include/ArduCamCommand.h | 7 +++-- Sming/Libraries/Graphics | 2 +- Sming/Libraries/IOControl | 2 +- Sming/Libraries/LittleFS | 2 +- Sming/Libraries/MDNS | 2 +- Sming/Libraries/MFRC522/MFRC522.cpp | 3 +- Sming/Libraries/MFRC522/MFRC522.h | 2 +- Sming/Libraries/OneWire/OneWire.h | 2 +- .../OtaUpgrade/OtaUpgrade/BasicStream.cpp | 2 -- .../samples/Upgrade/app/application.cpp | 8 ++--- Sming/Libraries/Servo/Servo.h | 14 ++++----- Sming/Libraries/UPnP | 2 +- Sming/Libraries/UPnP-Schema | 2 +- Sming/System/include/gdb/gdb_hooks.h | 4 +++ Sming/Wiring/FakePgmSpace.h | 2 +- samples/Basic_ProgMem/app/TestProgmem.cpp | 10 +++++-- samples/Basic_Servo/app/application.cpp | 4 +-- samples/Basic_Storage/app/application.cpp | 18 ++++++----- .../Basic_WebSkeletonApp/app/application.cpp | 1 - .../app/application.cpp | 1 - samples/Network_Ping/app/application.cpp | 2 +- samples/SDCard/app/application.cpp | 14 ++++----- tests/HostTests/modules/String.cpp | 2 +- 44 files changed, 113 insertions(+), 92 deletions(-) diff --git a/Sming/Arch/Esp32/app.mk b/Sming/Arch/Esp32/app.mk index 32f75955d9..6cc8658584 100644 --- a/Sming/Arch/Esp32/app.mk +++ b/Sming/Arch/Esp32/app.mk @@ -9,6 +9,11 @@ LDFLAGS += \ -nostdlib \ -Wl,-static +ifeq ($(IDF_VERSION),v5.2) +LDFLAGS += \ + -Wl,--no-warn-rwx-segments +endif + ifdef IDF_TARGET_ARCH_RISCV LDFLAGS += \ -nostartfiles \ diff --git a/Sming/Arch/Esp8266/Components/esp8266/include/ets_sys.h b/Sming/Arch/Esp8266/Components/esp8266/include/ets_sys.h index 4d9eb1109c..c2673186f8 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/include/ets_sys.h +++ b/Sming/Arch/Esp8266/Components/esp8266/include/ets_sys.h @@ -73,8 +73,8 @@ typedef void (*ets_isr_t)(void*); void ets_intr_lock(void); void ets_intr_unlock(void); void ets_isr_attach(int i, ets_isr_t func, void* arg); -void ets_isr_mask(uint32 mask); -void ets_isr_unmask(uint32 unmask); +void ets_isr_mask(uint32_t mask); +void ets_isr_unmask(uint32_t unmask); void NmiTimSetFunc(void (*func)(void)); diff --git a/Sming/Arch/Esp8266/Components/esp8266/include/sdk/mem.h b/Sming/Arch/Esp8266/Components/esp8266/include/sdk/mem.h index df1950df4a..6d3cb37d3d 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/include/sdk/mem.h +++ b/Sming/Arch/Esp8266/Components/esp8266/include/sdk/mem.h @@ -6,10 +6,10 @@ extern "C" { #endif -void* pvPortMalloc(size_t xWantedSize, const char* file, uint32 line); +void* pvPortMalloc(size_t xWantedSize, const char* file, uint32_t line); void* pvPortCalloc(size_t count, size_t size, const char*, unsigned); -void* pvPortZalloc(size_t xWantedSize, const char* file, uint32 line); -void vPortFree(void* ptr, const char* file, uint32 line); +void* pvPortZalloc(size_t xWantedSize, const char* file, uint32_t line); +void vPortFree(void* ptr, const char* file, uint32_t line); void* vPortMalloc(size_t xWantedSize); void pvPortFree(void* ptr); diff --git a/Sming/Arch/Esp8266/Components/spi_flash/flashmem.c b/Sming/Arch/Esp8266/Components/spi_flash/flashmem.c index 75f33ec622..4c434270f6 100644 --- a/Sming/Arch/Esp8266/Components/spi_flash/flashmem.c +++ b/Sming/Arch/Esp8266/Components/spi_flash/flashmem.c @@ -267,7 +267,7 @@ uint32_t flashmem_write_internal( const void *from, uint32_t toaddr, uint32_t si { assert(IS_ALIGNED(from) && IS_ALIGNED(toaddr) && IS_ALIGNED(size)); - SpiFlashOpResult r = spi_flash_write(toaddr, (uint32*)from, size); + SpiFlashOpResult r = spi_flash_write(toaddr, (uint32_t*)from, size); if(SPI_FLASH_RESULT_OK == r) return size; else{ @@ -280,7 +280,7 @@ uint32_t flashmem_read_internal( void *to, uint32_t fromaddr, uint32_t size ) { assert(IS_ALIGNED(to) && IS_ALIGNED(fromaddr) && IS_ALIGNED(size)); - SpiFlashOpResult r = spi_flash_read(fromaddr, (uint32*)to, size); + SpiFlashOpResult r = spi_flash_read(fromaddr, (uint32_t*)to, size); if(SPI_FLASH_RESULT_OK == r) return size; else{ diff --git a/Sming/Arch/Esp8266/Core/Digital.cpp b/Sming/Arch/Esp8266/Core/Digital.cpp index 434b69589f..d8bb1e6021 100644 --- a/Sming/Arch/Esp8266/Core/Digital.cpp +++ b/Sming/Arch/Esp8266/Core/Digital.cpp @@ -104,7 +104,7 @@ void digitalWrite(uint16_t pin, uint8_t val) if(pin != 16) GPIO_REG_WRITE((((val != LOW) ? GPIO_OUT_W1TS_ADDRESS : GPIO_OUT_W1TC_ADDRESS)), (1 << pin)); else - WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe) | (uint32)(val & 1)); + WRITE_PERI_REG(RTC_GPIO_OUT, (READ_PERI_REG(RTC_GPIO_OUT) & (uint32_t)0xfffffffe) | (uint32_t)(val & 1)); //GPIO_OUTPUT_SET(pin, (val ? 0xFF : 00)); } @@ -115,7 +115,7 @@ uint8_t digitalRead(uint16_t pin) if(pin != 16) return ((GPIO_REG_READ(GPIO_IN_ADDRESS) >> pin) & 1); else - return (uint8)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1); + return (uint8_t)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1); //return GPIO_INPUT_GET(pin); } diff --git a/Sming/Arch/Esp8266/Core/Interrupts.cpp b/Sming/Arch/Esp8266/Core/Interrupts.cpp index 7996b9e58f..daafce7582 100644 --- a/Sming/Arch/Esp8266/Core/Interrupts.cpp +++ b/Sming/Arch/Esp8266/Core/Interrupts.cpp @@ -31,14 +31,14 @@ static void interruptDelegateCallback(uint32_t interruptNumber) * @param intr_mask Interrupt mask * @param arg pointer to array of arguments */ -static void IRAM_ATTR interruptHandler(uint32 intr_mask, void* arg) +static void IRAM_ATTR interruptHandler(uint32_t intr_mask, void* arg) { bool processed; do { - uint32 gpioStatus = GPIO_REG_READ(GPIO_STATUS_ADDRESS); + uint32_t gpioStatus = GPIO_REG_READ(GPIO_STATUS_ADDRESS); processed = false; - for(uint8 i = 0; i < MAX_INTERRUPTS; i++) { + for(uint8_t i = 0; i < MAX_INTERRUPTS; i++) { if(!bitRead(gpioStatus, i)) { continue; } diff --git a/Sming/Arch/Esp8266/Platform/RTC.cpp b/Sming/Arch/Esp8266/Platform/RTC.cpp index b06db69d65..a90f06b9a2 100644 --- a/Sming/Arch/Esp8266/Platform/RTC.cpp +++ b/Sming/Arch/Esp8266/Platform/RTC.cpp @@ -67,8 +67,8 @@ bool RtcClass::setRtcSeconds(uint32_t seconds) void updateTime(RtcData& data) { - uint32 rtc_cycles; - uint32 cal, cal1, cal2; + uint32_t rtc_cycles; + uint32_t cal, cal1, cal2; cal1 = system_rtc_clock_cali_proc(); __asm__ __volatile__("memw" : : : "memory"); // Just for fun cal2 = system_rtc_clock_cali_proc(); diff --git a/Sming/Arch/Host/Components/esp_hal/clk.c b/Sming/Arch/Host/Components/esp_hal/clk.c index 8eedfb078f..6021a3e3b5 100644 --- a/Sming/Arch/Host/Components/esp_hal/clk.c +++ b/Sming/Arch/Host/Components/esp_hal/clk.c @@ -23,7 +23,7 @@ static uint32_t get_ccount(uint64_t nanos) return ccount; } -bool system_update_cpu_freq(uint8 freq) +bool system_update_cpu_freq(uint8_t freq) { if(freq == cpu_frequency) { return true; @@ -46,7 +46,7 @@ uint8_t ets_get_cpu_frequency(void) return cpu_frequency; } -uint8 system_get_cpu_freq(void) +uint8_t system_get_cpu_freq(void) { return ets_get_cpu_frequency(); } diff --git a/Sming/Arch/Host/Components/esp_hal/include/esp_clk.h b/Sming/Arch/Host/Components/esp_hal/include/esp_clk.h index da77d2650a..eb510b1dce 100644 --- a/Sming/Arch/Host/Components/esp_hal/include/esp_clk.h +++ b/Sming/Arch/Host/Components/esp_hal/include/esp_clk.h @@ -11,7 +11,7 @@ extern "C" { #define SYS_CPU_80MHZ 80 #define SYS_CPU_160MHZ 160 -bool system_update_cpu_freq(uint8 freq); +bool system_update_cpu_freq(uint8_t freq); uint8_t ets_get_cpu_frequency(void); uint8_t system_get_cpu_freq(void); diff --git a/Sming/Arch/Host/Components/esp_hal/include/esp_sleep.h b/Sming/Arch/Host/Components/esp_hal/include/esp_sleep.h index 82b4dfc028..9a6525d167 100644 --- a/Sming/Arch/Host/Components/esp_hal/include/esp_sleep.h +++ b/Sming/Arch/Host/Components/esp_hal/include/esp_sleep.h @@ -31,7 +31,7 @@ void wifi_fpm_auto_sleep_set_in_null_mode(uint8_t req); /* GPIO */ -void wifi_enable_gpio_wakeup(uint32 i, GPIO_INT_TYPE intr_status); +void wifi_enable_gpio_wakeup(uint32_t i, GPIO_INT_TYPE intr_status); void wifi_disable_gpio_wakeup(void); /* These aren't defined in the RTOS SDK */ diff --git a/Sming/Arch/Host/Components/esp_hal/include/esp_system.h b/Sming/Arch/Host/Components/esp_hal/include/esp_system.h index a436fad478..a1d4e0a42e 100644 --- a/Sming/Arch/Host/Components/esp_hal/include/esp_system.h +++ b/Sming/Arch/Host/Components/esp_hal/include/esp_system.h @@ -57,7 +57,7 @@ void os_delay_us(uint32_t us); const char* system_get_sdk_version(void); -uint32 system_get_chip_id(void); +uint32_t system_get_chip_id(void); bool system_rtc_mem_read(uint8_t src_addr, void* des_addr, uint16_t load_size); bool system_rtc_mem_write(uint8_t des_addr, const void* src_addr, uint16_t save_size); diff --git a/Sming/Arch/Host/Components/esp_hal/sleep.c b/Sming/Arch/Host/Components/esp_hal/sleep.c index d3aacca753..ae2d234973 100644 --- a/Sming/Arch/Host/Components/esp_hal/sleep.c +++ b/Sming/Arch/Host/Components/esp_hal/sleep.c @@ -46,7 +46,7 @@ void wifi_fpm_auto_sleep_set_in_null_mode(uint8_t req) /* GPIO */ -void wifi_enable_gpio_wakeup(uint32 i, GPIO_INT_TYPE intr_status) +void wifi_enable_gpio_wakeup(uint32_t i, GPIO_INT_TYPE intr_status) { } diff --git a/Sming/Arch/Host/Components/esp_hal/system.cpp b/Sming/Arch/Host/Components/esp_hal/system.cpp index 114cc751a0..02cec4e44a 100644 --- a/Sming/Arch/Host/Components/esp_hal/system.cpp +++ b/Sming/Arch/Host/Components/esp_hal/system.cpp @@ -96,7 +96,7 @@ const char* system_get_sdk_version(void) return version_string; } -uint32 system_get_chip_id(void) +uint32_t system_get_chip_id(void) { return 0xC001BEAF; } diff --git a/Sming/Arch/Host/Components/spi_flash/flashmem.cpp b/Sming/Arch/Host/Components/spi_flash/flashmem.cpp index 18a01c2b6e..9e65b39212 100644 --- a/Sming/Arch/Host/Components/spi_flash/flashmem.cpp +++ b/Sming/Arch/Host/Components/spi_flash/flashmem.cpp @@ -141,7 +141,7 @@ uint8_t flashmem_get_size_type() return flashmem_get_info().size; } -uint32 spi_flash_get_id(void) +uint32_t spi_flash_get_id(void) { return 0xFA1E0008; } diff --git a/Sming/Arch/Host/Core/Digital.cpp b/Sming/Arch/Host/Core/Digital.cpp index cb1f221e16..c266677a70 100644 --- a/Sming/Arch/Host/Core/Digital.cpp +++ b/Sming/Arch/Host/Core/Digital.cpp @@ -13,7 +13,7 @@ // Wemos D1 mini has pin 16 #define PIN_MAX 16 -static uint8 pinModes[PIN_MAX + 1]; +static uint8_t pinModes[PIN_MAX + 1]; DigitalHooks defaultHooks; static DigitalHooks* activeHooks = &defaultHooks; diff --git a/Sming/Arch/Host/Tools/ci/build.run.sh b/Sming/Arch/Host/Tools/ci/build.run.sh index 708f349153..d4aad47b37 100755 --- a/Sming/Arch/Host/Tools/ci/build.run.sh +++ b/Sming/Arch/Host/Tools/ci/build.run.sh @@ -14,6 +14,7 @@ if [[ $CHECK_SCA -eq 1 ]]; then "$DIR/coverity-scan.sh" else $MAKE_PARALLEL samples DEBUG_VERBOSE_LEVEL=3 + $MAKE_PARALLEL component-samples DEBUG_VERBOSE_LEVEL=3 fi # Build and run tests diff --git a/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp b/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp index d83ef86dd3..19037ecd1a 100644 --- a/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp +++ b/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp @@ -18,7 +18,7 @@ AccessPointClass& WifiAccessPoint = accessPoint; void AccessPointImpl::enable(bool enabled, bool save) { - uint8 mode; + uint8_t mode; if(save) { mode = wifi_get_opmode_default() & ~SOFTAP_MODE; } else { diff --git a/Sming/Components/Network/Arch/Esp8266/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp8266/Platform/StationImpl.cpp index 72fab1319f..63930c51ac 100644 --- a/Sming/Components/Network/Arch/Esp8266/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp8266/Platform/StationImpl.cpp @@ -30,7 +30,7 @@ class BssInfoImpl : public BssInfo void StationImpl::enable(bool enabled, bool save) { - uint8 mode; + uint8_t mode; if(save) { mode = wifi_get_opmode_default() & ~STATION_MODE; } else { diff --git a/Sming/Components/Network/Arch/Host/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Host/Platform/StationImpl.cpp index a981dc7ae6..25a71a9021 100644 --- a/Sming/Components/Network/Arch/Host/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Host/Platform/StationImpl.cpp @@ -161,24 +161,26 @@ bool StationImpl::isEnabled() const bool StationImpl::config(const Config& cfg) { for(auto& ap : apInfoList) { - if(cfg.ssid == ap.ssid) { - if(ap.authMode != AUTH_OPEN) { - if(cfg.password != ap.pwd) { - debug_w("Bad password for '%s'", cfg.ssid.c_str()); - return false; - } - } + if(cfg.ssid != ap.ssid) { + continue; + } - currentAp = ≈ - if(cfg.save) { - savedAp = ≈ + if(ap.authMode != AUTH_OPEN) { + if(cfg.password != ap.pwd) { + debug_w("Bad password for '%s'", cfg.ssid.c_str()); + return false; } + } - debug_i("Connected to SSID '%s'", cfg.ssid.c_str()); - - autoConnect = cfg.autoConnectOnStartup; - return true; + currentAp = ≈ + if(cfg.save) { + savedAp = ≈ } + + debug_i("Connected to SSID '%s'", cfg.ssid.c_str()); + + autoConnect = cfg.autoConnectOnStartup; + return true; } debug_w("SSID '%s' not found", cfg.ssid.c_str()); diff --git a/Sming/Components/Network/src/Network/Http/HttpServerConnection.h b/Sming/Components/Network/src/Network/Http/HttpServerConnection.h index 82a2fae9d5..0bb7958231 100644 --- a/Sming/Components/Network/src/Network/Http/HttpServerConnection.h +++ b/Sming/Components/Network/src/Network/Http/HttpServerConnection.h @@ -68,7 +68,7 @@ class HttpServerConnection : public HttpConnection } } - using TcpClient::send; + using HttpConnection::send; void setUpgradeCallback(HttpServerProtocolUpgradeCallback callback) { @@ -86,6 +86,11 @@ class HttpServerConnection : public HttpConnection } protected: + bool send(HttpRequest* request) override + { + return HttpConnection::send(request); + } + // HTTP parser methods int onMessageBegin(http_parser* parser) override; diff --git a/Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp b/Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp index c4bd3cddb3..2ddc3397f7 100644 --- a/Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp +++ b/Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp @@ -4,7 +4,7 @@ #include ArduCamCommand::ArduCamCommand(ArduCAM& CAM, CommandProcessing::Handler& commandHandler) - : myCAM(CAM), commandHandler(&commandHandler), imgSize(OV2640_320x240), imgType(JPEG) + : myCAM(CAM), commandHandler(&commandHandler), imgType(JPEG), imgSize(OV2640_320x240) { debug_d("ArduCamCommand Instantiating"); } @@ -155,7 +155,7 @@ void ArduCamCommand::setType(const String& type) setFormat(type == "BMP" ? BMP : JPEG); } -void ArduCamCommand::setFormat(uint8 type) +void ArduCamCommand::setFormat(uint8_t type) { if(type == BMP) { myCAM.set_format(BMP); diff --git a/Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h b/Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h index e3f3ffc1c9..ec07fc3690 100644 --- a/Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h +++ b/Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h @@ -23,11 +23,12 @@ class ArduCamCommand bool status = true; ArduCAM myCAM; CommandProcessing::Handler* commandHandler{nullptr}; - uint8 imgType; - uint8 imgSize; + uint8_t imgType; + uint8_t imgSize; + void processSetCommands(String commandLine, ReadWriteStream& commandOutput); - void setFormat(uint8 type); + void setFormat(uint8_t type); void showSettings(ReadWriteStream& commandOutput); const char* getImageType(); diff --git a/Sming/Libraries/Graphics b/Sming/Libraries/Graphics index 45ffbabc5e..7d2b503082 160000 --- a/Sming/Libraries/Graphics +++ b/Sming/Libraries/Graphics @@ -1 +1 @@ -Subproject commit 45ffbabc5e1ace51979ee84cf75d5a0ea635d296 +Subproject commit 7d2b503082c4219aaba0090f9ed4707b25740afa diff --git a/Sming/Libraries/IOControl b/Sming/Libraries/IOControl index b84671a34d..cd42d86b26 160000 --- a/Sming/Libraries/IOControl +++ b/Sming/Libraries/IOControl @@ -1 +1 @@ -Subproject commit b84671a34d452c49a0743b33070942c4bae3a474 +Subproject commit cd42d86b26901af9fedddb04a933807c5206ee5d diff --git a/Sming/Libraries/LittleFS b/Sming/Libraries/LittleFS index 21578a4816..237f1b73f0 160000 --- a/Sming/Libraries/LittleFS +++ b/Sming/Libraries/LittleFS @@ -1 +1 @@ -Subproject commit 21578a4816c5a8e17fa8aa091d149a53b9182631 +Subproject commit 237f1b73f0ba9bb8a49c0b6f5b209c56dd981550 diff --git a/Sming/Libraries/MDNS b/Sming/Libraries/MDNS index cb2d299958..bb7f00d3b9 160000 --- a/Sming/Libraries/MDNS +++ b/Sming/Libraries/MDNS @@ -1 +1 @@ -Subproject commit cb2d299958ee08d7bcdc3b8431c313e1057dda77 +Subproject commit bb7f00d3b91e5c4b2aa728057dbe5b1eac13a91a diff --git a/Sming/Libraries/MFRC522/MFRC522.cpp b/Sming/Libraries/MFRC522/MFRC522.cpp index 5b79dff3d5..f7411bb7de 100644 --- a/Sming/Libraries/MFRC522/MFRC522.cpp +++ b/Sming/Libraries/MFRC522/MFRC522.cpp @@ -30,8 +30,7 @@ void MFRC522::setSPIConfig() { } // End setSPIConfig() -void ICACHE_FLASH_ATTR - MFRC522::setControlPins(byte csPin,byte pdPin) { +void MFRC522::setControlPins(byte csPin,byte pdPin) { _chipSelectPin = csPin; _resetPowerDownPin = pdPin; diff --git a/Sming/Libraries/MFRC522/MFRC522.h b/Sming/Libraries/MFRC522/MFRC522.h index 927ee3f4df..5c849d1cb7 100644 --- a/Sming/Libraries/MFRC522/MFRC522.h +++ b/Sming/Libraries/MFRC522/MFRC522.h @@ -337,7 +337,7 @@ class MFRC522 { // Functions for manipulating the MFRC522 ///////////////////////////////////////////////////////////////////////////////////// void PCD_Init(); - void ICACHE_FLASH_ATTR setControlPins(byte csPin,byte pdPin); + void setControlPins(byte csPin,byte pdPin); void PCD_Reset(); void PCD_AntennaOn(); void PCD_AntennaOff(); diff --git a/Sming/Libraries/OneWire/OneWire.h b/Sming/Libraries/OneWire/OneWire.h index 80ca49e840..0a4c5a20be 100644 --- a/Sming/Libraries/OneWire/OneWire.h +++ b/Sming/Libraries/OneWire/OneWire.h @@ -137,7 +137,7 @@ class OneWire OneWire(uint8_t pin); void begin(); - void begin(uint8 pinOneWire); + void begin(uint8_t pinOneWire); // Perform a 1-Wire reset cycle. Returns 1 if a device responds // with a presence pulse. Returns 0 if there is no device or the diff --git a/Sming/Libraries/OtaUpgrade/OtaUpgrade/BasicStream.cpp b/Sming/Libraries/OtaUpgrade/OtaUpgrade/BasicStream.cpp index 094b0f3c00..c4575e2a5a 100644 --- a/Sming/Libraries/OtaUpgrade/OtaUpgrade/BasicStream.cpp +++ b/Sming/Libraries/OtaUpgrade/OtaUpgrade/BasicStream.cpp @@ -14,8 +14,6 @@ #include #include -extern "C" uint32 user_rf_cal_sector_set(void); - namespace OtaUpgrade { #ifndef ENABLE_OTA_DOWNGRADE diff --git a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/app/application.cpp b/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/app/application.cpp index 009c1ed25a..042bae2d0d 100644 --- a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/app/application.cpp +++ b/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/app/application.cpp @@ -92,10 +92,10 @@ void otaUpdate() void showInfo() { - Serial.printf(_F("\r\nSDK: v%s\r\n"), system_get_sdk_version()); - Serial.printf(_F("Free Heap: %d\r\n"), system_get_free_heap_size()); - Serial.printf(_F("CPU Frequency: %d MHz\r\n"), system_get_cpu_freq()); - Serial.printf(_F("System Chip ID: %x\r\n"), system_get_chip_id()); + Serial << endl << _F("SDK: v") << system_get_sdk_version() << endl; + Serial << _F("Free Heap: ") << system_get_free_heap_size() << endl; + Serial << _F("CPU Frequency: ") << system_get_cpu_freq() << _F(" MHz") << endl; + Serial << _F("System Chip ID: ") << String(system_get_chip_id(), HEX, 8) << endl; int total = 0; for(auto part : OtaManager.getBootPartitions()) { diff --git a/Sming/Libraries/Servo/Servo.h b/Sming/Libraries/Servo/Servo.h index 6d07753c56..1b13f6e1bb 100644 --- a/Sming/Libraries/Servo/Servo.h +++ b/Sming/Libraries/Servo/Servo.h @@ -78,13 +78,13 @@ class Servo private: ServoChannel* channels[maxChannels] = {0}; - unsigned channelCount = 0; ///< Number of active channels - HardwareTimer hardwareTimer; ///< Handles generation of output signals - Frame frames[2]; ///< Contains the active and next frames - uint8 activeFrameIndex = 0; ///< Frame being used by ISR - uint8 activeSlot = 0; ///< Slot being output by ISR - uint8_t nextFrameIndex = 0; ///< Frame to use when active frame has completed - SimpleTimer updateTimer; ///< If necessary, updates are pended + unsigned channelCount = 0; ///< Number of active channels + HardwareTimer hardwareTimer; ///< Handles generation of output signals + Frame frames[2]; ///< Contains the active and next frames + uint8_t activeFrameIndex = 0; ///< Frame being used by ISR + uint8_t activeSlot = 0; ///< Slot being output by ISR + uint8_t nextFrameIndex = 0; ///< Frame to use when active frame has completed + SimpleTimer updateTimer; ///< If necessary, updates are pended }; extern Servo servo; ///< global instance of the servo object diff --git a/Sming/Libraries/UPnP b/Sming/Libraries/UPnP index 28348c3d3e..6b73de1097 160000 --- a/Sming/Libraries/UPnP +++ b/Sming/Libraries/UPnP @@ -1 +1 @@ -Subproject commit 28348c3d3e60d7e3b38e53ba853493f0549b894c +Subproject commit 6b73de10973c513201acac11d10ae38d13580c6d diff --git a/Sming/Libraries/UPnP-Schema b/Sming/Libraries/UPnP-Schema index 4a0945dddc..0bb97e2287 160000 --- a/Sming/Libraries/UPnP-Schema +++ b/Sming/Libraries/UPnP-Schema @@ -1 +1 @@ -Subproject commit 4a0945dddc69fe138efb7b79aabca8eb04f9230e +Subproject commit 0bb97e228763fb7253dc20a221fb34771e7b6ff3 diff --git a/Sming/System/include/gdb/gdb_hooks.h b/Sming/System/include/gdb/gdb_hooks.h index 9821c29a10..e89f213b6c 100644 --- a/Sming/System/include/gdb/gdb_hooks.h +++ b/Sming/System/include/gdb/gdb_hooks.h @@ -58,7 +58,11 @@ void gdb_enable(bool state); #elif defined(ARCH_ESP8266) #define gdb_do_break() __asm__("break 0,0") #elif defined(ARCH_ESP32) +#if ESP_IDF_VERSION_MAJOR < 5 #define gdb_do_break() cpu_hal_break() +#else +#define gdb_do_break() esp_cpu_dbgr_break() +#endif #elif defined(ARCH_RP2040) #define gdb_do_break() __asm__("bkpt #0") #endif diff --git a/Sming/Wiring/FakePgmSpace.h b/Sming/Wiring/FakePgmSpace.h index 65b2a231a8..fae56002c7 100644 --- a/Sming/Wiring/FakePgmSpace.h +++ b/Sming/Wiring/FakePgmSpace.h @@ -137,7 +137,7 @@ int memcmp_aligned(const void* ptr1, const void* ptr2, unsigned len); * @brief Declare a global reference to a PSTR instance * @param name */ -#define DECLARE_PSTR(name) extern const char name[] PROGMEM; +#define DECLARE_PSTR(name) extern const char name[]; /** * @brief Create a local (stack) buffer called `name` and load it with flash data. diff --git a/samples/Basic_ProgMem/app/TestProgmem.cpp b/samples/Basic_ProgMem/app/TestProgmem.cpp index aac4f916b1..1815dc374d 100644 --- a/samples/Basic_ProgMem/app/TestProgmem.cpp +++ b/samples/Basic_ProgMem/app/TestProgmem.cpp @@ -49,7 +49,10 @@ void testPSTR(Print& out) // Note that characters after first nul won't be shown ... out.print("> demoPSTR1 (print char*): "); - out << '"' << _FLOAD(demoPSTR1) << '"' << endl; + { + LOAD_PSTR(s, demoPSTR1) + out << '"' << s << '"' << endl; + } // ... now they will: note buf will be aligned up to next dword boundary though out.print("> demoPSTR1 (write): "); @@ -131,7 +134,10 @@ void testFSTR(Print& out) // Test equality operators #define TEST(_test) out.printf(_F("%s: %s\n"), (_test) ? _F("PASS") : _F("FAIL"), _F(#_test)); TEST(demoFSTR1 == demoFSTR2) - TEST(demoFSTR1 != _FLOAD(demoPSTR1)) + { + LOAD_PSTR(s, demoPSTR1); + TEST(demoFSTR1 != s) + } TEST(String(demoFSTR1) == demoFSTR2) TEST(demoFSTR1 == String(demoFSTR2)) #undef TEST diff --git a/samples/Basic_Servo/app/application.cpp b/samples/Basic_Servo/app/application.cpp index 9fb66c4390..970d6fbb1c 100644 --- a/samples/Basic_Servo/app/application.cpp +++ b/samples/Basic_Servo/app/application.cpp @@ -31,8 +31,8 @@ class MyServoChannel : public ServoChannel private: Timer timer; - uint16 centerdelay = 0; - uint32 value = 0; + uint16_t centerdelay = 0; + uint32_t value = 0; int degree = 0; }; diff --git a/samples/Basic_Storage/app/application.cpp b/samples/Basic_Storage/app/application.cpp index e9fa62b362..04a260862a 100644 --- a/samples/Basic_Storage/app/application.cpp +++ b/samples/Basic_Storage/app/application.cpp @@ -12,16 +12,18 @@ void listSpiffsPartitions() Serial << _F(">> Mounting '") << part.name() << "' ..." << endl; bool ok = spiffs_mount(part); Serial.println(ok ? "OK, listing files:" : "Mount failed!"); - if(ok) { - Directory dir; - if(dir.open()) { - while(dir.next()) { - Serial.print(" "); - Serial.println(dir.stat().name); - } + if(!ok) { + continue; + } + + Directory dir; + if(dir.open()) { + while(dir.next()) { + Serial.print(" "); + Serial.println(dir.stat().name); } - Serial << dir.count() << _F(" files found") << endl << endl; } + Serial << dir.count() << _F(" files found") << endl << endl; } } diff --git a/samples/Basic_WebSkeletonApp/app/application.cpp b/samples/Basic_WebSkeletonApp/app/application.cpp index dcdbc84d42..ace2e6c8e6 100644 --- a/samples/Basic_WebSkeletonApp/app/application.cpp +++ b/samples/Basic_WebSkeletonApp/app/application.cpp @@ -36,7 +36,6 @@ void init() { Serial.begin(SERIAL_BAUD_RATE); // 115200 by default Serial.systemDebugOutput(true); - Serial.commandProcessing(false); #ifndef ENABLE_FLASHSTRING_MAP spiffs_mount(); // Mount file system, in order to work with files diff --git a/samples/Basic_WebSkeletonApp_LTS/app/application.cpp b/samples/Basic_WebSkeletonApp_LTS/app/application.cpp index 2d3d341db2..96b54664e4 100644 --- a/samples/Basic_WebSkeletonApp_LTS/app/application.cpp +++ b/samples/Basic_WebSkeletonApp_LTS/app/application.cpp @@ -12,7 +12,6 @@ void init() spiffs_mount(); // Mount file system, in order to work with files Serial.begin(SERIAL_BAUD_RATE); // 115200 by default Serial.systemDebugOutput(false); - Serial.commandProcessing(false); // Set higher CPU freq & disable wifi sleep System.setCpuFrequency(CpuCycleClockFast::cpuFrequency()); diff --git a/samples/Network_Ping/app/application.cpp b/samples/Network_Ping/app/application.cpp index 1c7521fb95..12c0aa5a42 100644 --- a/samples/Network_Ping/app/application.cpp +++ b/samples/Network_Ping/app/application.cpp @@ -20,7 +20,7 @@ constexpr uint8_t RESTART_DELAY_SECONDS = 2; Timer procTimer; -void ping(uint32 ip); +void ping(uint32_t ip); void pingTask() { diff --git a/samples/SDCard/app/application.cpp b/samples/SDCard/app/application.cpp index 7a777efb60..7d2eee5be9 100644 --- a/samples/SDCard/app/application.cpp +++ b/samples/SDCard/app/application.cpp @@ -108,7 +108,7 @@ void stat_file(char* fname) break; default: - Serial.printf(_F("Error(%d)\r\n"), fr); + Serial << _F("Error ") << fr << endl; } } @@ -162,11 +162,11 @@ void readWriteTest() f_printf(&file, _F(" has %d letters\r\n"), actual); if(actual != 5) { - Serial.printf(_F("Only written %u bytes\r\n"), actual); + Serial << _F("Only written ") << actual << _F(" bytes") << endl; } f_close(&file); } else { - Serial.printf(_F("fopen FAIL: %u\r\n"), (unsigned int)fRes); + Serial << _F("fopen FAIL: ") << fRes << endl; } } @@ -185,11 +185,11 @@ void readTest() f_read(&file, buffer, sizeof(buffer), &actual); buffer[actual] = 0; - Serial.printf(_F("Read: %s\r\n"), buffer); + Serial << _F("Read: ") << buffer << endl; f_close(&file); } else { - Serial.printf(_F("fopen FAIL: %u\r\n"), fRes); + Serial << _F("fopen FAIL: ") << fRes << endl; } } @@ -200,7 +200,7 @@ bool speedTest(unsigned num) uint32_t bytesPerRound; }; - static Test tests[] PROGMEM{ + static const Test tests[] PROGMEM{ {1024, 1}, {1024, 64}, {1024, 128}, {1024, 512}, {1024, 1024}, {4096, 1024}, {8192, 512}, {8192, 1024}, {8192, 8192}, }; @@ -209,7 +209,7 @@ bool speedTest(unsigned num) return false; } - Serial.printf(_F("4.%u: Write speed benchmark\r\n"), num + 1); + Serial << "4." << num + 1 << _F(": Write speed benchmark") << endl; auto& test = tests[num]; String filename; diff --git a/tests/HostTests/modules/String.cpp b/tests/HostTests/modules/String.cpp index ab0e0d87fa..8c48e8e5e5 100644 --- a/tests/HostTests/modules/String.cpp +++ b/tests/HostTests/modules/String.cpp @@ -156,7 +156,7 @@ class StringTest : public TestGroup void testMakeHexString() { - uint8 hwaddr[] = {0xaa, 0xbb, 0xcc, 0xdd, 0x12, 0x55, 0x00}; + uint8_t hwaddr[] = {0xaa, 0xbb, 0xcc, 0xdd, 0x12, 0x55, 0x00}; REQUIRE(makeHexString(nullptr, 6) == String::empty); REQUIRE(makeHexString(hwaddr, 0) == String::empty); REQUIRE(makeHexString(hwaddr, 6) == F("aabbccdd1255"));