-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify and Fix support for esp8266 core v2.7 + v3 #1513
base: development
Are you sure you want to change the base?
Conversation
This change for esp8266 Arduino core v3+ should be also compatible with v2.6 and v2.7. |
0714dcc
to
5b45fe6
Compare
I can't find this email in my mailbox nor its content from any of the CI links above. Anyway, this patch is very simple. I'm not looking for credits and maintainer can use/integrate it after checking. |
I've tested this patch with the following Platform.io project https://github.com/kasparsd/era/compare/arduino-test with Wemos D1 mini (ESP8266) and it appears to be working as expected now. Here is the output from the build:
which previously wouldn't show up at all. |
return true; | ||
// register _process() to be called at most every 1us, | ||
// at every loop() or yield() | ||
return schedule_recurrent_function_us([](){ _process(); return true; }, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this approach compatible with the v2 version of the Arduino core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears to be working with v2.7.4, too:
> Executing task in folder mysensors-arduino-test: platformio run --target upload --target monitor --environment d1_mini <
Processing d1_mini (framework: arduino; platform: [email protected]; board: d1_mini)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (2.6.3) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 3.20704.0 (2.7.4)
- tool-esptool 1.413.0 (4.13)
- tool-esptoolpy 1.30000.201119 (3.0.0)
- tool-mklittlefs 1.203.210628 (2.3)
- tool-mkspiffs 1.200.0 (2.0)
- toolchain-xtensa 2.40802.200502 (4.8.2)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing git+https://github.com/d-a-v/MySensors#noCoreRedefinition
git version 2.33.1
Cloning into '/Users/kaspars/.platformio/.cache/tmp/pkg-installing-mxbmt7us'...
Library Manager: MySensors @ 2.4.0-alpha+sha.5b45fe6 has been installed!
Found 30 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <MySensors> 2.4.0-alpha+sha.5b45fe6
| |-- <SPI> 1.0
| |-- <Wire> 1.0
| |-- <EEPROM> 1.0
| |-- <ESP8266WiFi> 1.0
Building in release mode
Compiling .pio/build/d1_mini/src/main.cpp.o
Generating LD script .pio/build/d1_mini/ld/local.eagle.app.v6.common.ld
Compiling .pio/build/d1_mini/lib6fb/SPI/SPI.cpp.o
Compiling .pio/build/d1_mini/lib68b/Wire/Wire.cpp.o
Compiling .pio/build/d1_mini/libb79/EEPROM/EEPROM.cpp.o
Archiving .pio/build/d1_mini/libb79/libEEPROM.a
Indexing .pio/build/d1_mini/libb79/libEEPROM.a
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/BearSSLHelpers.cpp.o
Archiving .pio/build/d1_mini/lib6fb/libSPI.a
Indexing .pio/build/d1_mini/lib6fb/libSPI.a
Archiving .pio/build/d1_mini/lib68b/libWire.a
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/CertStoreBearSSL.cpp.o
Indexing .pio/build/d1_mini/lib68b/libWire.a
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFi.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiAP.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiGratuitous.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiSTA.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/ESP8266WiFiScan.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiClient.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiClientSecureAxTLS.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiClientSecureBearSSL.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiServer.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiServerSecureAxTLS.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiServerSecureBearSSL.cpp.o
Compiling .pio/build/d1_mini/libb9c/ESP8266WiFi/WiFiUdp.cpp.o
Compiling .pio/build/d1_mini/lib1bf/MySensors/MyASM.S.o
Archiving .pio/build/d1_mini/lib1bf/libMySensors.a
Indexing .pio/build/d1_mini/lib1bf/libMySensors.a
Archiving .pio/build/d1_mini/libFrameworkArduinoVariant.a
Indexing .pio/build/d1_mini/libFrameworkArduinoVariant.a
Compiling .pio/build/d1_mini/FrameworkArduino/Crypto.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Esp-frag.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Esp-version.cpp.o
Archiving .pio/build/d1_mini/libb9c/libESP8266WiFi.a
Indexing .pio/build/d1_mini/libb9c/libESP8266WiFi.a
Compiling .pio/build/d1_mini/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/FS.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/FSnoop.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Print.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Schedule.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/StackThunk.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/TypeConversion.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/Updater.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/WString.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/abi.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/base64.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/cont.S.o
Compiling .pio/build/d1_mini/FrameworkArduino/cont_util.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_app_entry_noextra4k.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_eboot_command.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_features.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_flash_quirks.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_flash_utils.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_i2s.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_main.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_noniso.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_phy.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_postmortem.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_si2c.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_sigma_delta.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_spi_utils.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_timer.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_waveform.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring_analog.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring_digital.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring_pulse.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring_pwm.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/core_esp8266_wiring_shift.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/crc32.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/debug.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/flash_hal.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/gdb_hooks.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/heap.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/libb64/cdecode.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/libb64/cencode.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/libc_replacements.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/sntp-lwip2.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs/spiffs_cache.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs/spiffs_check.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs/spiffs_gc.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs/spiffs_hydrogen.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs/spiffs_nucleus.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/spiffs_api.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/sqrt32.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/time.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/uart.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/umm_malloc/umm_info.c.o
Compiling .pio/build/d1_mini/FrameworkArduino/umm_malloc/umm_integrity.c.o
Compiling .pio/build/d1_mini/FrameworkArduino/umm_malloc/umm_local.c.o
Compiling .pio/build/d1_mini/FrameworkArduino/umm_malloc/umm_malloc.cpp.o
Compiling .pio/build/d1_mini/FrameworkArduino/umm_malloc/umm_poison.c.o
Archiving .pio/build/d1_mini/libFrameworkArduino.a
Indexing .pio/build/d1_mini/libFrameworkArduino.a
Linking .pio/build/d1_mini/firmware.elf
Building .pio/build/d1_mini/firmware.bin
Retrieving maximum program size .pio/build/d1_mini/firmware.elf
Checking size .pio/build/d1_mini/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [=== ] 33.8% (used 27716 bytes from 81920 bytes)
Flash: [=== ] 26.1% (used 272864 bytes from 1044464 bytes)
Creating BIN file ".pio/build/d1_mini/firmware.bin" using "/Users/kaspars/.platformio/packages/[email protected]/bootloaders/eboot/eboot.elf" and ".pio/build/d1_mini/firmware.elf"
Configuring upload protocol...
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/cu.usbserial-1420
Uploading .pio/build/d1_mini/firmware.bin
esptool.py v3.0
Serial port /dev/cu.usbserial-1420
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:db:84:dc:42:fc
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 277024 bytes to 203728...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (15 %)
Writing at 0x00008000... (23 %)
Writing at 0x0000c000... (30 %)
Writing at 0x00010000... (38 %)
Writing at 0x00014000... (46 %)
Writing at 0x00018000... (53 %)
Writing at 0x0001c000... (61 %)
Writing at 0x00020000... (69 %)
Writing at 0x00024000... (76 %)
Writing at 0x00028000... (84 %)
Writing at 0x0002c000... (92 %)
Writing at 0x00030000... (100 %)
Wrote 277024 bytes (203728 compressed) at 0x00000000 in 19.8 seconds (effective 112.1 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
========================================================================== [SUCCESS] Took 45.64 seconds ==========================================================================
--- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on /dev/cu.usbserial-1420 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
5096 !MCO:SND:NODE NOT REG
10124 !MCO:SND:NODE NOT REG
15154 !MCO:SND:NODE NOT REG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for testing/reviewing !
Is this approach compatible with the v2 version of the Arduino core?
It should work with v2.6+ (v2.6.x, v2.7.x, v3.0.x) of the esp8266 arduino core.
This API was not present in v2.5.x.
return true; | ||
// register _process() to be called at most every 1us, | ||
// at every loop() or yield() | ||
return schedule_recurrent_function_us([](){ _process(); return true; }, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build system doesn't like the style of this line. Here is the patch suggested by the build system:
diff --git a/hal/architecture/ESP8266/MyHwESP8266.cpp b/hal/architecture/ESP8266/MyHwESP8266.cpp
index c9f7d2b..d76e2cf 100644
--- a/hal/architecture/ESP8266/MyHwESP8266.cpp
+++ b/hal/architecture/ESP8266/MyHwESP8266.cpp
@@ -32,7 +32,10 @@ bool hwInit(void)
EEPROM.begin(EEPROM_size);
// register _process() to be called at most every 1us,
// at every loop() or yield()
- return schedule_recurrent_function_us([](){ _process(); return true; }, 1);
+ return schedule_recurrent_function_us([]() {
+ _process();
+ return true;
+ }, 1);
}
void hwReadConfigBlock(void *buf, void *addr, size_t length)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
Style is now fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI still does not send email but I now can read its reports:
commits are rebased, squashed and force-pushed.
Let's see
19d33e8
to
2097b5e
Compare
Are there any remaining things to be adjusted for this to get merged? |
If CI must pass before merging, someone may trigger it for a new run/test or help me fix as I don't understand the detailed issue. Or I'm also fine if a maintainer independently applies this three-lines patch to the main branch. |
@d-a-v I don't have any additional insight but it looks like the failing test is reporting an issue with Arduino esp8266 core 2.7.4:
during:
which is triggered when trying to build this:
You mentioned that:
so I'm not sure why it would be failing there. |
I honestly don't know what happens You are linking to the second CI error which is indeed weird, because the error is |
Sorry for the long wait. I think #1524 provides a solution to the same problem. Since 1524 has been merged, I'm closing this PR. Feel free to reopen with a comment if you think otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is reference to this file in MySensors/MySensors.h, imho should be removed as well
.piolibdeps/mysensors/MySensors/MySensors.h:453:10: fatal error: hal/architecture/ESP8266/MyMainESP8266.cpp: No such file or directory
453 | #include "hal/architecture/ESP8266/MyMainESP8266.cpp"
I'm getting this error when I try compile against Here is a gist with details: https://gist.github.com/chytreg/31fb06a72bb1c964c631f1241af4951b |
@chytreg
Can you provide this main.cpp file in gist and post here file path in your project? Thank you ATM I'm argue that you use some kind of ESPHome framework and try to include MySensors into it. I'm afraid this combination of ESPHome and MySensors will not work because both introduce and include special Main() functions. |
I've added main.cpp to the gist, it's generated by esphome. The original version of this code should work according o the author https://github.com/mannkind/ESPHomeMySensorsGatewayShim on
Im trying to compile it against recent version of ESPHome which have upgraded espressif8266 version since then. |
This proposal removes every core overrides that are needed to call
_process()
and usesschedule_recurrent_function_us()
to call it from the pseudo-background.Not tested.
Aims at fixing #1496
@Yveaux @virtual-maker @dungdao191299 @mfalkvidd @konstruktors.