Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
build
Makefile.private
libbeat/beatstack.h
libbeat/beatstack.h
libbeat/
bootloader/
libota/
30 changes: 27 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

PROJECT_NAME ?= mistexample

VERSION_MAJOR ?= 1
VERSION_MAJOR ?= 2
VERSION_MINOR ?= 0
VERSION_PATCH ?= 0
VERSION_DEVEL ?= "-dev"
Expand All @@ -14,7 +14,7 @@ CONFIG ?= normal
$(info CONFIG=$(CONFIG))
include config/$(CONFIG).mk

DEFAULT_RADIO_CHANNEL ?= 13
DEFAULT_RADIO_CHANNEL ?= 12

# Set device address at compile time, will override signature when != 0
NODE_AM_ADDR ?= 0
Expand All @@ -26,6 +26,8 @@ INCLUDE_BOOTLOADER ?= 0
# Specify beatstack config, single-hop if not set
LIBBEAT_CONFIG ?= ""

LIBOTA_CONFIG = 0

#app start
#if bootloader is included APP_START value is retrived from .board file
#with current bootloader APP_START should be 0x20000
Expand Down Expand Up @@ -206,7 +208,9 @@ INCLUDES += -I$(NODE_PLATFORM_DIR)/widgets
SOURCES += $(NODE_PLATFORM_DIR)/widgets/basic_rtos_filesystem_setup.c
SOURCES += $(NODE_PLATFORM_DIR)/widgets/basic_rtos_logger_setup.c
SOURCES += $(NODE_PLATFORM_DIR)/widgets/basic_rtos_threads_stats.c

ifneq ($(LIBOTA_CONFIG),"")
SOURCES += $(NODE_PLATFORM_DIR)/widgets/basic_rtos_ota_setup.c
endif
# device signature
INCLUDES += -I$(ZOO)/thinnect.device-signature/signature \
-I$(ZOO)/thinnect.device-signature/area
Expand Down Expand Up @@ -273,6 +277,26 @@ SOURCES += $(NODE_PLATFORM_DIR)/silabs/watchdog.c
INCLUDES += -I$(ROOT_DIR)/libmist/
LDLIBS += $(ROOT_DIR)/libmist/$(MCU_FAMILY)/libmistmiddleware.a

#libota
ifneq ($(LIBOTA_CONFIG),"")
ifneq ("$(wildcard libota/updater.h)","")
$(info libota found and included)
ifeq ("$(INCLUDE_BOOTLOADER)", "1")
INCLUDES += -I$(ROOT_DIR)/libota/
LDLIBS += $(ROOT_DIR)/libota/$(MCU_FAMILY)/libota.a
CFLAGS += -DINCLUDE_OTA
else
ifneq ($(MAKECMDGOALS),clean)
$(error "ERROR: ota enabled and included but bootloader missing")
endif
endif
else
ifneq ($(MAKECMDGOALS),clean)
$(error "ERROR: libota enabled but not found")
endif
endif
endif

#beatsack
ifneq ($(LIBBEAT_CONFIG),"")
ifneq ("$(wildcard libbeat/$(LIBBEAT_CONFIG)/beatstack.h)","")
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ Makefile (or Makefile.private) or set on the command line:
make <PLAFTORM_NAME> INCLUDE_BEATSTACK=1
```

# Thinnect OTA (libota)

The example application can be optionally built with the Thinnect mesh update
layer. The library needs to be obtained separately. The library bundle should
include a header `updater.h` and the static library `libota.a` for a given
architecture. These need to be stored as:
```
$(WORKSPACE_ROOT)/libota/updater.h
$(WORKSPACE_ROOT)/libota/updater_fs.h/
$(WORKSPACE_ROOT)/libota/updater.h/
$(WORKSPACE_ROOT)/libota/updater_header.h/
$(WORKSPACE_ROOT)/libota/updater_lib.h
$(WORKSPACE_ROOT)/libota/$(MCU_ARCH)/libota.a
```

Additionally LIBOTA_CONFIG needs to be set to 1. This can be done in the
Makefile (or Makefile.private) or set on the command line:

```
make <PLAFTORM_NAME> LIBOTA_CONFIG=1
```

# Setup

This repository relies on several dependencies that are all publically available
Expand Down
4 changes: 4 additions & 0 deletions libota/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Store OTA library components in this folder.

MCU_FAMILY/libota.a
updater_lib.h
16 changes: 16 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
#include "log.h"
#include "sys_panic.h"


#ifdef INCLUDE_OTA
#include "basic_rtos_ota_setup.h"
#endif

#define USER_FILE_SYS_NR 0

#define DEVICE_ANNOUNCEMENT_PERIOD_S 300
Expand All @@ -73,6 +78,8 @@ static comms_layer_t * m_radio_comm = NULL;
static comms_layer_t * m_beat_comm = NULL;
#endif

static comms_receiver_t m_receiver_bc_data;

static void radio_start_done (comms_layer_t * comms, comms_status_t status, void * user)
{
debug("started %d", status);
Expand Down Expand Up @@ -114,6 +121,7 @@ static comms_layer_t * radio_setup (am_addr_t node_addr, uint8_t eui[IEEE_EUI64_
{
err1("!license_rcvr");
}

#else
info1("Starting single-hop");
radio = m_radio_comm;
Expand Down Expand Up @@ -183,6 +191,14 @@ static void main_loop ()
sys_panic("radio");
}

#ifdef INCLUDE_OTA
bool feed_watchdog = false;
#ifdef INCLUDE_BEATSTACK
basic_rtos_ota_setup(m_beat_comm, m_radio_comm, true, &feed_watchdog);
#else
basic_rtos_ota_setup(NULL, m_radio_comm, true, &feed_watchdog);
#endif
#endif
// Start deviceannouncement application ------------------------------------
if (0 == announcement_app_init(radio, DEVICE_ANNOUNCEMENT_PERIOD_S))
{
Expand Down