summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md11
-rw-r--r--fw/app/CMakeLists.txt7
-rw-r--r--fw/app/boards/nucleo_f767zi.conf1
-rw-r--r--fw/app/meson.build16
-rw-r--r--fw/app/src/http.c16
-rw-r--r--fw/app/src/index.html17
l---------fw/app/src/simple.css1
-rw-r--r--fw/btl/meson.build16
-rw-r--r--fw/meson.build11
-rw-r--r--fw/sim/meson.build2
-rw-r--r--meson.build9
-rw-r--r--pcb/meson.build4
-rwxr-xr-xtools/deploy.py58
-rw-r--r--web/hugo.toml2
-rw-r--r--web/index.html27
-rw-r--r--web/layouts/baseof.html12
-rw-r--r--web/layouts/home.html13
-rw-r--r--web/meson.build24
18 files changed, 182 insertions, 65 deletions
diff --git a/README.md b/README.md
index 0c5bde3..3d81e83 100644
--- a/README.md
+++ b/README.md
@@ -24,19 +24,20 @@ mkdir ~/mcuboot
The project is built with the Meson build system.
```
-meson setup build --prefix /
-ninja -C build
-meson install -C build --destdir artifacts
+meson setup build
+cd build
+ninja
+meson install --destdir artifacts
```
The resulting artifacts can be listed with `tree`.
```
-tree build/artifacts
+tree artifacts
```
These artifacts are organized as static website. It can be opened with Firefox.
```
-find build/artifacts -name 'index.html' -exec firefox {} \;
+firefox artifacts/index.html
```
diff --git a/fw/app/CMakeLists.txt b/fw/app/CMakeLists.txt
index 1a9d1cf..1a63b77 100644
--- a/fw/app/CMakeLists.txt
+++ b/fw/app/CMakeLists.txt
@@ -42,6 +42,13 @@ generate_inc_file_for_target(
generate_inc_file_for_target(
app
+ src/simple.css
+ ${ZEPHYR_BINARY_DIR}/include/generated/simple.css.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/app/boards/nucleo_f767zi.conf b/fw/app/boards/nucleo_f767zi.conf
index 7f92421..ca69a03 100644
--- a/fw/app/boards/nucleo_f767zi.conf
+++ b/fw/app/boards/nucleo_f767zi.conf
@@ -3,6 +3,7 @@
# obtain one at https://mozilla.org/MPL/2.0/.
CONFIG_IOT_CONTACT_REMOTE_UPDATE=y
+CONFIG_IOT_CONTACT_NETWORK_HACK=y
CONFIG_BOOTLOADER_MCUBOOT=y
diff --git a/fw/app/meson.build b/fw/app/meson.build
index 97c17f1..ddd5aa6 100644
--- a/fw/app/meson.build
+++ b/fw/app/meson.build
@@ -41,5 +41,19 @@ application_signed = custom_target(
build_by_default: true,
depends: application,
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
+)
+
+flash_application = custom_target(
+ build_always_stale: true,
+ build_by_default: false,
+ command: [
+ 'st-flash',
+ '--connect-under-reset',
+ 'write',
+ meson.current_build_dir() / 'application.signed.bin',
+ '0x8040000',
+ ],
+ depends: application_signed,
+ output: ['flash'],
)
diff --git a/fw/app/src/http.c b/fw/app/src/http.c
index e206f86..08b59c1 100644
--- a/fw/app/src/http.c
+++ b/fw/app/src/http.c
@@ -34,6 +34,21 @@ struct http_resource_detail_static index_resource_detail = {
.static_data_len = sizeof(index_html_gz),
};
+static const uint8_t css_gz[] = {
+ #include "simple.css.gz.inc"
+};
+
+struct http_resource_detail_static css_resource_detail = {
+ .common = {
+ .type = HTTP_RESOURCE_TYPE_STATIC,
+ .bitmask_of_supported_http_methods = BIT(HTTP_GET),
+ .content_encoding = "gzip",
+ .content_type = "text/css",
+ },
+ .static_data = css_gz,
+ .static_data_len = sizeof(css_gz),
+};
+
static const uint8_t js_html_gz[] = {
#include "iot-contact.js.gz.inc"
};
@@ -95,6 +110,7 @@ HTTP_SERVICE_DEFINE(http_service, NULL, &http_port, 1, 10, NULL, NULL);
HTTP_RESOURCE_DEFINE(index_resource, http_service, "/", &index_resource_detail);
HTTP_RESOURCE_DEFINE(websocket_resource, http_service, "/", &websocket_resource_detail);
HTTP_RESOURCE_DEFINE(favicon_resource, http_service, "/favicon.ico", &favicon_resource_detail);
+HTTP_RESOURCE_DEFINE(css_resource, http_service, "/simple.css", &css_resource_detail);
HTTP_RESOURCE_DEFINE(js_resource, http_service, "/iot-contact.js", &js_resource_detail);
int init_http_server(void) {
diff --git a/fw/app/src/index.html b/fw/app/src/index.html
index 5817818..d4ccd45 100644
--- a/fw/app/src/index.html
+++ b/fw/app/src/index.html
@@ -8,14 +8,19 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <title>iot-contact</title>
+ <title>IoT contact</title>
+ <link rel="stylesheet" type="text/css" href="simple.css">
<script type="text/javascript" src="/iot-contact.js"></script>
</head>
<body>
- <h4>iot-contact</h4>
- <p>
- <label for="heartbeat">Heartbeat</label>
- <meter id="heartbeat" min="0" max="1" value="0"></meter>
- </p>
+ <header>
+ <h1>IoT contact</h1>
+ </header>
+ <main>
+ <p class="notice">
+ <label for="heartbeat">Heartbeat</label>
+ <meter id="heartbeat" min="0" max="1" value="0"></meter>
+ </p>
+ </main>
</body>
</html>
diff --git a/fw/app/src/simple.css b/fw/app/src/simple.css
new file mode 120000
index 0000000..5483eb1
--- /dev/null
+++ b/fw/app/src/simple.css
@@ -0,0 +1 @@
+../../../simple.css/simple.css \ No newline at end of file
diff --git a/fw/btl/meson.build b/fw/btl/meson.build
index 4d80a58..8ca1eb3 100644
--- a/fw/btl/meson.build
+++ b/fw/btl/meson.build
@@ -24,5 +24,19 @@ bootloader = custom_target('bootloader',
],
build_by_default: true,
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
+)
+
+flash_bootloader = custom_target(
+ build_always_stale: true,
+ build_by_default: false,
+ command: [
+ 'st-flash',
+ '--connect-under-reset',
+ 'write',
+ meson.current_build_dir() / 'bootloader.bin',
+ '0x8000000',
+ ],
+ depends: bootloader,
+ output: ['flash'],
)
diff --git a/fw/meson.build b/fw/meson.build
index 8194827..f61058c 100644
--- a/fw/meson.build
+++ b/fw/meson.build
@@ -7,3 +7,14 @@ subdir('rtos')
subdir('app')
subdir('btl')
subdir('sim')
+
+erase = custom_target(
+ build_always_stale: true,
+ build_by_default: false,
+ command: [
+ 'st-flash',
+ '--connect-under-reset',
+ 'erase',
+ ],
+ output: ['erase'],
+)
diff --git a/fw/sim/meson.build b/fw/sim/meson.build
index a4dcb8a..7667f9b 100644
--- a/fw/sim/meson.build
+++ b/fw/sim/meson.build
@@ -23,5 +23,5 @@ simulation = custom_target(
],
build_by_default: true,
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
)
diff --git a/meson.build b/meson.build
index 85faf87..eb7f9ad 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,9 @@
-project('iot-contact')
+project(
+ 'iot-contact',
+ default_options: {
+ 'prefix': '/',
+ },
+)
subdir('tools')
@@ -7,7 +12,7 @@ css = fs.copyfile(
meson.current_source_dir() / 'simple.css' / 'simple.css',
'simple.css',
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
)
subdir('fw')
diff --git a/pcb/meson.build b/pcb/meson.build
index 7f8b85f..f320aae 100644
--- a/pcb/meson.build
+++ b/pcb/meson.build
@@ -20,7 +20,7 @@ schematic = custom_target('schematic',
depend_files: schematic_files,
build_by_default: true,
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
)
bom = custom_target('bom',
@@ -38,5 +38,5 @@ bom = custom_target('bom',
depend_files: schematic_files,
build_by_default: true,
install: true,
- install_dir: 'website/static',
+ install_dir: '/',
)
diff --git a/tools/deploy.py b/tools/deploy.py
new file mode 100755
index 0000000..26048e8
--- /dev/null
+++ b/tools/deploy.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+
+
+import argparse
+import subprocess
+import pathlib
+
+
+SCRIPT = pathlib.Path(__file__)
+SOURCE_ROOT = SCRIPT.parent.parent.resolve()
+ARTIFACTS_DEFAULT = SOURCE_ROOT / "build" / "artifacts"
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(
+ description="Use OpenSSH and rsync to deploy artifacts",
+ )
+
+ parser.add_argument(
+ "-a",
+ "--artifacts",
+ default=ARTIFACTS_DEFAULT,
+ help="local path to artifacts folder",
+ )
+ parser.add_argument(
+ "-H", "--host", default="cloud", help="target `Host` name from ~/.ssh/config"
+ )
+ parser.add_argument(
+ "-p",
+ "--path",
+ default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/",
+ help="remote path to destination folder on server",
+ )
+ parser.add_argument(
+ "-d",
+ "--dry-run",
+ action="store_true",
+ help="do not execute command and instead print it",
+ )
+
+ args = parser.parse_args()
+
+ command = [
+ "rsync",
+ "-av",
+ "--delete",
+ f"{str(pathlib.Path(args.artifacts).resolve())}/",
+ f"{args.host}:{args.path}",
+ ]
+
+ if args.dry_run:
+ print(command)
+ else:
+ subprocess.run(command, shell=False, check=True)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/web/hugo.toml b/web/hugo.toml
deleted file mode 100644
index 493ec29..0000000
--- a/web/hugo.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-title = 'IoT contact'
-disableKinds = ["taxonomy", "RSS", "sitemap"]
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 0000000..1f23096
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" type="text/css" href="simple.css">
+ <title>IoT contact</title>
+ </head>
+ <body>
+ <main>
+ <h1>IoT contact</h1>
+
+ <h4>Printed circuit board</h4>
+ <ul>
+ <li><a href="schematic.pdf">schematic.pdf</a></li>
+ <li><a href="bill-of-materials.csv">bill-of-materials.csv</a></li>
+ </ul>
+
+ <h4>Firmware</h4>
+ <ul>
+ <li><a href="application.signed.bin">application.signed.bin</a></li>
+ <li><a href="bootloader.bin">bootloader.bin</a></li>
+ <li><a href="simulation-linux-amd64.exe">simulation-linux-amd64.exe</a></li>
+ </ul>
+ </main>
+ </body>
+</html>
diff --git a/web/layouts/baseof.html b/web/layouts/baseof.html
deleted file mode 100644
index 96d8e07..0000000
--- a/web/layouts/baseof.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" href="static/simple.css">
- <title>{{ .Site.Title }}</title>
- </head>
- <body>
- {{ block "main" . }}{{end}}
- </body>
-</html>
diff --git a/web/layouts/home.html b/web/layouts/home.html
deleted file mode 100644
index 3bf37d9..0000000
--- a/web/layouts/home.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{{- define "main" -}}
-<h1>{{ .Site.Title }}</h1>
-<ul>
- <h4>Printed circuit board</h4>
- <li><a href="static/schematic.pdf">schematic.pdf</a></li>
- <li><a href="static/bill-of-materials.csv">bill-of-materials.csv</a></li>
-
- <h4>Firmware</h4>
- <li><a href="static/application.signed.bin">application.signed.bin</a></li>
- <li><a href="static/bootloader.bin">bootloader.bin</a></li>
- <li><a href="static/simulation-linux-amd64.exe">simulation-linux-amd64.exe</a></li>
-</ul>
-{{- end -}}
diff --git a/web/meson.build b/web/meson.build
index da45440..f8c2024 100644
--- a/web/meson.build
+++ b/web/meson.build
@@ -1,22 +1,6 @@
-website = custom_target('website',
- output: ['index.html'],
- command: [
- 'hugo',
- '--source', meson.current_source_dir(),
- '--destination', meson.current_build_dir(),
- ],
- depend_files: [
- 'hugo.toml',
- 'layouts/baseof.html',
- 'layouts/home.html',
- ],
- depends: [
- schematic,
- bom,
- application,
- bootloader,
- ],
- build_by_default: true,
+website = fs.copyfile(
+ meson.current_source_dir() / 'index.html',
+ 'index.html',
install: true,
- install_dir: 'website',
+ install_dir: '/',
)