Skip to content

Port existing firmware modules to FreeRTOS #405

@npetersen2

Description

@npetersen2

This issue documents the next big project for @Known4225 to work on.

Goal: Move the codebase to be based on FreeRTOS, instead of the current "in-house" cooperative scheduler.

Background

Since the AMDC's inception about 5-6 years ago, it has used a cooperative scheduler for task running. See the docs here and here to read more about this.

This has worked alright and allowed the AMDC to be used in research projects to get experimental data. However, cooperative scheduling is not the best approach for a real-time motor drive application. This is because there must be hard scheduling guarantees which are simply impossible (or quite hard) to ensure are met across all code and systems. Many of the current AMDC firmware is written in an "odd" way specifically to help meet these timing requirements. If we move to FreeRTOS, a lot of code can be simplified!

AMDC-Firmware version numbering

For your reference, we have three main versions which will become relevant:

  • v1 -- this is the codebase that is the default. It has the cooperative scheduler, and has been used by everyone who has touched the AMDC in the past 5 years. Currently, v1.2.0 is the latest stable release.
  • v1.3 -- this is a pretty big change to the v1 codebase which changes the time-base of the cooperative scheduler to be tied to the PWM switching frequency. It is still a v1.x release since it is still compatible with the old system approach. Developers @codecubepi and @annikaolson have been working on this for the past year or so. It is mostly working, and is being using to run a research test bench for @anirudhupadhyaya and @noguchi-takahiro at UW-Madison. It is not fully released, so if you are interested in learning more, see this PR Release v1.3.0 #372.
  • v2 -- this is the next-generation firmware for the AMDC. It has been under development by @codecubepi for the past year or so. The main change is the full adoption of FreeRTOS and preemptive scheduling. This PR WIP: Release v2.0.0 #375 has all the new files for this codebase...it is still very early. The main work done by @codecubepi so far has been learning how to get dual-core apps running for FreeRTOS and being able to communicate between the cores with high performance.

Tasks for @Known4225

Your tasks are to start porting over the existing modules in the firmware to work with FreeRTOS. Below, I have outlined a recommended way of doing this:

  • Read as much FreeRTOS documentation as possible to really understand how the RTOS works and its design philosophy. I recommend reading the entire "book" from here.
  • Create a new single-core FreeRTOS skeleton application. This will be decoupled from the work by @codecubepi for the dual core apps. You should go through the process in the SDK of setting up a new demo application, getting it running, and getting it committed to git with the correct files ignored and correct files included.
  • Port command-line interface (CLI) to work with preemptive task design #321

The goal is, after completing these tasks, you will be able to type commands to the AMDC and it will run the command handlers, just like now... Except the full backend is FreeRTOS.

Helpful Resources

NOTE: most new examples will refer to AMD Xilinx Vitis software development....however, the AMDC still uses the older SDK environment. This will slightly alter the creation of new projects, but overall, is mostly the same.

Metadata

Metadata

Assignees

Labels

v2For FreeRTOS codebase

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions