FreeRTOS on PIC18F

Hi,
perhaps a bit of a silly question but have little experience on FreeRTOS and never used it on
PIC18F micros.

Specifically I would need to use it on the PIC18F46K22 (datasheet link below) and the application is about controlling multiple external processes, sensors and actuators but all very low speed.

Is there a port for it?

If there is a port for it, how do I find out the memory footprint vs functionality enabled?

For relatively simple low speed application, do you see any issues or limitations using that micro?

Datasheet here: https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/PIC18(L)F2X-4XK22-Data-Sheet-40001412H.pdf)

Thank you
Rick

1 Like

Hey, we have a port for the PIC18 here: FreeRTOS-Kernel/portable/WizC/PIC18 at c1980cedb110e3826fbf22d93fccaa2ca3d9daf8 · FreeRTOS/FreeRTOS-Kernel · GitHub

2 Likes

It is technically possible for the PIC18 to run FreeRTOS and there are two ports. However, the primary compiler for PIC18 (MPLAB XC8) is NOT the version supported by either port. The MPLAB port is for the old C18 compiler. This older compiler uses a traditional call parameter stack and therefore could support context switching tasks. The newer XC8 compiler uses a “compiled” stack that converts all local variables into absolute addresses and therefore would not be compatible with multiple tasks.

The current XC8 does have a software stack mode MPLAB® XC8 C Compiler User’s Guide for PIC® MCU
That may be possible to adapt to FreeRTOS. Currently there is not a port for this combination so the opportunity exists for you to contribute a port.

If you can choose your MCU, I would recommend a Cortex M0+ like the SAMD21 as a good choice for FreeRTOS.

2 Likes