summaryrefslogtreecommitdiff
path: root/fw/app
diff options
context:
space:
mode:
Diffstat (limited to 'fw/app')
-rw-r--r--fw/app/Kconfig4
-rw-r--r--fw/app/meson.build45
-rw-r--r--fw/app/src/syslog.c8
3 files changed, 57 insertions, 0 deletions
diff --git a/fw/app/Kconfig b/fw/app/Kconfig
index 5393e05..3481340 100644
--- a/fw/app/Kconfig
+++ b/fw/app/Kconfig
@@ -2,4 +2,8 @@ config IOT_CONTACT_REMOTE_UPDATE
bool "Enable the remote update system"
default n
+config IOT_CONTACT_NETWORK_HACK
+ bool "Reboots after a fixed timeout if network connection cannot be established"
+ default n
+
source "Kconfig.zephyr"
diff --git a/fw/app/meson.build b/fw/app/meson.build
new file mode 100644
index 0000000..8d84209
--- /dev/null
+++ b/fw/app/meson.build
@@ -0,0 +1,45 @@
+external_project = import('unstable-external_project')
+
+application_source = meson.current_source_dir()
+
+external_project.add_project(
+ configure_zephyr,
+ configure_options: [
+ '--source-tree', application_source,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--board', board,
+ '--zephyr-base', zephyr,
+ '--zephyr-modules', ';'.join(zephyr_modules),
+ ],
+ verbose: true,
+)
+
+application = custom_target(
+ 'application',
+ output: ['application.bin'],
+ command: [
+ build_zephyr,
+ '--build-tree', meson.current_build_dir() / 'build',
+ '--binary-name', 'zephyr.bin',
+ '--target-name', 'application.bin',
+ ],
+)
+
+application_signed = custom_target(
+ 'application_signed',
+ output: ['application.signed.bin'],
+ command: [
+ imgtool,
+ 'sign',
+ '--version', '0.0.0',
+ '--header-size', '0x200',
+ '--slot-size', '0xc0000',
+ '--key', signing_key,
+ meson.current_build_dir() / 'application.bin',
+ meson.current_build_dir() / 'application.signed.bin',
+ ],
+ build_by_default: true,
+ depends: application,
+ install: true,
+ install_dir: '/',
+)
diff --git a/fw/app/src/syslog.c b/fw/app/src/syslog.c
index edc2839..e19a196 100644
--- a/fw/app/src/syslog.c
+++ b/fw/app/src/syslog.c
@@ -14,7 +14,10 @@
#include <zephyr/logging/log_ctrl.h>
#include <zephyr/logging/log_core.h>
#include <zephyr/net/conn_mgr_connectivity.h>
+
+#ifdef CONFIG_IOT_CONTACT_NETWORK_HACK
#include <zephyr/sys/reboot.h>
+#endif // CONFIG_IOT_CONTACT_NETWORK_HACK
LOG_MODULE_REGISTER(syslog);
@@ -58,12 +61,17 @@ int init_syslog(void)
LOG_DBG("Initializing syslog logging backend");
LOG_INF("Waiting for network ...");
+
+#ifdef CONFIG_IOT_CONTACT_NETWORK_HACK
int ret = k_sem_take(&network_connected, NETWORK_BUG_DELAY);
if (ret == -EAGAIN) {
LOG_ERR("Could not connect to network - rebooting system");
log_flush();
sys_reboot(SYS_REBOOT_COLD);
}
+#else
+ k_sem_take(&network_connected, K_FOREVER);
+#endif // CONFIG_IOT_CONTACT_NETWORK_HACK
LOG_INF("Enabling syslog backend");
const struct log_backend *backend = log_backend_net_get();