Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "external_libs/Catch2"]
path = external_libs/Catch2
[submodule "submodules/Catch2"]
path = submodules/Catch2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

url = https://github.com/catchorg/Catch2.git
46 changes: 41 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,45 @@ This contains all our firmware and embedded code. From both elec and software.

Some build code is committed, which will likely change soon. But we don't have a setup script for zephyr, and use teensy tools to flash our old arm, so by having build code, we don't need to install zephyr on all our computers.

### CONTRIBUTING

## Setup

### Clone the repository
```bash
git clone --recurse-submodules https://github.com/UBC-Snowbots/FirmFlake.git
```

### Install CMake

This is a tool used to run scripts (e.g. setup scripts).

#### Mac
```bash
brew install cmake
cd common_libs/
make build
```

#### Linux / WSL
```bash
sudo apt-get install cmake
cd common_libs/
make build
```

### Install Zephyr

Follow setup instructions [here](https://docs.zephyrproject.org/latest/develop/getting_started/index.html).

## Contributing
Currently, we protect main branch by PR approval and an automated test of our common libraries.
More automated tests will follow.


### ZephyrRTOS
## ZephyrRTOS
We have some zephyr rtos projects under zephyr_projects. To build/develop them you will need to install zephyr: https://docs.zephyrproject.org/latest/develop/getting_started/index.html

### Arduino
## Arduino
We have some arduino projects, under arduino_firmware.

### Common Libraries
Expand All @@ -22,7 +52,7 @@ We have an example here, that shows the general workflow for creating a common l

1. [Low pass FIR filter](common_libraries/low_pass_fir_filter/README.md)

### Testing
## Testing
We use Catch2 for testing cpp and c code. It's an easy to use, and easy to integrate tool for cpp unit tests.
Ideally, all our code has test coverage. Test driven development (TDD) is a powerful process where if done perfectly, you never push a bug that would impact system operations, because your tests would cover every needed operation of the system.

Expand All @@ -32,8 +62,14 @@ Catch2 docs are in it's readme: https://github.com/catchorg/Catch2?tab=readme-ov

A good book on TDD is Test Driven Development for Embedded Systems: https://pragprog.com/titles/jgade/test-driven-development-for-embedded-c/

For example, to test the common libraries, do:
```bash
cd common_libraries/
make test
```

### ROS2 Tests
We have some ros2 code in here, specifically for testing firmware. Might be moved to RoverFlake2 in the future.

### End Notes
## End Notes
The filestructure is currently based around development enviroments, we may change this to project based structure in the future.
2 changes: 1 addition & 1 deletion common_libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(common_lib_tests)
set(CMAKE_CXX_STANDARD 17) # cpp 2017 standard
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../external_libs/Catch2 ${CMAKE_CURRENT_BINARY_DIR}/external_libs/Catch2) # Include Catch2 for unit tests
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../submodules/Catch2 ${CMAKE_CURRENT_BINARY_DIR}/submodules/Catch2) # Include Catch2 for unit tests

set(BUILD_DIR ${CMAKE_CURRENT_LIST_DIR}/build)

Expand Down