Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

descriptors: generate USB product string from git tag #6

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,21 @@ endif()
# Add the compile definition
add_compile_definitions(TILIQUA_HW_MAJOR=${TILIQUA_HW_MAJOR})

# Add executable. Default name is the project name, version 0.1
execute_process(
COMMAND git describe --tags --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

configure_file(
${CMAKE_SOURCE_DIR}/version.h.in
${CMAKE_BINARY_DIR}/version.h
@ONLY
)

# Add executable. Default name is the project name, version 0.1
add_executable(dirtyJtag
dirtyJtag.c
usb_descriptors.c
Expand Down
7 changes: 4 additions & 3 deletions usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "dirtyJtagConfig.h"
#include "tusb.h"
#include "version.h"
#include "get_serial.h"

#if ( USB_CDC_UART_BRIDGE )
Expand Down Expand Up @@ -124,11 +125,11 @@ char const *string_desc_arr[] =
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
"apf.audio", // 1: Manufacturer
#if (TILIQUA_HW_MAJOR == 2)
"Tiliqua R2 (dbg)",
"Tiliqua R2 " GIT_VERSION,
#elif (TILIQUA_HW_MAJOR == 3)
"Tiliqua R3 (dbg)",
"Tiliqua R3 " GIT_VERSION,
#elif (TILIQUA_HW_MAJOR == 4)
"Tiliqua R4 (dbg)",
"Tiliqua R4 " GIT_VERSION,
#else
#error "Unknown TILIQUA_HW_MAJOR"
#endif
Expand Down
1 change: 1 addition & 0 deletions version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define GIT_VERSION "@GIT_DESCRIBE@"