From 4a02ac376d0307d534d85cca365ceee9484325dc Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Thu, 12 Apr 2018 01:31:15 +0200 Subject: [PATCH 1/4] global version number --- bootloader/src/version.c | 7 ++++--- f3_boot/src/version.c | 7 ++++--- src/version.c | 7 ++++--- stm32f303/src/version.c | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bootloader/src/version.c b/bootloader/src/version.c index cc27ed29..fc017915 100644 --- a/bootloader/src/version.c +++ b/bootloader/src/version.c @@ -1,7 +1,8 @@ #include "version.h" +#include "version_number.h" volatile const version_info_t version_info __attribute__((section(".version_info"))) = { .product_name = "STMBL-Bootloader", - .major = 0, - .minor = 9, - .patch = 15}; + .major = VERSION_MAJOR, + .minor = VERSION_MINOR, + .patch = VERSION_PATCH}; diff --git a/f3_boot/src/version.c b/f3_boot/src/version.c index ad6905df..d71c9224 100644 --- a/f3_boot/src/version.c +++ b/f3_boot/src/version.c @@ -1,7 +1,8 @@ #include "version.h" +#include "version_number.h" volatile const version_info_t version_info __attribute__((section(".version_info"))) = { .product_name = "STMBL-f3-boot", - .major = 0, - .minor = 9, - .patch = 15}; + .major = VERSION_MAJOR, + .minor = VERSION_MINOR, + .patch = VERSION_PATCH}; diff --git a/src/version.c b/src/version.c index 3b16fd6e..63a10b17 100644 --- a/src/version.c +++ b/src/version.c @@ -1,7 +1,8 @@ #include "version.h" +#include "version_number.h" volatile const version_info_t version_info __attribute__((section(".version_info"))) = { .product_name = "STMBL", - .major = 0, - .minor = 9, - .patch = 15}; + .major = VERSION_MAJOR, + .minor = VERSION_MINOR, + .patch = VERSION_PATCH}; diff --git a/stm32f303/src/version.c b/stm32f303/src/version.c index c4da8abf..7b259e48 100644 --- a/stm32f303/src/version.c +++ b/stm32f303/src/version.c @@ -1,7 +1,8 @@ #include "version.h" +#include "version_number.h" volatile const version_info_t version_info __attribute__((section(".version_info"))) = { .product_name = "STMBL-hv-f303", - .major = 0, - .minor = 9, - .patch = 15}; + .major = VERSION_MAJOR, + .minor = VERSION_MINOR, + .patch = VERSION_PATCH}; From c41e51554f3b2ab030e310faa73864581cc4617a Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Thu, 12 Apr 2018 01:31:58 +0200 Subject: [PATCH 2/4] more sizeof checks --- shared/common.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/common.h b/shared/common.h index bd0f77bc..db547058 100644 --- a/shared/common.h +++ b/shared/common.h @@ -46,7 +46,7 @@ typedef struct { } state : 8; uint16_t padding; } packet_bootloader_t; - +_Static_assert(sizeof(packet_bootloader_t) == 24, "packet_bootloader_t size error"); //process data from f3 to f4 typedef struct { @@ -57,6 +57,7 @@ typedef struct { uint8_t buf; uint16_t padding; } packet_from_hv_t; +_Static_assert(sizeof(packet_from_hv_t) == 24, "packet_from_hv_t size error"); //process data from f4 to f3 typedef struct { @@ -84,6 +85,7 @@ typedef struct { uint32_t padding; }; } packet_to_hv_t; +_Static_assert(sizeof(packet_to_hv_t) == 32, "packet_to_hv_t size error"); //config data for f3 typedef union { @@ -152,7 +154,6 @@ typedef enum { HV_OVERCURRENT_HW, } fault_t; - //check if structs can be send at 5kHz with DATABAUD _Static_assert(sizeof(packet_to_hv_t) <= DATABAUD / 11 / 5000 - 1 - 5, "to_hv struct to large"); _Static_assert(sizeof(packet_from_hv_t) <= DATABAUD / 11 / 5000 - 1 - 5, "from_hv struct to large"); From e437ba7c5edb2b6d6df86939319a77633d0e3080 Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Thu, 12 Apr 2018 01:36:40 +0200 Subject: [PATCH 3/4] add version number include --- shared/version_number.h | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 shared/version_number.h diff --git a/shared/version_number.h b/shared/version_number.h new file mode 100644 index 00000000..a93d38b8 --- /dev/null +++ b/shared/version_number.h @@ -0,0 +1,5 @@ +#pragma once + +#define VERSION_MAJOR 0 +#define VERSION_MINOR 9 +#define VERSION_PATCH 17 From 69f262c969d391589d14df60b2e62eea21ea58db Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Thu, 12 Apr 2018 01:46:12 +0200 Subject: [PATCH 4/4] optional toolchain-user.mak include file --- .gitignore | 1 + Makefile | 1 - base.mak | 3 +++ bootloader/Makefile | 1 - f3_boot/Makefile | 1 - stm32f303/Makefile | 1 - toolchain.mak | 1 + 7 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index febfebaf..4e4f259f 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ src/conf_templates.c stm32f303/inc/commandslist.h stm32f303/inc/hal_tbl.h stm32f303/src/hal_tbl.c +toolchain-user.mak diff --git a/Makefile b/Makefile index fdedc86e..f0b5fd10 100644 --- a/Makefile +++ b/Makefile @@ -349,7 +349,6 @@ clean: # Include the base rules # include base.mak -include toolchain.mak # Include the dependency files # diff --git a/base.mak b/base.mak index a1e8ef81..eac25290 100644 --- a/base.mak +++ b/base.mak @@ -86,3 +86,6 @@ flash: $(TARGET).bin %.dfu: %.bin @cp $< $@ @$(DFU-SUFFIX) -v 0483 -p df11 -a $@ + +include toolchain.mak +-include toolchain-user.mak diff --git a/bootloader/Makefile b/bootloader/Makefile index 4c52513b..e22c3959 100644 --- a/bootloader/Makefile +++ b/bootloader/Makefile @@ -148,7 +148,6 @@ clean: # Include the base rules # include base.mak -include toolchain.mak # Include the dependency files # diff --git a/f3_boot/Makefile b/f3_boot/Makefile index a6f22637..7244bf17 100644 --- a/f3_boot/Makefile +++ b/f3_boot/Makefile @@ -168,7 +168,6 @@ clean: # Include the base rules # include base.mak -include toolchain.mak # Include the dependency files # diff --git a/stm32f303/Makefile b/stm32f303/Makefile index 04a86b2d..623f05a2 100644 --- a/stm32f303/Makefile +++ b/stm32f303/Makefile @@ -216,7 +216,6 @@ clean: # Include the base rules # include base.mak -include toolchain.mak # Include the dependency files # diff --git a/toolchain.mak b/toolchain.mak index fff6147b..a09d6f5c 100644 --- a/toolchain.mak +++ b/toolchain.mak @@ -1,4 +1,5 @@ # Define programs and commands for the toolchain +# Do not modiy this file. Instead create a file toolchain-user.mak which can overwrite anything in here. PYTHON = python DFU-UTIL = dfu-util DFU-SUFFIX = dfu-suffix