PROS Operating System

repository·develop-pros-4·Indexed 43 days ago

https://github.com/purduesigbots/pros

An 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.

Tokens
2.5K
Snippets
4
Records
15
Agent score
55%

What's inside PROS

  1. Overview of PROS Kernel

    develop-pros-4
    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.
  2. Compare PROS versions (2, 3, and 4)

    develop-pros-4

    PROS 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 liblvgl for easier customization. Documentation for PROS 4 is hosted on a Doxygen site.
  3. Understand how PROS uses the FreeRTOS Kernel

    develop-pros-4

    PROS 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.

  4. Follow PROS Kernel naming conventions

    develop-pros-4

    The 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 _s to the name (e.g., structname_s).
    • Enumerated types: Append _e to the name (e.g., enumname_e).
    • Enumerated members: Prefix with E_ and use uppercase snake_case (e.g., E_ENUMNAME_MEMBERNAME).
    • Function pointers: Append _fn to the name (e.g., funcname_fn).
    • Type definitions: Append _t to 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
  5. Follow PROS word choice and terminology rules

    develop-pros-4

    When 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, not Motor::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.
  6. FreeRTOS API modifications in PROS

    develop-pros-4

    The FreeRTOS kernel has been refactored to align with the PROS coding style. Key changes to the public-facing API include:

    1. Type Simplification: The use of int32_t and uint32_t has been removed from public APIs.
    2. 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.
  7. Use standard comment keywords for notes and fixes

    develop-pros-4

    Use 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.
  8. Document code using Doxygen-style comments

    develop-pros-4

    The 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 enum declaration. 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 \param for parameters and \return for return values. If the function uses specific errno values, 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);
  9. Configure clang-format for PROS style

    develop-pros-4

    The 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