README.md should be stored in each component folder.
See below for programming guidelines for this repository.
| Name | Designator | Path | Comments |
|---|---|---|---|
| Steering Wheel | stw | components/steering_wheel/ | Steering Wheel Controller |
| BMS Boss | bmsb | components/bms_boss/ | Battery Management System Boss Controller |
| BMS Worker | bmsw | components/bms_worker/ | Battery Management System Boss Controller |
| Bootloader | bl | components/bootloader/ | Embedded Bootloaders for all Controllers |
| Heartbeat | heartbeat | components/heartbeat/ | Generic Heartbeat Application for all Controllers |
| Front Vehicle Controller | vcfront | components/vc/front | Vehicle Controller code specific to the Front Controller |
| Power Distribution Unit | vcpdu | components/vc/pdu | Vehicle Controller code specific to the Power Distribution Unit |
| Rear Vehicle Controller | vcrear | components/vc/rear | Vehicle Controller code specific to the Rear Controller |
| Name | Designator | Path | Comments |
|---|---|---|---|
| Can Bridge | can-bridge | drive-stack/can-bridge | Handles bridging and decoding CAN messages over IPC |
| Concordia UDS Tool | conUDS | drive-stack/conUDS | Tool to drive UDS sessions with controllers. |
| Platform | Designator | Comments |
|---|---|---|
| CFR24 | cfr24 | Competition car for 2024 |
| CFR25 | cfr25 | Competition car for 2025 |
- Each component is broken into 3 main code sources
- Source Code
- The source code is typically located in
./components/$COMPONENT_DESIGNATOR/for each component - Hardware sources to be included
./components/$DESIGNATOR/HW/mcuConfig.yamlunless multiple platforms are supported - The source code, while it varies between component, has these typical areas:
./components/$COMPONENT_DESIGNATOR/build/- Contains all object files, binary files, etc...
./components/$COMPONENT_DESIGNATOR/generated/- Contains code generated by scripts and/or programs which is used by the embedded system
./components/$COMPONENT_DESIGNATOR/HW/- Contains all firmware source code and header files which interfaces between System Calls and the Hardware
./components/$COMPONENT_DESIGNATOR/include/- Contains all System and Application header files
./components/$COMPONENT_DESIGNATOR/lib/- Contains any library source code and header files which the System uses
./components/$COMPONENT_DESIGNATOR/RTOS-Contains all source code and header files relating to the implementation of the System's RTOS./components/$COMPONENT_DESIGNATOR/src- Contains all System and Application level source code
./components/$COMPONENT_DESIGNATOR/BUCK- Defines the build targets for that component
./components/shared/: Team libraries, configurations, drivers, firmware, and other...
- The source code is typically located in
- Embedded System
- Contains libraries, openocd configurations, and platform code accessible to all devices located in
./embedded/ - Select important sections:
./embedded/libs/CMSIS/: Controller independant system level library- Used for RTOS and other controller independant systems
./embedded/platforms/: Supported Hardware and MCU platforms- Contains the HAL/LL, startup code, and link script for the STM32 family of devices in
./embedded/platforms/stm32/
- Contains the HAL/LL, startup code, and link script for the STM32 family of devices in
- Contains libraries, openocd configurations, and platform code accessible to all devices located in
- Chip Configuration
- The chip configuration is stored in YAML files in
./embedded/platforms/$CHIP.yaml
- The chip configuration is stored in YAML files in
- Install
buck2,reindeer, anduvon your host system.
- Build a target with
buck2 build //$TARGET_PATH:$TARGET_NAME- You can specify a specific local output directory with
buck2 build ... --out $SOME_LOCAL_PATH - Buck2 (when not specified) outputs the files to some deep folder in
buck-out/
- You can specify a specific local output directory with
- Run software locally with
buck2 build //$TARGET_PATH:$TARGET_NAME- Software must be compatible with your host system
- To clean your current directory, run
buck2 clean - If doing loading/debugging of physical hardware, the ST-LINK or other interface must be plugged in by USB before starting the container. Docker containers do not support dynamic loading of USB peripherals
- Note: This only works if no bootloader is installed. If a bootloader is installed and you are debugging through JTAG, you should still flash over CAN
Tools like clangd use a compilation database (typically compile_commands.json)to provide lots of useful functionality like jump-to-def, show-refs, etc.
We support building compilation databases for our components! For example, to build the compilation database for the steering wheel, you would run:
buck2 bxl buck2/tools/comp_db.bxl:gen -- --targets //components/steering_wheel:elf
This will produce a compile_commands.json file in directory such as buck-out/v2/gen-bxl/root/7439b47151304f30/buck2/tools/comp_db.bxl/__gen__/fe0a63d85e25de4b/compile_commands.json
You probably want to symlink this into the root of the repo so that tools like clangd can find it. You can do this with a single command pretty easily like this:
ln -sf $(buck2 bxl buck2/tools/comp_db.bxl:gen -- --targets //components/steering_wheel:elf) $(git rev-parse --show-toplevel)
If you like, you can take this a step further by defining an alias for this in your shell (~/.bashrc, ~/.zshrc, etc.), for example:
compdb() {
local targets
targets=$1
local root
root=$(git rev-parse --show-toplevel)`
ln -sf $(buck2 bxl buck2/tools/comp_db.bxl:gen -- --targets "$1") "$root"
}Which you can them simply run directly as: compdb //components/steering_wheel:elf!
Relevant links: Implementation in buck2: facebook/buck2#810 Discussion around improving user experience around running BXLs: facebook/buck2#86