summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-03-23 17:53:24 +0100
committerxengineering <me@xengineering.eu>2025-03-26 21:18:17 +0100
commitb073db4017008ceb638a9c23c8cc93e60a3a7fdb (patch)
tree3359897450d1a0d187eb1fc2c47f36a6475691fd
parent6ebbc6cd9876744c09547bcb4ce2c39a89ce0f6c (diff)
downloadiot-contact-b073db4017008ceb638a9c23c8cc93e60a3a7fdb.tar
iot-contact-b073db4017008ceb638a9c23c8cc93e60a3a7fdb.tar.zst
iot-contact-b073db4017008ceb638a9c23c8cc93e60a3a7fdb.zip
fw: app: Move application firmware code here
This makes the structure of the `fw` folder more clear and separates application-related code from bootloader- or rtos-related code.
-rw-r--r--README.md2
-rw-r--r--fw/CMakeLists.txt37
-rw-r--r--fw/app/.gitignore (renamed from fw/.gitignore)0
-rw-r--r--fw/app/CMakeLists.txt41
-rw-r--r--fw/app/boards/nucleo_f767zi.conf (renamed from fw/boards/nucleo_f767zi.conf)0
-rw-r--r--fw/app/prj.conf (renamed from fw/prj.conf)0
-rw-r--r--fw/app/sections-rom.ld (renamed from fw/sections-rom.ld)0
-rw-r--r--fw/app/src/heart.c (renamed from fw/src/heart.c)0
-rw-r--r--fw/app/src/heart.h (renamed from fw/src/heart.h)0
-rw-r--r--fw/app/src/http.c (renamed from fw/src/http.c)0
-rw-r--r--fw/app/src/index.html (renamed from fw/src/index.html)0
-rw-r--r--fw/app/src/iot-contact.js (renamed from fw/src/iot-contact.js)0
-rw-r--r--fw/app/src/network.c (renamed from fw/src/network.c)0
-rw-r--r--fw/app/src/syslog.c (renamed from fw/src/syslog.c)0
-rw-r--r--fw/app/src/ws.c (renamed from fw/src/ws.c)0
-rw-r--r--fw/app/src/ws.h (renamed from fw/src/ws.h)0
16 files changed, 44 insertions, 36 deletions
diff --git a/README.md b/README.md
index c292eb5..6fd7c0f 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ With the firmware built and the network being prepared the simulated firmware
can be run.
```
-./build/fw/zephyr/zephyr.exe
+./build/fw/app/zephyr/zephyr.exe
```
To build the firmware in a clean `nucleo` build folder, flash it and open a
diff --git a/fw/CMakeLists.txt b/fw/CMakeLists.txt
index ce16b10..6f2ea60 100644
--- a/fw/CMakeLists.txt
+++ b/fw/CMakeLists.txt
@@ -11,6 +11,7 @@ set(ZEPHYR_MODULES
"${CMAKE_CURRENT_SOURCE_DIR}/rtos/modules/mbedtls"
"${CMAKE_CURRENT_SOURCE_DIR}/btl/mcuboot"
)
+set(ZEPHYR_BASE "${CMAKE_CURRENT_SOURCE_DIR}/rtos/zephyr")
string(REPLACE ";" "," ZEPHYR_MODULES_COMMA "${ZEPHYR_MODULES}")
include(ExternalProject)
@@ -28,38 +29,4 @@ ExternalProject_Add(
-DCONFIG_BOOT_SIGNATURE_KEY_FILE="${KEY}"
)
-find_package(Zephyr
- REQUIRED
- HINTS
- "${CMAKE_CURRENT_SOURCE_DIR}/rtos/zephyr"
-)
-
-project(iot-contact-fw)
-
-target_sources(app
- PRIVATE
- "${CMAKE_CURRENT_SOURCE_DIR}/src/syslog.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/network.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/http.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/ws.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/heart.c"
-)
-
-zephyr_linker_sources(SECTIONS sections-rom.ld)
-zephyr_linker_section(NAME http_resource_desc_http_service
- KVMA RAM_REGION GROUP RODATA_REGION
- SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
-
-generate_inc_file_for_target(
- app
- src/index.html
- ${ZEPHYR_BINARY_DIR}/include/generated/index.html.gz.inc
- --gzip
-)
-
-generate_inc_file_for_target(
- app
- src/iot-contact.js
- ${ZEPHYR_BINARY_DIR}/include/generated/iot-contact.js.gz.inc
- --gzip
-)
+add_subdirectory(app)
diff --git a/fw/.gitignore b/fw/app/.gitignore
index b6b51e9..b6b51e9 100644
--- a/fw/.gitignore
+++ b/fw/app/.gitignore
diff --git a/fw/app/CMakeLists.txt b/fw/app/CMakeLists.txt
new file mode 100644
index 0000000..ce10104
--- /dev/null
+++ b/fw/app/CMakeLists.txt
@@ -0,0 +1,41 @@
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+
+cmake_minimum_required(VERSION 3.20.0)
+
+find_package(Zephyr
+ REQUIRED
+ HINTS
+ "${ZEPHYR_BASE}"
+)
+
+project(iot-contact-fw)
+
+target_sources(app
+ PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/syslog.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/network.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/http.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/ws.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/heart.c"
+)
+
+zephyr_linker_sources(SECTIONS sections-rom.ld)
+zephyr_linker_section(NAME http_resource_desc_http_service
+ KVMA RAM_REGION GROUP RODATA_REGION
+ SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
+
+generate_inc_file_for_target(
+ app
+ src/index.html
+ ${ZEPHYR_BINARY_DIR}/include/generated/index.html.gz.inc
+ --gzip
+)
+
+generate_inc_file_for_target(
+ app
+ src/iot-contact.js
+ ${ZEPHYR_BINARY_DIR}/include/generated/iot-contact.js.gz.inc
+ --gzip
+)
diff --git a/fw/boards/nucleo_f767zi.conf b/fw/app/boards/nucleo_f767zi.conf
index 32e6d4a..32e6d4a 100644
--- a/fw/boards/nucleo_f767zi.conf
+++ b/fw/app/boards/nucleo_f767zi.conf
diff --git a/fw/prj.conf b/fw/app/prj.conf
index 11dc04f..11dc04f 100644
--- a/fw/prj.conf
+++ b/fw/app/prj.conf
diff --git a/fw/sections-rom.ld b/fw/app/sections-rom.ld
index c2f7bc4..c2f7bc4 100644
--- a/fw/sections-rom.ld
+++ b/fw/app/sections-rom.ld
diff --git a/fw/src/heart.c b/fw/app/src/heart.c
index 6bcced6..6bcced6 100644
--- a/fw/src/heart.c
+++ b/fw/app/src/heart.c
diff --git a/fw/src/heart.h b/fw/app/src/heart.h
index cd32c15..cd32c15 100644
--- a/fw/src/heart.h
+++ b/fw/app/src/heart.h
diff --git a/fw/src/http.c b/fw/app/src/http.c
index e206f86..e206f86 100644
--- a/fw/src/http.c
+++ b/fw/app/src/http.c
diff --git a/fw/src/index.html b/fw/app/src/index.html
index 5817818..5817818 100644
--- a/fw/src/index.html
+++ b/fw/app/src/index.html
diff --git a/fw/src/iot-contact.js b/fw/app/src/iot-contact.js
index e8e966f..e8e966f 100644
--- a/fw/src/iot-contact.js
+++ b/fw/app/src/iot-contact.js
diff --git a/fw/src/network.c b/fw/app/src/network.c
index 6e6eb17..6e6eb17 100644
--- a/fw/src/network.c
+++ b/fw/app/src/network.c
diff --git a/fw/src/syslog.c b/fw/app/src/syslog.c
index b1a1077..b1a1077 100644
--- a/fw/src/syslog.c
+++ b/fw/app/src/syslog.c
diff --git a/fw/src/ws.c b/fw/app/src/ws.c
index 6f68538..6f68538 100644
--- a/fw/src/ws.c
+++ b/fw/app/src/ws.c
diff --git a/fw/src/ws.h b/fw/app/src/ws.h
index 0c13039..0c13039 100644
--- a/fw/src/ws.h
+++ b/fw/app/src/ws.h