Home > Workshops >

Building a Clean and Simple Command Line Interface in an RTOS Environment

Peifang Zhou - Available in 17 days, 16 hours and 34 minutes (2024-05-03 10:00 EDT)

Building a Clean and Simple Command Line Interface in an RTOS Environment
Peifang Zhou

It is a sequel to last year’s two presentations: Design Considerations for Serial Communications in an RTOS Environment and Building a Simple Command-Line Interface

After blinking a LED and sending out “Hello, World” over a serial port, the next step in a typical embedded development is to build a command-line interface (CLI) to bring up other components and interfaces. 

This workshop will demonstrate how to design a clean and simple CLI in an RTOS environment by partitioning functionalities and distributing them to functional blocks. The key insight is to view a console command as an immutable object and it flows through individual functional blocks. As a result of this streamlined design, simplicity is achieved by eliminating interactions between any non-neighboring blocks. In particular, there are three key ingredients in this simple CLI design:

  • A terminal utility program (e.g., Termite) as a builder to assemble command objects. Once a command object is fully constructed, it will be sent out to a target board over a serial interface.
  • The UART ISR as a de-serializer to reassemble the command object and notify a console task of the availability of such command object.
  • The console task as a dispatcher to find a command handler and delegate the rest of command processing to a worker task.

The workshop will first present the architectural design of the proposed simple CLI interface and then walk through its implementation with live coding. A low-cost STM32 Nucleo board will be used to demonstrate how simple it is to implement each functional block with less than a dozen lines of C code. After the workshop, the participants will be able to apply this clean and simple CLI design to their real-world projects.

M↓ MARKDOWN HELP
italicssurround text with
*asterisks*
boldsurround text with
**two asterisks**
hyperlink
[hyperlink](https://example.com)
or just a bare URL
code
surround text with
`backticks`
strikethroughsurround text with
~~two tilde characters~~
quote
prefix with
>

No comments or questions yet. Will you be the one who will break the ice?

OUR SPONSORS