diff --git a/.gitmodules b/.gitmodules index 66924ce..dd10f4c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "external_libs/Catch2"] - path = external_libs/Catch2 +[submodule "submodules/Catch2"] + path = submodules/Catch2 url = https://github.com/catchorg/Catch2.git diff --git a/README.md b/README.md index 11cf3e7..4b71c4a 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. @@ -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. \ No newline at end of file diff --git a/common_libraries/CMakeLists.txt b/common_libraries/CMakeLists.txt index 121efbe..0edec9f 100644 --- a/common_libraries/CMakeLists.txt +++ b/common_libraries/CMakeLists.txt @@ -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) diff --git a/external_libs/Catch2 b/submodules/Catch2 similarity index 100% rename from external_libs/Catch2 rename to submodules/Catch2