diff options
author | xengineering <me@xengineering.eu> | 2025-02-14 08:37:08 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2025-02-14 09:03:18 +0100 |
commit | 298cb131149f583ab986ee69901765c3dbcce674 (patch) | |
tree | 83e93b0429b8d6d5919fe049fc9262db9735ed74 | |
parent | ee9106047c2128e8be07e754157c71c92a77a442 (diff) | |
download | iot-contact-298cb131149f583ab986ee69901765c3dbcce674.tar iot-contact-298cb131149f583ab986ee69901765c3dbcce674.tar.zst iot-contact-298cb131149f583ab986ee69901765c3dbcce674.zip |
Switch to a global CMake build
This allows to easily build everything from the repository root. For now
this only covers firmware but later electrical PCB and mechanical case
files can be added.
-rw-r--r-- | .gitignore (renamed from fw/.gitignore) | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | README.md | 27 | ||||
l--------- | compile_commands.json | 2 | ||||
-rw-r--r-- | fw/CMakeLists.txt | 4 | ||||
-rw-r--r-- | fw/README.md | 25 |
6 files changed, 36 insertions, 29 deletions
diff --git a/fw/.gitignore b/.gitignore index 06f39a9..60fd437 100644 --- a/fw/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -build .cache +build log.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7d5602c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.10) + +project(iot-contact LANGUAGES NONE) + +add_subdirectory(fw) @@ -2,4 +2,31 @@ iot-contact is an IoT device to check if doors and windows are closed or open. +## Usage + +The content of this repository can be build with CMake and Ninja. + +``` +cmake -Bbuild -GNinja +ninja -C build +``` + +The resulting firmware can be flashed via an ST-LINK debugger / programmer. + +``` +st-flash --connect-under-reset write build/fw/zephyr/zephyr.bin 0x8000000 +``` + +UART shell output can be retrieved with `picocom`. + +``` +picocom -b 115200 /dev/ttyACM0 +``` + +Finally the firmware can be erased from the device with the ST-LINK. + +``` +st-flash --connect-under-reset erase +``` + [1]: https://docs.kicad.org/ diff --git a/compile_commands.json b/compile_commands.json index c87e7db..25eb4b2 120000 --- a/compile_commands.json +++ b/compile_commands.json @@ -1 +1 @@ -fw/build/compile_commands.json
\ No newline at end of file +build/compile_commands.json
\ No newline at end of file diff --git a/fw/CMakeLists.txt b/fw/CMakeLists.txt index 5cd52ce..000039e 100644 --- a/fw/CMakeLists.txt +++ b/fw/CMakeLists.txt @@ -15,9 +15,9 @@ find_package(Zephyr "${CMAKE_CURRENT_SOURCE_DIR}/zephyrproject/zephyr" ) -project(iot-contact) +project(iot-contact-fw) target_sources(app PRIVATE - src/main.c + "${CMAKE_CURRENT_SOURCE_DIR}/src/main.c" ) diff --git a/fw/README.md b/fw/README.md index 8287fab..9883b2d 100644 --- a/fw/README.md +++ b/fw/README.md @@ -3,29 +3,4 @@ This is the firmware for iot-contact. It is based on the Zephyr real time operating system [1]. -## Build - -``` -cmake -Bbuild -GNinja -ninja -C build -``` - -## Flash - -``` -st-flash --connect-under-reset write build/zephyr/zephyr.bin 0x8000000 -``` - -## Get shell output - -``` -picocom -b 115200 /dev/ttyACM0 -``` - -## Remove firmware from device - -``` -st-flash --connect-under-reset erase -``` - [1]: https://zephyrproject.org |