Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.

Commit

Permalink
Extend OTA documentation
Browse files Browse the repository at this point in the history
Signed-off-by: David Gräff <david.graeff@web.de>
  • Loading branch information
David Gräff committed Jun 9, 2018
1 parent f9808e9 commit 4af29f7
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
23 changes: 23 additions & 0 deletions docs/advanced-usage/ota.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ directory.
Updating or even checking the version is a server initatiated operation, wakaamaNode
will not perform any checks on its own.

## On Posix/Windows systems

The firmware update object accepts pushed binaries via coap in the default implementation.
The new binary is saved as "new.current_binary_name". As soon as the update resource is executed,
the current binary will be moved to "old.current_binary_name" and the "new.current_binary_name"
takes it place.

The new binary is started with a command line argument "oldpid=PID". It sends a posix signal SIGTERM
to the old binary via the PID and waits for it to finish.

The old binary waits for SIGTERM and terminates if received.
If not received in time (because the new binary has startup problems for example), the old executable
will stay active.

A posix/win32 binary is required to call `void checkIsUpdated(int argc, char** argv)` on startup.

## Arduino OTA

Because memory space is assumed to be limited, the update process accepts a http URI only and does not take
binaries directly via COAP.

The ESP8266 method `ESPhttpUpdate.update("192.168.0.2", 80, "/arduino.bin");` is used.

## OTA security

You should only accept an OTA request, if you are connected to a DTLS secured connection
Expand Down
5 changes: 5 additions & 0 deletions examples/linux_win_with_screen_control/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "client_debug.h"
#include "network.h"
#include "screen_object.h"
// For c++ projects with firmware support
// #include "object_firmware.hpp"

#include <string.h>
#include <stdlib.h>
Expand All @@ -28,6 +30,9 @@ int main(int argc, char *argv[])
* We catch Ctrl-C signal for a clean exit
*/
signal(SIGINT, handle_sigint);

// For c++ projects with firmware support
//checkIsUpdated(argc, argv);

device_instance_t * device_data = lwm2m_device_data_get();
device_data->manufacturer = "test manufacturer";
Expand Down
10 changes: 3 additions & 7 deletions src/firmware/arduinoOTA.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#define ARDUINO
#define LWM2M_FIRMWARE_UPGRADES

#include "object_firmware.hpp"
#include "lwm2m_connect.h"

#if (defined(ARDUINO) || defined(LWM2M_FIRMWARE_UPGRADES))
#if (defined(ARDUINO) && defined(LWM2M_FIRMWARE_UPGRADES))
#include <ArduinoOTA.h>
#include "lwm2m_connect.h"
#include "object_firmware.hpp"

void writeNewFirmware(DynArray<uint8_t*>& firmware) {}

Expand Down
2 changes: 1 addition & 1 deletion src/lwm2m_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "wakaama/liblwm2m.h"
#include "lwm2m_objects.h" // We need the enums of the C-API as well
#include <inttypes.h>
#include <cstring>
#include <string.h>
#include "macro_helper.h"
#include <type_traits>
#include <functional>
Expand Down
Binary file removed src/platform/.platform_freertos.c.kate-swp
Binary file not shown.
3 changes: 3 additions & 0 deletions src/platform/platform_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void __attribute__((weak)) lwm2m_printf(const char * format, ...)
{

}
#else
void __attribute__((weak)) lwm2m_printf(const char * format, ...) {}

#endif

#endif
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

cmake_minimum_required(VERSION 3.1)

project(Lwm2mCLientLibWithLwIP CXX C)
project(Tests CXX C)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

Expand Down

0 comments on commit 4af29f7

Please sign in to comment.