From c9664d23086620431f64af833a1be24ff6aa837a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 20 Apr 2021 11:59:47 +0200 Subject: [PATCH] Esp32c3: work-around for `int32_t` definition --- include/fix_esp32c3.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/fix_esp32c3.h diff --git a/include/fix_esp32c3.h b/include/fix_esp32c3.h new file mode 100644 index 000000000..2e255d570 --- /dev/null +++ b/include/fix_esp32c3.h @@ -0,0 +1,40 @@ +/* + fix_esp32c3.h - webserver for Tasmota + + Copyright (C) 2021 Theo Arends + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Xtensa toolchain declares `int32_t` as `int` but RISC-V toolchain + * declares `int32_t` as `long int` which causes compilation errors. + * + * See: + * https://github.com/espressif/esp-idf/issues/6906 + * https://github.com/espressif/arduino-esp32/issues/5086 + * + * You need to add the following lines in `build_flags`: + * -I$PROJECT_DIR/include + * -include "fix_esp32c3.h" + */ +#ifdef __riscv + +#undef __INT32_TYPE__ +#define __INT32_TYPE__ int + +#undef __UINT32_TYPE__ +#define __UINT32_TYPE__ unsigned int + +#endif // __riscv