diff --git a/.github/workflows/build-ide.yml b/.github/workflows/build-ide.yml index a2801a60cb..75e0e0583e 100644 --- a/.github/workflows/build-ide.yml +++ b/.github/workflows/build-ide.yml @@ -11,6 +11,22 @@ permissions: jobs: # Examples are built in parallel to avoid CI total job time limitation + sanity-check: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + with: + submodules: false + - uses: actions/cache@v3 + with: + path: ./tools/dist + key: ${{ runner.os }}-${{ hashFiles('package/package_esp8266com_index.template.json', 'tests/common.sh', 'tests/build.sh') }} + - name: Toolchain sanity checks + run: | + bash ./tests/sanity_check.sh build-linux: name: Linux - LwIP ${{ matrix.lwip }} (${{ matrix.chunk }}) diff --git a/cores/esp8266/Esp.cpp b/cores/esp8266/Esp.cpp index 0109bbe943..20da390008 100644 --- a/cores/esp8266/Esp.cpp +++ b/cores/esp8266/Esp.cpp @@ -471,7 +471,7 @@ bool EspClass::checkFlashCRC() { uint32_t firstPart = (uintptr_t)&__crc_len - 0x40200000; // How many bytes to check before the 1st CRC val // Start the checksum - uint32_t crc = crc32((const void*)0x40200000, firstPart, 0xffffffff); + uint32_t crc = crc32((const void*)0x40200000, firstPart); // Pretend the 2 words of crc/len are zero to be idempotent crc = crc32(z, 8, crc); // Finish the CRC calculation over the rest of flash diff --git a/cores/esp8266/core_esp8266_features.h b/cores/esp8266/core_esp8266_features.h index 43ba31674e..9c574f20c7 100644 --- a/cores/esp8266/core_esp8266_features.h +++ b/cores/esp8266/core_esp8266_features.h @@ -20,11 +20,9 @@ */ - #ifndef CORE_ESP8266_FEATURES_H #define CORE_ESP8266_FEATURES_H - #define CORE_HAS_LIBB64 #define CORE_HAS_BASE64_CLASS #define CORE_HAS_CXA_GUARD @@ -33,9 +31,10 @@ #define WIFI_HAS_EVENT_CALLBACK #define WIFI_IS_OFF_AT_BOOT -#include // malloc() +#include // bool #include // size_t #include +#include // malloc() #ifndef __STRINGIFY #define __STRINGIFY(a) #a @@ -118,6 +117,7 @@ int esp_get_cpu_freq_mhz() #else inline int esp_get_cpu_freq_mhz() { + uint8_t system_get_cpu_freq(void); return system_get_cpu_freq(); } #endif @@ -129,7 +129,7 @@ void enablePhaseLockedWaveform(void); // Determine when the sketch runs on ESP8285 #if !defined(CORE_MOCK) -bool __attribute__((const, nothrow)) esp_is_8285(); +bool esp_is_8285() __attribute__((const, nothrow)); #else inline bool esp_is_8285() { diff --git a/cores/esp8266/coredecls.h b/cores/esp8266/coredecls.h index 1e2776d71b..368aaf135c 100644 --- a/cores/esp8266/coredecls.h +++ b/cores/esp8266/coredecls.h @@ -20,18 +20,20 @@ void esp_delay(unsigned long ms); void esp_schedule(); void esp_yield(); void tune_timeshift64 (uint64_t now_us); +bool sntp_set_timezone_in_seconds(int32_t timezone); + void disable_extra4k_at_link_time (void) __attribute__((noinline)); void enable_wifi_enterprise_patch(void) __attribute__((noinline)); -bool sntp_set_timezone_in_seconds(int32_t timezone); void __disableWiFiAtBootTime (void) __attribute__((noinline)); void __real_system_restart_local() __attribute__((noreturn)); -uint32_t sqrt32 (uint32_t n); -uint32_t crc32 (const void* data, size_t length, uint32_t crc = 0xffffffff); +uint32_t sqrt32(uint32_t n); #ifdef __cplusplus } +uint32_t crc32(const void* data, size_t length, uint32_t crc = 0xffffffff); + #include using BoolCB = std::function; diff --git a/cores/esp8266/crc32.cpp b/cores/esp8266/crc32.cpp index c2fdf928e7..42de0c1b91 100644 --- a/cores/esp8266/crc32.cpp +++ b/cores/esp8266/crc32.cpp @@ -23,7 +23,7 @@ #include "pgmspace.h" // moved from core_esp8266_eboot_command.cpp -uint32_t crc32 (const void* data, size_t length, uint32_t crc /*= 0xffffffff*/) +uint32_t crc32 (const void* data, size_t length, uint32_t crc) { const uint8_t* ldata = (const uint8_t*)data; while (length--) diff --git a/tests/sanity_check.sh b/tests/sanity_check.sh new file mode 100755 index 0000000000..a4754a0ed4 --- /dev/null +++ b/tests/sanity_check.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +root=$(git rev-parse --show-toplevel) +source "$root/tests/common.sh" + +pushd "$root"/tools +python3 get.py -q + +popd +pushd "$cache_dir" + +gcc="$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc"\ +" -I$root/cores/esp8266"\ +" -I$root/tools/sdk/include"\ +" -I$root/variants/generic"\ +" -I$root/tools/sdk/libc/xtensa-lx106-elf" + +$gcc --verbose + +set -v -x + +cat << EOF > arduino.c +#include +EOF + +$gcc -c arduino.c + +cat << EOF > coredecls.c +#include +EOF + +$gcc -c coredecls.c + +cat << EOF > features.c +#include +EOF + +$gcc -c features.c + +cat << EOF > sdk.c +#include +EOF + +$gcc -c sdk.c