Back to Classic: FreeRTOS for Freescale S12(X)

One thing which is missing with the CodeWarrior for MCU10.2 announcement: MCU10.2 does not support the S12(X) from Freescale.

With this I still have several projects not ported to eclipse. So they are still implemented using the ‘classic’ (non-eclipse based) version of CodeWarrior for S12(X). And I’m using FreeRTOS in the eclipse based IDE with Processor Expert for S08, ColdFire and Kinetis, but not yet for the S12(X). What now?

Thanks to prework from, strong coffee and night shift hours I can proudly present:
FreeRTOS as Processor Expert component,
for both eclipse based CodeWarrior MCU V10 and classic CodeWarrior for S12(X) V5.1, supporting S08, S12(X), ColdFire and Kinetis; everything in a single component package 🙂


DEMO9S12XEP Board running FreeRTOS

The port and example project are now posted in the FreeRTOS community contributions. The FreeRTOS and additional components are available from Embedded Components.

The port for FreeRTOS was challenging as I wanted to support both S12 and the S12X core, with both for banked and small memory models. The interrupt stack is different for S12 and S12X. Depending on the memory model the port has to work with either JSR or CALL instructions. But after some tweaking, I had it running on the S12 with the Tower TWR-S12G240 and the S12X/XGATE on the DEMO9S12XEP100 board.

TWR-S12G240 Board running FreeRTOS

TWR-S12G240 Board running FreeRTOS

The biggest challenge was to have it compatible between the classic and the eclipse based CodeWarrior. The thing is that the eclipse based CodeWarrior comes with the concept of RTOS Adapter. The FreeRTOS component implements both the RTOS Adapter plus it has all the RTOS sources and the port for all the supported architectures. To prevent classic CodeWarrior to include RTOS adapter files I had to add a property in the component:

CodeWarrior classic setting in Processor Expert component

CodeWarrior classic setting in Processor Expert component

With this I was able to use the same Processor Expert component for both the eclipse based (MCU 10.2) and classic CodeWarrior (MCU 4.6 and S12(X) 5.1).

Next one? Maybe a FreeRTOS port for the Freescale DSC (Digital Signal Controller)? It will all depend on nights with lots of really, really strong coffee….

Happy classic coding 🙂



2 thoughts on “Back to Classic: FreeRTOS for Freescale S12(X)

  1. Pingback: Make my Make with Eclipse and MCU10 | MCU on Eclipse

  2. I’m currently trying to port my S12X with XGATE code from Cosmic over to Classic Codewarrior. I have a bootloader project that builds under both, which I cannot yet get working under CW. I can’t even view global S12X memory, only logical memory using the True Time debugger. This is seeming more and more like garbage to me. Does Eclipse do a better job debugging banked S12X memory? True Time won’t even allow me to view register directly like Cosmic can. I used to curse Cosmic but now I’m starting to appreciate their RealTime monitor feature and the fact that you can view global memory directly. I was really looking forward to reaping the benefits of PE in Classic CW. My hurdle at the moment is understanding why flash is protected when I build under CW and not when I build under Cosmic. I can’t even erase a flash block in the True Time debugger yet, let along program flash. I’m finding that the PRM format is way more cryptic than Cosmic’s LKF format, and I’m beginning to wonder why I would ever want to port to CW. So far, not so good.


What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s