mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-03 07:02:28 +03:00
Fix C builds (#8795)
Missing stdbool.h for 'bool' in features .h, at least one user is arduinoWebSockets Adds minimal headers sanity-check script to verify that C builds work as expected Also noticed and removed default argument from crc32() in internal .h that may be used in .c (not sure how extern C & default worked simultaniously, but at least in our .cpp Gcc somehow figured out it is a no overload solution)
This commit is contained in:
parent
7e2da8b25b
commit
840ef78237
16
.github/workflows/build-ide.yml
vendored
16
.github/workflows/build-ide.yml
vendored
@ -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 }})
|
||||
|
@ -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
|
||||
|
@ -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 <stdlib.h> // malloc()
|
||||
#include <stdbool.h> // bool
|
||||
#include <stddef.h> // size_t
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> // 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()
|
||||
{
|
||||
|
@ -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 <functional>
|
||||
|
||||
using BoolCB = std::function<void(bool)>;
|
||||
|
@ -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--)
|
||||
|
44
tests/sanity_check.sh
Executable file
44
tests/sanity_check.sh
Executable file
@ -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 <Arduino.h>
|
||||
EOF
|
||||
|
||||
$gcc -c arduino.c
|
||||
|
||||
cat << EOF > coredecls.c
|
||||
#include <coredecls.h>
|
||||
EOF
|
||||
|
||||
$gcc -c coredecls.c
|
||||
|
||||
cat << EOF > features.c
|
||||
#include <core_esp8266_features.h>
|
||||
EOF
|
||||
|
||||
$gcc -c features.c
|
||||
|
||||
cat << EOF > sdk.c
|
||||
#include <version.h>
|
||||
EOF
|
||||
|
||||
$gcc -c sdk.c
|
Loading…
x
Reference in New Issue
Block a user