From 8582e0c33c8cce12e2700da50b58a9c4f9eaec4f Mon Sep 17 00:00:00 2001 From: Dylan Donahue Date: Sun, 24 Nov 2024 18:04:48 -0500 Subject: [PATCH 01/14] added git commands --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 32ae496..2c9e7a1 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,25 @@ ###################################### TARGET = shepherd2 +###################################### +# git +###################################### +GIT_MAJOR_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d'.' -f1) +GIT_MINOR_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d'.' -f2) +GIT_PATCH_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d'.' -f3) +GIT_IS_UPSTREAM_CLEAN := $(shell bash -c 'git merge-base --is-ancestor HEAD @{u} && echo 0 || echo 1') +GIT_IS_LOCAL_CLEAN := $(shell bash -c 'test -z "$$(git status --porcelain)" && echo 0 || echo 1') + + + +all: + @echo "Version: $(GIT_MAJOR_VERSION).$(GIT_MINOR_VERSION).$(GIT_PATCH_VERSION)" +CFLAGS += -DGIT_MAJOR_VERSION=$(GIT_MAJOR_VERSION) \ + -DGIT_MINOR_VERSION=$(GIT_MINOR_VERSION) \ + -DGIT_PATCH_VERSION=$(GIT_PATCH_VERSION) \ + -DGIT_IS_UPSTREAM_CLEAN=$(GIT_IS_UPSTREAM_CLEAN) \ + -DGIT_IS_LOCAL_CLEAN=$(GIT_IS_LOCAL_CLEAN) ###################################### # building variables ###################################### From 257bec4d8cb5ea85aa2f583b69535ce0b8d9b6e9 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 13 Dec 2024 13:11:44 -0500 Subject: [PATCH 02/14] add commit hash and author hash --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2c9e7a1..bf8eede 100644 --- a/Makefile +++ b/Makefile @@ -23,17 +23,25 @@ GIT_MINOR_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d' GIT_PATCH_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d'.' -f3) GIT_IS_UPSTREAM_CLEAN := $(shell bash -c 'git merge-base --is-ancestor HEAD @{u} && echo 0 || echo 1') GIT_IS_LOCAL_CLEAN := $(shell bash -c 'test -z "$$(git status --porcelain)" && echo 0 || echo 1') - +GIT_SHORTHASH := $(shell git rev-parse --short=8 HEAD) +GIT_AUTHORHASH := $(shell bash -c 'git log -n 1 --format=%h --author=$(git config --get user.name)') all: - @echo "Version: $(GIT_MAJOR_VERSION).$(GIT_MINOR_VERSION).$(GIT_PATCH_VERSION)" + @echo "VERSION: $(GIT_MAJOR_VERSION).$(GIT_MINOR_VERSION).$(GIT_PATCH_VERSION)" + @echo "UNPUSHED CHANGES: $(GIT_IS_UPSTREAM_CLEAN)" + @echo "UNCOMMITTED CHANGES: $(GIT_IS_LOCAL_CLEAN)" + @echo "COMMIT HASH: $(GIT_SHORTHASH)" + @echo "AUTHOR HASH: $(GIT_AUTHORHASH)" CFLAGS += -DGIT_MAJOR_VERSION=$(GIT_MAJOR_VERSION) \ -DGIT_MINOR_VERSION=$(GIT_MINOR_VERSION) \ -DGIT_PATCH_VERSION=$(GIT_PATCH_VERSION) \ -DGIT_IS_UPSTREAM_CLEAN=$(GIT_IS_UPSTREAM_CLEAN) \ - -DGIT_IS_LOCAL_CLEAN=$(GIT_IS_LOCAL_CLEAN) + -DGIT_IS_LOCAL_CLEAN=$(GIT_IS_LOCAL_CLEAN) \ + -DGIT_SHORTHASH=$(GIT_SHORTHASH) \ + -DGIT_AUTHORHASH=$(GIT_AUTHORHASH) + ###################################### # building variables ###################################### From 5bc29c99ea0481748f24c3fbff60ec1c959928ca Mon Sep 17 00:00:00 2001 From: Jake-Hensley Date: Tue, 14 Jan 2025 18:25:51 -0500 Subject: [PATCH 03/14] added heading --- Core/Src/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Core/Src/main.c b/Core/Src/main.c index 3df7929..1844589 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -1185,6 +1185,34 @@ void watchdog_pet(void) } +struct __attribute__((__packed__)) git_version_data { + uint8_t git_major_version; + uint8_t git_minor_version; + uint8_t git_patch_version; + bool git_is_upstream_clean; + bool git_is_local_clean; + } git_version_data; + + struct __attribute__((__packed__)) git_hash_data { + uint32_t git_shorthash; + uint32_t git_authorhash; + } git_hash_data; + +//put funtion that makes can message and queues message, send_nero_message is similar, use variables from versioning over can ticket in embedded-base +void send_git_version_message() { + const struct git_hash_data git_hash_data2 = {GIT_SHORTHASH , GIT_AUTHORHASH}; + const struct git_version_data git_version_data2 = {GIT_MAJOR_VERSION , GIT_MINOR_VERSION, GIT_PATCH_VERSION, GIT_IS_UPSTREAM_CLEAN, GIT_IS_LOCAL_CLEAN}; + can_msg_t msg1 = { .id = 0x698, .len = sizeof(git_version_data2)}; + can_msg_t msg2 = { .id = 0x699, .len = sizeof(git_hash_data2)}; + + memcpy(&msg1.data, &git_version_data2, sizeof(git_version_data2)); + memcpy(&msg2.data, &git_hash_data2, sizeof(git_hash_data2)); + + queue_can_msg(msg1); + //queue_can_msg(msg2); + +} + /* USER CODE END 4 */ /* USER CODE BEGIN Header_StartDefaultTask */ From 9ef928211c796935db2d077298ffadcb880b2d6b Mon Sep 17 00:00:00 2001 From: Jake-Hensley Date: Thu, 16 Jan 2025 19:58:56 -0500 Subject: [PATCH 04/14] added brief --- Core/Src/main.c | 4 +++- Drivers/Embedded-Base | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/Src/main.c b/Core/Src/main.c index 1844589..7361123 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -1198,7 +1198,9 @@ struct __attribute__((__packed__)) git_version_data { uint32_t git_authorhash; } git_hash_data; -//put funtion that makes can message and queues message, send_nero_message is similar, use variables from versioning over can ticket in embedded-base +/** + * @brief Sends git version infomation as a can message + */ void send_git_version_message() { const struct git_hash_data git_hash_data2 = {GIT_SHORTHASH , GIT_AUTHORHASH}; const struct git_version_data git_version_data2 = {GIT_MAJOR_VERSION , GIT_MINOR_VERSION, GIT_PATCH_VERSION, GIT_IS_UPSTREAM_CLEAN, GIT_IS_LOCAL_CLEAN}; diff --git a/Drivers/Embedded-Base b/Drivers/Embedded-Base index f6ffa63..8325863 160000 --- a/Drivers/Embedded-Base +++ b/Drivers/Embedded-Base @@ -1 +1 @@ -Subproject commit f6ffa63e1dc78f1cdff5c0196e2a43e901b8d0f6 +Subproject commit 83258635fc749ac72adb4b52e61f4f1a42e1842f From 27c79c0d9421d20a704c94763123573c1354b664 Mon Sep 17 00:00:00 2001 From: Jake-Hensley Date: Thu, 16 Jan 2025 20:04:30 -0500 Subject: [PATCH 05/14] commented out hash can message --- Core/Src/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/Src/main.c b/Core/Src/main.c index 7361123..ea3ff3b 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -1202,13 +1202,14 @@ struct __attribute__((__packed__)) git_version_data { * @brief Sends git version infomation as a can message */ void send_git_version_message() { - const struct git_hash_data git_hash_data2 = {GIT_SHORTHASH , GIT_AUTHORHASH}; + //const struct git_hash_data git_hash_data2 = {GIT_SHORTHASH , GIT_AUTHORHASH}; const struct git_version_data git_version_data2 = {GIT_MAJOR_VERSION , GIT_MINOR_VERSION, GIT_PATCH_VERSION, GIT_IS_UPSTREAM_CLEAN, GIT_IS_LOCAL_CLEAN}; + can_msg_t msg1 = { .id = 0x698, .len = sizeof(git_version_data2)}; - can_msg_t msg2 = { .id = 0x699, .len = sizeof(git_hash_data2)}; + //can_msg_t msg2 = { .id = 0x699, .len = sizeof(git_hash_data2)}; memcpy(&msg1.data, &git_version_data2, sizeof(git_version_data2)); - memcpy(&msg2.data, &git_hash_data2, sizeof(git_hash_data2)); + //memcpy(&msg2.data, &git_hash_data2, sizeof(git_hash_data2)); queue_can_msg(msg1); //queue_can_msg(msg2); From 784490d36062832e4e60f526aaf48314f22e9cb8 Mon Sep 17 00:00:00 2001 From: Jake-Hensley Date: Thu, 16 Jan 2025 22:19:30 -0500 Subject: [PATCH 06/14] added string.h import --- Core/Src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/Src/main.c b/Core/Src/main.c index ea3ff3b..7baaedf 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -25,6 +25,7 @@ #include "shep_tasks.h" #include "assert.h" +#include "string.h" /* USER CODE END Includes */ From 16cfca050e44ff42287242f055f9281b8a5c8b75 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 16:38:00 -0500 Subject: [PATCH 07/14] update ci --- .github/workflows/build-check.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 5ee76bb..bc27b33 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -7,14 +7,9 @@ jobs: image: ghcr.io/northeastern-electric-racing/embedded-base:main timeout-minutes: 10 steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Execute Make run: | - if ! make; then + if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then echo "The application has failed to build." exit 1 # This will cause the workflow to fail - fi \ No newline at end of file + fi From 0f1f49fb4d7bf062c0a0f9ac909a50dd8540f4cf Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:12:02 -0500 Subject: [PATCH 08/14] fix --- .github/workflows/build-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index bc27b33..2e74be4 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -7,6 +7,7 @@ jobs: image: ghcr.io/northeastern-electric-racing/embedded-base:main timeout-minutes: 10 steps: + - uses: actions/checkout@v4 - name: Execute Make run: | if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then From aa211ae5e50735764720304e472493c5dda33e2c Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:16:23 -0500 Subject: [PATCH 09/14] try dash --- .github/workflows/build-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 2e74be4..9091514 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - name: Execute Make run: | - if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then + if ! docker-compose run --rm ner-gcc-arm make -j `nproc`; then echo "The application has failed to build." exit 1 # This will cause the workflow to fail fi From 58c9590dc7aa43d4a4366190d7c440c7f2beb90f Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:18:29 -0500 Subject: [PATCH 10/14] send --- .github/workflows/build-check.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 9091514..7e4c5ec 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -9,8 +9,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Execute Make - run: | - if ! docker-compose run --rm ner-gcc-arm make -j `nproc`; then - echo "The application has failed to build." - exit 1 # This will cause the workflow to fail - fi + run: docker compose run --rm ner-gcc-arm make -j `nproc` From 3f729b45a3f33af16520c503739c12940c9a1ac8 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:19:29 -0500 Subject: [PATCH 11/14] simplify --- .github/workflows/build-check.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 7e4c5ec..2e10c7f 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -3,10 +3,12 @@ on: [push] jobs: run-build: runs-on: ubuntu-latest - container: - image: ghcr.io/northeastern-electric-racing/embedded-base:main timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Execute Make - run: docker compose run --rm ner-gcc-arm make -j `nproc` + run: | + if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then + echo "The application has failed to build." + exit 1 # This will cause the workflow to fail + fi From 7c007db08c21503e402899edf0b4df117a691a79 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:20:54 -0500 Subject: [PATCH 12/14] fix checkout --- .github/workflows/build-check.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 2e10c7f..b3f0460 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -5,7 +5,10 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive - name: Execute Make run: | if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then From 0d1f03dd6a9ff828691fca607242bfac213ebfa2 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 17 Jan 2025 17:29:06 -0500 Subject: [PATCH 13/14] final fixups --- .github/workflows/build-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index b3f0460..2390778 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -9,6 +9,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 - name: Execute Make run: | if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then From 6a7d73468c249509a9455ec83ef98cc2d1724ec7 Mon Sep 17 00:00:00 2001 From: Jake-Hensley Date: Sat, 18 Jan 2025 12:31:39 -0500 Subject: [PATCH 14/14] added a call to send_git_version_message in default task --- Core/Src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/Src/main.c b/Core/Src/main.c index 7baaedf..199bb05 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -1252,6 +1252,9 @@ void StartDefaultTask(void *argument) segment_is_balancing()); compute_send_fault_status_message(bmsdata); + send_git_version_message(); + + HAL_IWDG_Refresh(&hiwdg); osDelay(1000);