Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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/
36 changes: 31 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ PROJECT_NAME ?= mistexample

VERSION_MAJOR ?= 1
VERSION_MINOR ?= 0
Comment thread
ESaar-t marked this conversation as resolved.
VERSION_PATCH ?= 0
VERSION_PATCH ?= 1
VERSION_DEVEL ?= "-dev"

# Include some optional configuration when requested
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
DEFAULT_PAN_ID ?= 0x22
DEFAULT_PAN_ID ?= 0xFF
Comment thread
ESaar-t marked this conversation as resolved.
Outdated

#include bootloader
INCLUDE_BOOTLOADER ?= 0

# Specify beatstack config, single-hop if not set
LIBBEAT_CONFIG ?= ""


LIBOTA_CONFIG =

#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,6 +209,7 @@ 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
SOURCES += $(NODE_PLATFORM_DIR)/widgets/basic_rtos_ota_setup.c
Comment thread
ESaar-t marked this conversation as resolved.
Outdated

# device signature
INCLUDES += -I$(ZOO)/thinnect.device-signature/signature \
Expand Down Expand Up @@ -269,10 +273,32 @@ SOURCES += $(NODE_PLATFORM_DIR)/silabs/retargetspi.c
SOURCES += $(NODE_PLATFORM_DIR)/silabs/retargeti2c.c
SOURCES += $(NODE_PLATFORM_DIR)/silabs/watchdog.c

SOURCES += panic_handler.c
Comment thread
ESaar-t marked this conversation as resolved.
Outdated

# mist library
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 Expand Up @@ -356,9 +382,9 @@ $(BUILD_DIR)/$(PROJECT_NAME).bin: $(BUILD_DIR)/$(PROJECT_NAME).elf
$(HIDE_CMD)$(TC_OBJCOPY) --strip-all -O binary "$<" "$@"
$(HIDE_CMD)$(HEADEREDIT) -v size -v crc $@

$(BUILD_DIR)/combo.bin: bootloader/wfs201-bootloader.bin $(BUILD_DIR)/$(PROJECT_NAME).bin
$(BUILD_DIR)/combo.bin: bootloader/tsb2-dev/bootloader.bin $(BUILD_DIR)/$(PROJECT_NAME).bin
Comment thread
ESaar-t marked this conversation as resolved.
Outdated
$(call pInfo,Building combo [$@])
srec_cat bootloader/wfs201-bootloader.bin -binary -offset $(BOOTLOADER_START) \
srec_cat bootloader/tsb2-dev/bootloader.bin -binary -offset $(BOOTLOADER_START) \
$(BUILD_DIR)/$(PROJECT_NAME).bin -binary -offset $(APP_START) \
-o $@ -binary
chmod 755 "$@"
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ 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 network
Comment thread
ESaar-t marked this conversation as resolved.
Outdated
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)/libbeat/updater.h
Comment thread
ESaar-t marked this conversation as resolved.
Outdated
$(WORKSPACE_ROOT)/libbeat/$(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