{"id":21590939,"url":"https://github.com/spaceteam/sts1_cobc_sw","last_synced_at":"2025-07-15T03:41:35.881Z","repository":{"id":59400643,"uuid":"520184648","full_name":"SpaceTeam/STS1_COBC_SW","owner":"SpaceTeam","description":"Software for the communication and onboard computer (COBC) of SpaceTeamSat1 (STS1)","archived":false,"fork":false,"pushed_at":"2025-07-12T18:21:31.000Z","size":2322,"stargazers_count":12,"open_issues_count":35,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T20:36:47.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpaceTeam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-01T16:30:27.000Z","updated_at":"2025-07-12T18:20:00.000Z","dependencies_parsed_at":"2023-02-09T22:45:59.890Z","dependency_job_id":"4e6731ad-8b2f-4b27-80b6-a2302d8708fb","html_url":"https://github.com/SpaceTeam/STS1_COBC_SW","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SpaceTeam/STS1_COBC_SW","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaceTeam%2FSTS1_COBC_SW","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaceTeam%2FSTS1_COBC_SW/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaceTeam%2FSTS1_COBC_SW/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaceTeam%2FSTS1_COBC_SW/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpaceTeam","download_url":"https://codeload.github.com/SpaceTeam/STS1_COBC_SW/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaceTeam%2FSTS1_COBC_SW/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265398427,"owners_count":23758474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T16:21:06.696Z","updated_at":"2025-07-15T03:41:35.871Z","avatar_url":"https://github.com/SpaceTeam.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STS1 COBC SW\n\nThis project contains the software for the communication and onboard computer (COBC) of\nSpaceTeamSat1 (STS1).\n\n## Contents\n\n- [Building and developing](#building-and-developing)\n- [Project layout](#project-layout)\n- [Contributing](#contributing)\n- [Licensing](#licensing)\n\n\n## Building and developing\n\nThe recommended way to develop and build this project is to use the Docker image\n[tuwienspaceteam/sts1-cobc](https://hub.docker.com/r/tuwienspaceteam/sts1-cobc) as a dev\ncontainer. It is specifically built for that purpose, i.e., it comes with all required\ncompilers, libraries and tools. This makes it easier to get started but also ensures\nreliable and consistent builds. See [this\npage](https://wiki.tust.at/books/spaceteamsat1-sts1/page/setup-compilers-and-tools) on our\ninternal wiki for more information.\n\nIf you don't want to use Docker, it is still best to check out the Dockerfiles\n([here](https://github.com/SpaceTeam/STS1_COBC_Docker/blob/master/linux-x86/Dockerfile)\nand [here](https://github.com/SpaceTeam/STS1_COBC_Docker/blob/master/full/Dockerfile)) to\nsee how to properly install everything.\n\n\n### Presets\n\nThis project makes use of [CMake\npresets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) to simplify the\nprocess of configuring the project.\n\nAs a developer, you should create a `CMakeUserPresets.json` file at the root of the\nproject. If you use the Docker image,\n[`CMakeDeveloperPresets.json`](CMakeDeveloperPresets.json) already contains a convenient\nset of configure and build presets for you. Just include it in your user preset file as\nshown in the following example.\n\n\u003cdetails\u003e\n  \u003csummary\u003eCMakeUserPresets.json\u003c/summary\u003e\n\n  ~~~json\n  {\n    \"version\": 4,\n    \"cmakeMinimumRequired\": {\n      \"major\": 3,\n      \"minor\": 23,\n      \"patch\": 0\n    },\n    \"include\": [\n      \"CMakeDeveloperPresets.json\"\n    ]\n  }\n  ~~~\n\n\u003c/details\u003e\n\nThe paths to the toolchain files depend on your setup. If you don't use Docker you mostly\nlikely have to change them. In general, `CMakeUserPresets.json` is the perfect place in\nwhich you can put all sorts of things that depend on your personal setup or preference,\nand that you would otherwise want to pass to the CMake command in the terminal.\n\n\n### Include What You Use\n\nTo ensure that source files include only the header files they need, we use [Include What\nYou Use (IWYU)](https://github.com/include-what-you-use/include-what-you-use), a tool\nbuilt on top of Clang. IWYU supports a [mapping\nfile](https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md)\nfor more precise configuration, allowing us to make sure it works the way we want it to.\nIn particular, this means that we have to do the following additional steps when adding a\nheader (`.hpp`) or inline implementation (`.ipp`) file:\n\n- Add a line to the mappings file to ensure that the header file gets included with angle\n  brackets instead of quotes. Unfortunately, this still doesn't stop IWYU from sometimes\n  suggesting our includes with quotes. I don't know why that is.\n\n  ~~~\n  { include: [\"\\\"Sts1CobcSw/Hal/Spi.hpp\\\"\", \"public\", \"\u003cSts1CobcSw/Hal/Spi.hpp\u003e\", \"public\"] },\n  ~~~\n\n- Add a line to the mappings file to ensure that the `.ipp` file is mapped to the\n  corresponding `.hpp` file. This ensures that only the `.hpp` file gets included.\n\n  ~~~\n  { include: [\"\\\"Sts1CobcSw/Hal/Spi.ipp\\\"\", \"private\", \"\u003cSts1CobcSw/Hal/Spi.hpp\u003e\", \"public\"] },\n  ~~~\n\n- Add a pragma when including the corresponding `.ipp` file in the `.hpp` file:\n\n  ~~~\n  #include \u003cSts1CobcSw/Hal/Spi.ipp\u003e  // IWYU pragma: keep\n  ~~~\n\nThe complete mapping file is called `iwyu.imp` and is located in the top-level directory.\n\n\n### Configure, build and test\n\nThe following instructions assume that you added the above `CMakeUserPresets.json` and\nthat the commands are executed from within the Docker container. This is easy with VS Code\nsince it allows directly [developing inside a\ncontainer](https://code.visualstudio.com/docs/devcontainers/containers). If you don't use\nVS Code you must execute all commands via `docker run`. In this case it is convenient to\nuse an alias like the following:\n\n~~~shell\n# Version 1: always mounts the STS1_COBC_SW folder\nalias dr-sts1=\"docker run -it -v /path/to/STS1_COBC_SW:/project -w='/project' tuwienspaceteam/sts1-cobc:0.7.0\"\n\n# Version 2: mounts the current working directory. This means that you must be in the\n# top-level directory of the COBC SW repo when executing the build commands.\nalias dr-sts1=\"docker run -it -v $(pwd):/project -w='/project' tuwienspaceteam/sts1-cobc:0.7.0\"\n~~~\n\nYou can configure, build and test the `linux-x86` parts of the project with the following\ncommands:\n\n~~~shell\ncmake --preset=dev-linux-x86\ncmake --build --preset=dev-linux-x86-debug\ncmake --build --preset=dev-linux-x86-debug -t AllTests\nctest --test-dir build/dev-linux-x86/Tests -C Debug\n~~~\n\nTo cross-compile for the COBC run\n\n~~~shell\ncmake --preset=dev-cobc\ncmake --build --preset=dev-cobc-debug\n~~~\n\nIf you want to build a specific target, e.g., the hardware test for the FRAM you must\nexecute\n\n~~~shell\ncmake --prest=dev-cobc\ncmake --build --preset=dev-cobc-debug -t Sts1CobcSwTests_Fram\n~~~\n\nThere are also build presets for non-debug builds. On Linux there is\n`dev-linux-x86-release`, and for the COBC we have `dev-cobc-min-size-rel`.\n\n\n## Project layout\n\nThe following ideas are mainly stolen from [P1204R0 – Canonical Project\nStructure](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1204r0.html).\n\n- \"All\" file and folder names uses UpperCamelCase (unfortunately cmake-init uses different\n  cases, so this is a lot to change and `docs/` or `cmake/` might stay in the wrong case\n  for a while).\n- Top level directory is project name in UpperCamelCase or GitHub repo name (unfortunately\n  we use a different naming convention with SHOUTING_CASE on GitHub).\n- Source code is in subdirectory named after the project (no GitHub name this time and no\n  `Source` or `Include` folders).\n- The project namespace is called `sts1cobcsw`.\n- Only the top level directory is added to the include path so that all includes must\n  spell out the directory structure, e.g., `#include \u003cSts1CobcSw/Hal/IoNames.hpp\u003e`.\n- Also, all includes, even the \"project local\" ones use `\u003c\u003e` instead of `\"\"`.\n- Subfolders for the source code should comprise somewhat standalone \"components\".\n- There should be a STATIC or INTERFACE library target for each component (this should\n  make linking source code dependencies for tests easier).\n- Each subfolder should have its own `CMakeLists.txt`\n- Rodos already provides some kind of hardware abstraction. `Hal/` should therefore\n  provide type-safe and more specifically named C++ wrappers for this low-level Rodos\n  stuff.\n- `Periphery/` should contain abstractions for the external periphery the COBC\n  communicates with, like sensors or memory chips. The EDU also kind of fits here.\n- All CMake targets are prefixed with the project name: `Sts1CobcSw_Firmware`,\n  `Sts1CobcSw_Hal`, etc.\n- Everything test related is in `Tests/` and its subdirectories.\n- Tests have the `.test.cpp` extension (no `_Test` suffix or `Test_` prefix, etc.) and are\n  named after the class, file, functionality, interface or whatever else they test.\n- Hardware tests should be similar to unit tests and check simple functionalities of\n  low-level code. They should also be somewhat automatable with the help of the whole\n  FlatSat setup (UCI UART, LabJack, etc.)\n- Golden Tests are used for high level integration/system tests. We should be able to run\n  them on the FlatSat too, because `PRINTF()` prints to the UCI UART which is connected to\n  the PC.\n\nThe following shows what the directory structure could actually look like.\n\n\u003cdetails\u003e\n  \u003csummary\u003eDirectory structure\u003c/summary\u003e\n\n  ~~~\n  Sts1CobcSw/\n  ├── .github/\n  ├── CMake/\n  ├── Docs/\n  ├── Sts1CobcSw/\n  │   ├── Hal/\n  │   │   ├── PinNames.hpp\n  │   │   ├── IoNames.hpp\n  │   │   ├── Usart.cpp\n  │   │   ├── Usart.hpp\n  │   │   ├── Spi.cpp\n  │   │   ├── Spi.hpp\n  │   │   ├── Communication.hpp   (maybe just this instead?)\n  │   │   └── ...\n  │   │\n  │   ├── Periphery/\n  │   │   ├── Edu.cpp\n  │   │   ├── Edu.hpp\n  │   │   ├── W25q01jvzeiq.cpp  (Name of the flash chip)\n  │   │   ├── W25q01jvzeiq.hpp\n  │   │   ├── AnotherChipName.cpp\n  │   │   ├── AnotherChipName.hpp\n  │   │   └── ...\n  │   │\n  │   ├── ShouldThisEvenBeInASubfolder/\n  │   │   ├── TelemetryMemory.cpp\n  │   │   ├── TelemetryMemory.hpp\n  │   │   ├── CobcFileSystem.cpp\n  │   │   ├── CobcFileSystem.hpp\n  │   │   ├── PersistantState.cpp\n  │   │   ├── PersistantState.hpp\n  │   │   └── ...\n  │   │\n  │   ├── AntennaDeploymentThread.cpp\n  │   ├── AntennaDeploymentThread.hpp\n  │   ├── SensorThread.cpp\n  │   ├── SensorThread.hpp\n  │   ├── CommandParser.cpp\n  │   ├── CommandParser.hpp\n  |   └── ...\n  │\n  ├── Tests/\n  |   ├── GoldenTests/\n  │   │   ├── ExpectedOutputs/\n  │   │   ├── Scripts/\n  │   │   ├── ICantThingOfAGoodName.test.cpp\n  │   │   └── ...\n  │   ├── HardwareTests/\n  │   │   ├── GpioPins.test.cpp\n  │   │   ├── Usart.test.cpp\n  │   │   ├── W25q01jvzeiq.test.cpp\n  │   │   └── ...\n  │   ├── UnitTests/\n  │   │   ├── CommandParser.test.cpp\n  │   │   └── ...\n  │   └── ...\n  │\n  ├── .clang-format\n  ├── .gitignore\n  ├── CMakeLists.txt\n  ├── CMakePresets.json\n  ├── LICENSE\n  ├── README.md\n  └── ...\n  ~~~\n\n\u003c/details\u003e\n\n\n## Contributing\n\nOnly contributions from members of the TU Wien Space Team are accepted.\n\n\n## Licensing and attribution\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) document for\nthe full text.\n\nWe do use some code from other projects, though, so here is a list with licensing and\nattribution information for those parts.\n\n- The files in `Sts1CobcSw/Blake2s/External/` were copied from\n  [arduinolibs](https://github.com/rweather/arduinolibs/) which is also MIT licensed\n- The lookup tables for our bit-scrambling code in\n  [`Sts1CobcSw/ChannelCoding/Scrambler.cpp`](./Sts1CobcSw/ChannelCoding/Scrambler.cpp)\n  were taken from [bitsnarl](https://github.com/Tagussan/bitsnarl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaceteam%2Fsts1_cobc_sw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspaceteam%2Fsts1_cobc_sw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaceteam%2Fsts1_cobc_sw/lists"}