PROS Operating System
repository·develop-pros-4·Indexed 43 days ago
https://github.com/purduesigbots/prosAn open-source, high-performance C/C++ development environment and operating system for the VEX V5 Brain. It provides a lightweight kernel supporting C23 and C++23, utilizing a modified FreeRTOS 9.0.0 for scheduling and the VEX Data Mesh Layer (VDML) for hardware abstraction. The ecosystem includes multiple versions, with PROS 3 as the primary focus for V5 and PROS 4 offering a reduced kernel size and liblvgl utilities.
What's inside PROS
- PROS is an open-source, lightweight, and fast operating system designed for the VEX V5 Brain. It is built using the GCC toolchain and follows standard C/C++ practices (supporting C23 and C++23 with GNU extensions). Because it runs on bare metal, it allows developers to leverage the full power of the microcontroller. PROS is suitable for developers working on Windows, OS X, or Linux.
Understand the VEX Data Mesh Layer (VDML)
develop-pros-4Thedevicessource files implement VDML (VEX Data Mesh Layer). VDML is the abstraction layer responsible for controlling V5 Smart Devices and other peripherals connected to the VEX V5 Brain. Developers interact with this layer to manage hardware components.Compare PROS versions (2, 3, and 4)
develop-pros-4PROS has different versions depending on the hardware platform and kernel architecture:
- PROS 2: The kernel for the VEX Arm Cortex-based Microcontroller. Development is focused on maintenance and critical bugfixes. C++ is not officially supported.
- PROS 3: The kernel for the VEX V5 microcontroller platform. This is the primary focus of development. C++ is officially supported.
- PROS 4: A kernel upgrade for V5 that decreases the base kernel size and provides utilities like the base device class and
liblvglfor easier customization. Documentation for PROS 4 is hosted on a Doxygen site.
Understand how PROS uses the FreeRTOS Kernel
develop-pros-4PROS 3 utilizes FreeRTOS 9.0.0 to provide core operating system functionality, including scheduling, queues, and lists. Because FreeRTOS is designed for various embedded architectures, PROS includes specific modifications to allow it to run on the V5 hardware (which uses a Zynq-7000 board).
Warning: Modifying the files within the
src/rtos/directory may break PROS or cause system instability.Follow PROS Kernel naming conventions
develop-pros-4The PROS kernel uses specific suffixes and casing to identify types and members. Use these conventions to ensure compatibility with the codebase and
clang-format.Naming Rules
- Structures: Append
_sto the name (e.g.,structname_s). - Enumerated types: Append
_eto the name (e.g.,enumname_e). - Enumerated members: Prefix with
E_and use uppercase snake_case (e.g.,E_ENUMNAME_MEMBERNAME). - Function pointers: Append
_fnto the name (e.g.,funcname_fn). - Type definitions: Append
_tto the end of the name. - C++ Classes: Use
UpperCamelCase(PascalCase). - C++ Class members: Use
lower_snake_case.
File Extensions
- C source:
.c - C++ source:
.cpp - C header:
.h - C++ header:
.hpp
- Structures: Append
Follow PROS word choice and terminology rules
develop-pros-4When writing documentation, adhere to the Google Developer Documentation Style Guide with these specific PROS overrides:
- Ports: Refer to all ports (Smart, ADI, etc.) as a "port", never as a "channel" or "pin".
- C++ Namespacing: Always use the full function name including the namespace (e.g., use
pros::Motor::move, notMotor::move). - Enum References: When referencing enumerated values in comments, use their full name as defined in the style guide (e.g.,
E_MOTOR_GEARSET_18), not the simplified version.
FreeRTOS API modifications in PROS
develop-pros-4The FreeRTOS kernel has been refactored to align with the PROS coding style. Key changes to the public-facing API include:
- Type Simplification: The use of
int32_tanduint32_thas been removed from public APIs. - Tick Precision: All variables pertaining to ticks in both internal and public PROS APIs now use millisecond precision. The conversion from ticks to milliseconds is performed immediately upon entering the function.
- Type Simplification: The use of
Use standard comment keywords for notes and fixes
develop-pros-4Use the following keywords in inline comments to help developers (and your future self) identify important notes or issues. Many editors highlight these automatically:
// TODO:Something that needs to be implemented.// NOTE:or// NB:General information about the code.// HACK:A non-ideal but working solution.// FIXME:Code that is broken and needs fixing.// XXX:A severe issue (worse than FIXME).// BUG:A known line of code causing a bug.
Install the PROS ecosystem
develop-pros-4To download the latest installer or view platform-specific installation instructions for Windows, OS X, or Debian-based Linux, visit the official website: pros.cs.purdue.edu.Get started with PROS
develop-pros-4Once installed, you can use the following resources to learn how to use PROS:
- New Users: Follow the basic tutorial to get acquainted with the ecosystem.
- Advanced Features: Access advanced tutorials for complex functionality.
- API Reference: Consult the extensive kernel API documentation.
Document code using Doxygen-style comments
develop-pros-4The PROS kernel requires Doxygen-style comments for different code levels to ensure proper documentation generation.
File-Level Comments
Place at the very start of the file. Include
\file, a description, and copyright information.Enum-Level Comments
Place immediately before the
enumdeclaration. Use a block comment for the enum description and trailing comments for members.Function-Level Comments
Place immediately before the function prototype in header files. Use
\paramfor parameters and\returnfor return values. If the function uses specificerrnovalues, list them explicitly.Inline Implementation Comments
Use
//(double slash followed by a space) for complex logic. Prefer placing comments on the line before the code rather than trailing the line./** * \file filename.h * * Short description of the file * * \copyright Copyright (c) 2017-2026, Purdue University ACM SIGBots. */ /* * Short description of the enum */ enum my_enum { E_MEMBER_0, // short description E_MEMBER_1 } /** * Brief description. * * \param parameter_name description * \return description */ void my_function(int parameter_name);Configure clang-format for PROS style
develop-pros-4The PROS coding style is based on the Google C++ Coding Style with specific modifications. Use the following configuration for
clang-format:TabWidth: 2 UseTab: ForIndentation ColumnLimit: 120 DerivePointerAlignment: false PointerAlignment: Left FixNamespaceComments: true ReflowComments: true SortIncludes: true AccessModifierOffset: 0 AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty