From 500fe5c98ca71371f84bffb4ba083264c4954bc2 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Mon, 22 Feb 2021 10:31:39 -0800 Subject: [PATCH] uavcannode_gps_demo:Add UAVCAN bootloader AppDescriptor --- .../uavcannode_gps_demo/CMakeLists.txt | 1 + src/drivers/uavcannode_gps_demo/canard_main.c | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/drivers/uavcannode_gps_demo/CMakeLists.txt b/src/drivers/uavcannode_gps_demo/CMakeLists.txt index fd3ae1b56a..443b35c1bd 100644 --- a/src/drivers/uavcannode_gps_demo/CMakeLists.txt +++ b/src/drivers/uavcannode_gps_demo/CMakeLists.txt @@ -78,5 +78,6 @@ px4_add_module( DEPENDS git_libcanard git_public_regulated_data_types + drivers_bootloaders version ) diff --git a/src/drivers/uavcannode_gps_demo/canard_main.c b/src/drivers/uavcannode_gps_demo/canard_main.c index a7a26ae64d..a8f62c55db 100644 --- a/src/drivers/uavcannode_gps_demo/canard_main.c +++ b/src/drivers/uavcannode_gps_demo/canard_main.c @@ -65,6 +65,9 @@ #include "libcancl/pnp.h" #include "libcancl/registerinterface.h" + +#include "boot_app_shared.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -76,6 +79,23 @@ /**************************************************************************** * Private Data ****************************************************************************/ +/* + * This is the AppImageDescriptor used + * by the make_can_boot_descriptor.py tool to set + * the application image's descriptor so that the + * uavcan bootloader has the ability to validate the + * image crc, size etc of this application +*/ +boot_app_shared_section app_descriptor_t AppDescriptor = { + .signature = APP_DESCRIPTOR_SIGNATURE, + .image_crc = 0, + .image_size = 0, + .git_hash = 0, + .major_version = APP_VERSION_MAJOR, + .minor_version = APP_VERSION_MINOR, + .board_id = HW_VERSION_MAJOR << 8 | HW_VERSION_MINOR, + .reserved = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } +}; O1HeapInstance *my_allocator; static uint8_t uavcan_heap[O1_HEAP_SIZE]