← Back to context

Comment by topspin

2 hours ago

> seems wasteful

This depends on what resources you're counting. If you're counting the developer cycles, it is not.

ESP-IDF+FreeRTOS has great value: it solves a host of mundane problems that need solving in real products. Discarding all of that value is foolish; you should preserve it, and look to keep your work aligned with the recent ESP-IDF and FreeRTOS evolution, so future you can adopt updates and supported tooling in a timely manner.

However, you also need at least some of your work to be hard real time, bare metal code. You do this through hardware peripherals, precision memory management, and tight ISRs that do not contend with whatever FreeRTOS or some Expressif driver is up to. Most of all, you want to never have to rework these parts because something in ESP-IDF and/or FreeRTOS, both rapidly moving targets, has changed.

Dedicating cores (0 for FreeRTOS, 1 for you) provides exactly this, and why ESP-IDF supports this model.

There is an ugly truth here. Ideally, one should not need to resort to such things. If the model and runtime behavior of the vendor's stack were extremely mature and could be relied upon with high confidence, it would not be necessary. However, anyone that has ever actually dealt with real time requirements and/or needed to fully exploit hardware peripheral capabilities in the real world of endlessly changing, incomplete, buggy BSPs/RTOSes/etc., knows that they probably won't live to see that.