LinuxCNC EMC Port to FreeRTOS? Curious...

More
2 years 7 months ago - 2 years 7 months ago #295293 by wez
Just curious from any LinuxCNC maintainers that are more experienced...

Has anyone ever dug deep enough or explored the possibility of porting EMC2 over to FreeRTOS OS that doesn't run Linux? Native embedded.

Yeah I know it'd be a monster, in all likely hood quite impossible given Linux dependencies, but I'd still be very interested to know if anyone has tried or performed a detailed analysis in the past?

Not much comes up searching around.

In all likelihood, at a guess, it'll be time vs benefit and slow MCUs and so on. But... I am still curious though.

Things are evolving in the hardware space and will continue to do so.

Flash sizes, ram sizes (256mb+) all growing.I'm aware anything that would be developed would likely be a vendor specific hardware implementation which goes entirely against the ethos of the project but still... it's a valid question, at least from a technical perspective?

I know EMC2 was ported to Solaris...

80-90% of the hal components wouldn’t work unless they were ported too to become equivalent versions of them to support embedded hardware (wrappers etc) which makes it kind of a pointless exercise.

Having something that runs natively on a high end MCU with sufficient memory coupled with direct access to its hardware peripherals - that would be incredible, it if performed and remained flexible.Remote GUI on a standard Linux machine or even possibly embedded too on a separate MCU driving HDMI display (MicroPython LVGL etc).

I’ve seen Risc-V Linux RT_PREMPT patches and the milk-v Duo/Duo-S too – that’d be interesting to see someone get a headless emc running on that (with its ethernet port) and to see the RTAI stats….

EDIT: Formatting
Last edit: 2 years 7 months ago by wez.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago - 2 years 7 months ago #295309 by tommylight
Search for "coolcnc.iso" it is a Linux running EMC2 in just 50MB size!
There is also a version of Debian Dog Puppy Linux with LinuxCNC that is a bit bigger in size.
I would stick with Linux, new version could still be made quite slim, so starting with Damn Small Linux might be doable as it has a new version, i think.
And if you want a fully functioning but very small distro, try Porteus.
All are able to run in Live mode for testing.
-
Personally, i would not bother much, used PC's are very cheap.
Edit
RiscV that is probably worth chasing...
Almost forgot, all this would probably require getting rid of everything QT as it has a huge overhead...
Last edit: 2 years 7 months ago by tommylight.
The following user(s) said Thank You: wez

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #295313 by wez
Thanks Tom! :) Really do appreciate it.
I'll certainly have a look at the distros you've suggested always good to learn!

Yeah reckon you're right. Risc-V is worth it - part of reason why I'm asking too - both for milk-v and other archs since it's only going to become more accessible over time. A fully embedded version of EMC2/LCNC core running on say the new Risc-V ESP32-P4 that takes advantage of the hardware - I think, would be truly amazing. Just flash a firmware on a board and you pretty much have a "lite" version of LCNC running.

Yeah yeah I know ESP32 again! But... please bear with me...

After all DMA tweaks and perf optimisations thus far on the S3 (Xtensa core) it's peaks 3% load (including hardware timers and interrupts) running all tasks at 400khz across 4 axis.
I'm genuinely floored.

So based on all that - I believe (could change) once the P4 is launched there may be a real possibility of port of LCNC that runs entirely embedded. I've done a bit of a brief analysis around memory usage and RTAI, whilst it's a big big effort to port, if its kept open source and free to all then I (hopefully) don't see a reason why it can't be done (don't detract from the project and feedback to improve and so forth).

Open to all and any feedback though!

Thanks :)
 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #295316 by tommylight


After all DMA tweaks and perf optimisations thus far on the S3 (Xtensa core) it's peaks 3% load (including hardware timers and interrupts) running all tasks at 400khz across 4 axis.

 
It is amazing what can be done with a bit of code optimization!
Great work, thank you.
When is P4 supposed to be available?

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago - 2 years 7 months ago #295335 by Mecanix
FreeRTos is a gimmick, but hey it's free! Great toy none the less...

Inviting you to the world of far superior and robust parallel multitask computing. Look no further than:

#include <pthread.h>
Last edit: 2 years 7 months ago by Mecanix.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago - 2 years 7 months ago #295350 by wez
I think you might be mistaken.
POSIX support and more specifically pthread on Espressif specifically is provided by the RTOS as wrappers by default.

docs.espressif.com/projects/esp-idf/en/l.../system/pthread.html

FreeRTOS helps with portability across architectures and provides numerous APIs for queuing, buffers, IPC and much more. Agnostic to the underlying hardware.

Why would you say it's a gimmick?

Doesn't always have to be hardcore low level engineering, use the features that are available to you for each use-case. Afterall, everything is built on the shoulders of others great work and findings...


EDIT: You will find that with any microcontroller there is an RTOS for POSIX APIs underneath (pthread). Still needs a scheduler to function!
PS:  www.eevblog.com/forum/microcontrollers/freertos-vs-pthread/
An analogy, think of the RTOS as the Linux equivalent of the Kernels scheduler. Without it, there's no POSIX threads (pthread)

Hope it helps clear things up!
Last edit: 2 years 7 months ago by wez.

Please Log in or Create an account to join the conversation.

Time to create page: 0.370 seconds
Powered by Kunena Forum