File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ pico_generate_pio_header(debugprobe ${CMAKE_CURRENT_LIST_DIR}/src/autobaud.pio)
4747
4848target_include_directories (debugprobe PRIVATE src )
4949
50+ # add version
51+ add_custom_target (version
52+ ${CMAKE_SOURCE_DIR} /get-version.sh
53+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
54+ )
55+
56+ target_include_directories (debugprobe PRIVATE
57+ ${CMAKE_BINARY_DIR} /generated
58+ )
59+
60+ add_dependencies (debugprobe version )
61+
5062target_compile_definitions (debugprobe PRIVATE
5163 PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1
5264)
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ if command -v git & > /dev/null
3+ then
4+ VERSION=$( git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD)
5+ else
6+ VERSION=" unknown"
7+ fi
8+
9+ if [ ! -e generated/probe ]
10+ then
11+ mkdir -p generated/probe
12+ fi
13+
14+ cat > generated/probe/version.h << EOF
15+ #ifndef _PROBE_VERSION_H
16+ #define _PROBE_VERSION_H
17+
18+ #define PROBE_VERSION "${VERSION} "
19+
20+ #endif
21+ EOF
Original file line number Diff line number Diff line change 11#include "probe_config.h"
22#include "pico/binary_info.h"
3-
3+ #include "probe/version.h"
44
55#define STR_HELPER (x ) #x
66#define STR (x ) STR_HELPER(x)
77
88
99void bi_decl_config ()
1010{
11+ bi_decl (bi_program_version_string (PROBE_VERSION ));
1112#ifdef PROBE_PIN_RESET
1213 bi_decl (bi_1pin_with_name (PROBE_PIN_RESET , "PROBE RESET" ));
1314#endif
You can’t perform that action at this time.
0 commit comments