-
Notifications
You must be signed in to change notification settings - Fork 238
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
Moving OVMS to latest ESP-IDF framework #360
Comments
Original (now closed, as unresolvable) issue was here: Problems when trying to update esp-idf and toolchain to version 8.2 (the latest) #263 |
(After a lot of work) I have built the espressif crosstool-NG esp-2020r1 release version of the toolchain for my chosen dev environment (FreeBSD). Is it time to create branches of openvehicles/Open-Vehicle-Monitoring-System-3 and openvehicles/esp-idf to give us a place to work? I'd assume we want to target the esp-idf v4.0 release? |
I took a run at this today. I used the esp-idf v4.0 branch. I created a pull request for two easy problems. One is that esp32wifi::SetPowerMode() is using WIFI_PS_MODEM which is deprecated. In the current esp-idf-espressif version this is a define to WIFI_PS_MIN_MODEM. The define is gone by v4.0. The other problem was a conflict with the spi_signal_conn_t struct definition in components/spinodma/spi_master_nodma.c. The versions of spi_signal_conn_t in the esp-idf-espressif and v4.0 of soc/spi_periph.h look the same and are similar to what's in spi_master_nodma.c with members renamed (e.g. spiclk_native becomes spiclk_iomux_pin). There is a lot of churn resulting in code ifdef'ed off of ESP_DNS in components/lwip/port/esp32/include/lwipopts.h. This changes dns_getserver() from returning a pointer to a const ip_addr_t to returning a ip_addr_t. You can't just turn off ESP_DNS because it breaks some ESP_LWIP code (that really should be tied to ESP_DNS). I decided against including these changes in my pull request because it involves changing the esp-idf and I wanted my pull to be conservative. strverscmp() is in the standard libraries with gcc8 and conflicts with components/strverscmp. There are a bunch of gcc8 errors in the version of wolfssl we're using related to the len parameter to xstrncpy() and friends. This is supposed to indicate available space in the dst buffer. But the code is not using it that way (and it looks like their are many opportunities for buffer overflow!) For example:
where headerLen is set to the size of the buffer initially I dunno what is up with the rest of the calls. I looked at the current version of wolfssl and the code looks better but I suspect gcc8 will still flag remaining problems. Boot::Boot() in main/ovms_boot.cpp sets up an error handler that v4.0 doesn't have:
It looks like Fabrizio ran into this and opened an issue with espressif. When I stopped I was getting linker errors for undefined symbols, e.g. mbuf_init, mbuf_free, etc. I didn't find these in the v4.0 esp-idf. |
Regarding the panic callback, see my post: The gcc8 does a good job at detecting possible buffer issues, it's definitely a good idea not to ignore the warnings. |
I was going to do some more work on this; should I be targeting v4.0.1 (released three weeks ago) or v4.1 (beta2 pre-released a week ago). |
GCC 8.4.0 does not accept function defined only with `inline` while it is ok with `static inline`. GCC 5.2.0 does not seem to care. See also openvehicles/Open-Vehicle-Monitoring-System-3#360 Signed-off-by: Ludovic LANGE <[email protected]>
We have a local implementation of `strverscmp` ; however ESP-IDF seems to include it in newlib since version 4.x (I'm not 100% sure but at least in 4.4 it is present) A small test allows to include or not the component. Tested on both our local fork of ESP-IDF and release 4.4 See openvehicles#360 Signed-off-by: Ludovic LANGE <[email protected]>
GCC 8.4.0 does not accept an assignment with the macros [`SDMMC_HOST_DEFAULT()`](https://github.com/espressif/esp-idf/blob/8153bfe4125e6a608abccf1561fd10285016c90a/components/driver/include/driver/sdmmc_host.h#L30) and [`SDMMC_SLOT_CONFIG_DEFAULT()`](https://github.com/espressif/esp-idf/blob/8153bfe4125e6a608abccf1561fd10285016c90a/components/driver/include/driver/sdmmc_host.h#L92), because the macros are defined as a curly braces list ; it fails with `error: no match for 'operator=' (operand types are 'sdmmc_host_t' and '<brace-enclosed initializer list>')` This patch fixes the syntax so that it works with GCC 8.4.0, by prepending the type before the list. GCC 5.2.0 is OK with the fix. See openvehicles#360 Signed-off-by: Ludovic LANGE <[email protected]>
We have a local implementation of `strverscmp` ; however ESP-IDF seems to include it in newlib since version 4.x (I'm not 100% sure but at least in 4.4 it is present) A small test allows to include or not the component include files (which are otherwise defined in `<string.h>`) Tested on both our local fork of ESP-IDF and release 4.4 See openvehicles#360 Signed-off-by: Ludovic LANGE <[email protected]>
There are many CVE issues that have been fixed since the unsupported IDF 3.3 the OVMS is using currently: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=esp |
This issue will be used to track the possibility / progress of moving OVMS to the latest ESP IDF framework.
The text was updated successfully, but these errors were encountered: