-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Migrate core from NONOS SDK to FreeRTOS SDK #5790
Comments
If we are to move directly to the FreeRTOS SDK, there are some decisions to make. For starters:
|
If Espressif is actually putting NonOS to EOL, is there still any reason for them to keep their core libraries closed? And to play advocate of the devil, if it takes (really) a lot of effort of both the esp8266-Arduino team and the users to convert to an Arduino platform based on FreeRTOS, is there still demand for an Arduino implementation? Why would users then still want to move to Arduino/C++ if there is already a very fast growing MicroPython community? I think those are just about as important questions in this discussion. (I take it as a discussion ;) ) |
@TD-er The following are my own personal answers and opinions:
Yes. I don't agree with the libs being closed, but I don't see Espressif opening that code.
They will keep producing it for a long time to come, that is not in question. The ESP32 is more powerful, even the simpler versions, but it is still higher cost than the ESP, and it has its own list of issues. Migrating to the ESP32 may be an option for many users, but it is not an option for a whole lot of commercial users. In those cases, migration means complete redevelopment.
That is like asking whether the nonos sdk supports ssl. The support is provided by our Arduino core due to integration of bearssl, and not by the nonos sdk. In the case of FreeRTOS, there is ssl support as a component, but if we migrate to FreeRTOS sdk we'd evaluate whether we use that (wolfssl/mbedtls), or port our own bearssl integration.
yes, in fact support for a FreeRTOS-based core was requested a long time ago.
The MicroPython fw offers very little available heap for the user app. The last time I checked, it was something like 20KB less than our core. i think they still have a long way to go in that regard.
That may be, which is why I'm of the opinion we should achieve a stable nonos core version first, with all big issues resolved, and then freeze there. Once that happens, we should start development on the core based on FreeRTOS SDK I'd like to clarify that this issue is not meant for a general discussion about the future of the ESP, or ESP vs. ESP32, or C++ vs. Py, etc. This issue is meant for discussing how we should proceed with our core development to assure that we have a viable path forward before the nonos sdk is EOL'd, should that happen. That means we should decide what to do and proceed accordingly ASAP. |
The positive on using FreeRTOS is that compatibility with esp32 is improved/better possible. |
HI, I am the lead Lua core developer on the NodeMCU firmware project. My purpose for posting here, very much as a guest, is just to note that we are going through very similar discussions, though our drivers are somewhat different in that the Lua VM (like the Python VM) imposes some heavy runtime constraints on our implementation options, so I am monitoring your discussions and I invite you to do likewise with ours. As far as I can see at the moment (up to V3.0) the ESP8266 non-OS and RTOS variants use pretty much the same set of closed-source hardware abstraction libraries. It's just that RTOS has an extra layer over these to provide the normal RTOS services (tasks, threads, IPC, ...) and it uses a completely different make / build architecture. Like the JS-based nodeRED, our Lua VM employs an intrinsically non-blocking, task-based, single threaded paradigm, so RTOS offers us little functional benefit, and indeed could give our less experienced module contributers plenty of scope to screw things up. Pre 3.0 this was all moot since the ESP8266 simply didn't have enough RAM resource to run RTOS + Lua VM + sensible apps, but one of he things that Espressif has added to 3.0 is a variant of our non-aligned address exception handler (which they had initially ported to RTOS) and this allows pretty much all const data to be moved into flash. (This increased our available RAM by almost 30Kb when we first introduced it in 2016.) Now that the SDK libraries also use this, our builds have freed an extra 12Kb RAM, which might open the option of us moving to RTOS for us in the future. (Our main driver here is that our ESP32 variant is RTOS based, and this fork is causing us real maintenance overheads and problems.) |
Howdy, @TerryE . Thanks for the info!
And hence the big slowdown seen in loops/second in 2.2.x and pre3.0, potentially. The exception handler is neat from a usability perspective, but with an 8-10x performance penalty when it hits vs. inline using the 32b-only accesses to PMEM space it is not so neat for performance. Did we see a 12KB bump in heap free when going from 2.2.x to pre3, @d-a-v? I don't think I remember quite such a leap... |
Moving from sdk2.2.1 to sdk-pre3 with an empty sketch or a simple web-server shows:
We were not using real sdk-v3, but an intermediate version #5521. |
Hello @TerryE , it has been a while. Welcome to the discussion here. I saw that you pushed to migrate to post-v3 sdk. We migrated to the last version of the sdk prior to v3, because the partitions introduced in v3 are giving us headaches. At this point, we're deciding whether it's worth the effort to push through to a post-v3, or to migrate directly to an implementation based on some form of the latest FreeRTOS sdk v3.x.
In addition to the long migration effort, this is one of the sticking points being discussed. The question has come up whether we really need a full FreeRTOS. And here's what I find interesting: your current approach is event-driven, while ours is dual-context (similar to cofunctions), but in both cases there are timing restrictions. In your case, each task must be very short, while in our case the second context (aka CONT) must yield to the primary context (aka SYS) often enough. My personal opinion, based on my experience with the Lua firmware, and with the Arduino firmware here, is that, if designed correctly, a firmware architecture implemented over the full FreeRTOS sdk would relax a whole lot of restrictions. My thinking is simple: Have two threads: one that handles the wifi stack and maybe TCP/IP communication, and the other running the user application. |
We don't see a big slowdown. That may be because the Lua VM is already a pretty fat Flash-based app. I also put in some instrumentation into our handler to collect exception hotspots - the old Pareto principle applies, and looked at these:
Plus a few other tweaks and recodes. So in our case the exception handler didn't get called that much. IMO, it's also important to avoid the temptation of dropping the icache from 32k to 16k, as we found that this did crater runtime performance. I've only dabbled with the Arduino IDE using Atmel chips and not ESP ones, but I must admit that I don't see how this would mate well with a RTOS environment, but that is your business not mine. 😊 |
I vote for "we should achieve a stable nonos core version first, with all big issues resolved, and then freeze there" |
I second that, RTOS on esp8266 has low value : conveniance for code base supporters at cost of runtime cycles and power for users (other developers).
If this code base gets stable, it will be in use for years to come and id say even become a frame of reference for these other OSs that get promoted. Case in point: 68HC11 is still shipping!
k.
… On Mar 7, 2019, at 10:58, Juraj Andrássy ***@***.***> wrote:
I vote for "we should achieve a stable nonos core version first, with all big issues resolved, and then freeze there"
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@JAndrassy How to get there?
You dont get fixes from espressif for NON OS SDK anymore (soon). So you will never have a version without big issues.... |
Thanks for the heads-up. I'll do some benchmarking. |
Yes, the threat of no more fixes in future sounds very familiar. However, even it it were true, sometimes known bugs are things you just live with and work around. In the end, the imperfection is still predictable -- that is nearly everything. |
I really can't think of a clear reason why this would be the case. We typically just don't spend that much time in the SDK library routines, and I would feel that Tasmota would be even less. Using |
When RTOS based SDK can be expected? How much time will it cost approximately to migrate? |
I will personally take a serious look to this when espressif/ESP8266_RTOS_SDK#635. |
Isn't it better to start migration process asap and give that as beta? I mean espressif will probably provide WPA2 Enterprise example soon, so it will be easy to add as another beta version. There are 'fresh' exploits for WPA2 Enterprise authentication anyway: Can I help you somehow starting this process? As you said NONOS is EOL, so why not start migration earlier? |
That process will be an intensive work from anyone who knows the core (mainly but not only |
The plan is to seek a stability point after core release 3, then code freeze. Or rather, code chill: only critical bug fixes allowed. As @d-a-v hints, the effort expected to migrate is huge. Don't expect anything remotely resembling pre-alpha-prototype-experimental-usethisandboom for a long time. *It would make no sense to migrate to freertos if e.g. it's impossible to optimize enough free heap to run a secure server (about 20-25KB free heap minimum to allow handling just 1 client at a time) |
I'm not that involved in the community but reading through this makes me worried about the future of this project. If you factor in that many will be like me and may start looking at alternatives for fresh project, I think your best bet is to support your current user base, the ones (like me) that have invested time in building solutions that work on nonos. Be clear on a roadmap that keeps them happy with updates for as long as you can. Then announce an EOL date of your own and move on to new havens... RTOS if that is the right thing at that point. So, my user's perspective to this discussion in simple, I don't want to rewrite stuff that works. There's rarely any customer value in doing this. I'd rather spend time fixing stuff that doesn't work or add new features. Regards! |
I said:
That means that a path forward to FreeRTOS that reaches a point equivalent to where we are here could potentially not open. We won't know until investigation proceeds to a certain point. Also, I have a plan B for NONOS, which I don't want to discuss publicly at this point. It also requires big effort and investigation, though. I am (slowly) looking for ways to move forward with it in parallel with everything else. It requires some specific skills, though. |
Reference to espressif LTS? support announcement for nonos-sdk . That said, we actively work on maintaining this core. |
Sounds like a decent argument, but in this case I think this is complicated by the fact that (AFAIU) the SDK's that are used are not open, so some things simply cannot be fixed by the community and can only be fixed by Espressif, which has indicated it does not want to further develop the NONOS SDK. |
I see an opportunity for people to get more into assembly programming here and to re-construct the espressif SDK. The options presented are not good. Re-creating the existing SDK whilst un-familiar territory is a learning opportunity that a) has the smoothest transition from not having to having, and b) retains the hard work of many directly in project. For a long time coming, I see the esp8266 fulfilling a need where esp32 just isn't needed. FreeRTOS on the esp8266 would simply obsolete it. |
Since espressif does LTS support support (as already d-a-v wrote) i see no reason for a change. The actual core 2.7.4 runs very reliable and we have no issues (Project Tasmota) which can not be handeld in code. The only thing we change is the PWM code, which is not working good enough as it is now (solution is already there with PR7231 :-) ). The ESP8266 is dying in commercial products already (nearly none new TUYA device do use it). So the ESP8266 will be only a MCU for DIY projects soon. We all dont know which nice new MCU the future will bring? ESP32 will not replace the ESP8266. This train has left already. |
We all dont know which nice new MCU the future will bring? For me the ESP32-S2-MINI-1 looks like a good replacement for the ESP8266. I have played around with the esp32-s2-saola board. I like the flexibility they have with pin mapping. Cost for the ESP32-S2 modules are barely more than the ESP-12. I didn't like the larger size of the released modules, but the MINI cuts it down to size. |
We all dont know which nice new MCU the future will bring? Looking at espressif, ESP32-C3 could be a good replacement for ESP8266, and it will benefits of esp-idf, so it will be "natively" included in esp32-arduino core. |
Isn't that a completely different architecture? (different from the 'old' ESP32) |
It is based RISC-V, but from the official page, I can quote:
and
So I think there are good chances to use esp32-arduino core for ESP32-C3, which relays on esp-idf. |
@Jason2866 @fabiuz7 @RudyFiero if I'm not mistaken you all gave a variation of the same argument - and I have to agree. Time will solve this issue as "no need to change anything". Over time people will migrated to ESP32-or-successor models supported by the ESP-IDF and demand for ESP8266-based software will dry up. Espressif offers LTS for NonOS-SDK. We should be safe. |
There you mentioned, NonOS is coming to an end.. |
NonOS is coming to an end as well as ESP8266 is coming to an end. Recently Espressif has released ESP32-C3 and ESP32-C6 that seems way better (comparative table) than ESP8266 in pretty much every aspect. They are natively supported in esp-idf (so multitasking support is there from FreeRTOS) and hopefully in esp32-arduino core. If a project needs multitasking, probably these new MCUs are the way to go. For hobbyists and makers that like to tinker and learn about IoT, esp8266 will remain an excellent alternative. |
@fabianoriccardi I'm unsure about 8266 being EOL. It's much cheaper than the ESP32 chips but in some cases equally capable, and requires less energy to run. The main limitation is actually the software support rather than being taken over by newer chips. What I'm struggling to understand (and it might be just my ignorance) is that Espressif provides and maintains a full RTOS SDK for 8266. The main problem with that one is that you can't really use third-party libraries due to incompatibilities and the lack of Arduino components. On the other hand, it enables interrupting running tasks and creating threads (which is rather important in most almost all applications apart from a blinking LED). Would that be (too) much work to add the Arduino features from this library to the RTOS SDK maintained by Espressif? Or, to turn the current library into a "component", and use it as a component with IDF? Or was this Option 2, and therefore, a lot of work? As the idea came up over 2 years ago, it would be nice to understand where we are heading :) |
@adam-ah I think there is no intention to change the underlying SDK for this Arduino core. If you need ESP8266 capabilities, you can look at ESP32-C3, which seems way better in every aspect, from cost to performance to power consumption, and it can be programmed with ESP32 Arduino core, which integrated FreeRTOS (support to threads). I had benchmarked the Arduino JSON library on both MCUs here, and in general, esp32-c3 seems a bit better, even if this test represents a very narrow view of the computation capabilities of these MCUs.
From what I have understood, implementing Arduino Core as components is an option inside Option 2, so a lot of work. |
Thanks, @fabianoriccard.
It's quite interesting. Did you get to measure the energy consumption of the boards? Price is a problem, however; and it seems like the C3 costs roughly the same as the original ESP32 but it's generally hard to get (not as many sellers stock it). To me, the C3 seems like a bad middle-ground between a D1 mini (8266) and a 30-38 pin ESP32, but we are getting a little bit off-topic here :) |
I don't think it is really off-topic since newer and (eventually) better alternatives should be considered in this kind of discussion. I don't know where you look at prices, but on Mouser I see the bare chip esp32-c3 at 0.89€, while the esp8266 is 1.36€. On LCSC, they cost about the same 0.75€. About power consumption, the deep sleep mode should be 5uA on esp32-c3 and 20uA on esp8266. Of course, this is just a parameter. I can't say much on active states, apart from the quick test I performed on the official devkits here. |
Given this announcement from Espressif, is migrating to FreeRTOS SDK even an option? Unless I'm mistaken, the lack of esp-idf support for ESP8266 means that even though the controllers may not be EOL, all of the software that runs on them now is. |
IMHO, this announcement is another point supporting the idea that we shouldn't move to FreeRTOS SDK. In the end of the story, the EOL of both SDKs weren't so different (the latest significant release of NONOS was in 2020-Jun while the latest of FreeRTOS was in 2021-Apr). |
I tried NONOS and FreeRTOS in my repository, it has fota / httpd / https / mqtt / ota / uart.
IDE: Xcode NONOS is difficult for me to develop because it's not open source. FreeRTOS is FAT, but FAT is not from FreeRTOS. FreeRTOS has a big problem, GPIO ISR wouldn't be triggered at many WiFi areas. esp-clang supported xtensa-lx106-elf now, but less optimization for size. |
At this point in time I don't think we will get esp-idf for esp8266. @alexCajas made an Arduino core for ESP8266_RTOS_SDK |
Problem Description
We recently encountered issues with the latest pre3 NONOS SDK that forced us to revert to 2.2.1, ref #5784. The issues in the NONOS sdk, and their potential solutions, are tracked there.
This issue is meant to track solving a higher-level dilemma, which is what to do about the NONOS SDK moving forward.
Espressif has explained that the NONOS SDK will be maintained for the time being, but likely not enhanced. Their plan seems to be to EOL it, as emphasis will be kept on the FreeRTOS SDK and its migration to be similar to esp-idf.
There are then several paths forward possible:
1. Migrate to NONOS SDK v3.x
Pros:
Cons:
2. Migrate to a full FreeRTOS SDK (currently at v3.1)
Pros:
Cons:
3. Migrate to a limited FreeRTOS SDK (no preemptive)
Pros
Cons:
@d-a-v @earlephilhower @igrr and other maintainers: floor is open for discussion.
After thinking about this at length, my own preferences are as follows:
The text was updated successfully, but these errors were encountered: