File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
tools/cmake/upload_methods Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ function(gen_upload_target TARGET_NAME BINARY_FILE)
3434 ${STM32CUBE_CONNECT_COMMAND}
3535 ${STM32CUBE_UPLOAD_PROBE_ARGS} # probe arg must be immediately after -c command as it gets appended to -c
3636 -w ${BINARY_FILE} ${MBED_UPLOAD_BASE_ADDR}
37- -rst)
37+ -rst
38+ VERBATIM
39+ USES_TERMINAL )
3840
3941endfunction (gen_upload_target)
4042
Original file line number Diff line number Diff line change 1+ # Copyright (c) 2025 Jamie Smith
2+ # SPDX-License-Identifier: Apache-2.0
3+
4+ ### STM32Cube DFU Upload Method
5+ # This method needs the following parameters:
6+ # STM32CUBE_DFU_CONNECT_COMMAND - "Connect" (-c) command to pass to the programmer
7+
8+ ### Check if upload method can be enabled on this machine
9+ find_package (STLINKTools COMPONENTS STM32CubeProg)
10+ set (UPLOAD_STM32CUBE_DFU_FOUND ${STLINKTools_FOUND} )
11+
12+ set (UPLOAD_SUPPORTS_DEBUG FALSE )
13+
14+ ### Function to generate upload target
15+
16+ function (gen_upload_target TARGET_NAME BINARY_FILE)
17+
18+ set (STM32CUBE_UPLOAD_PROBE_ARGS sn=${MBED_UPLOAD_SERIAL_NUMBER} )
19+
20+ add_custom_target (flash-${TARGET_NAME}
21+ COMMENT "Flashing ${TARGET_NAME} with STM32CubeProg..."
22+ COMMAND ${STM32CubeProg_COMMAND}
23+ -c ${STM32CUBE_DFU_CONNECT_COMMAND}
24+ ${STM32CUBE_UPLOAD_PROBE_ARGS} # probe arg must be immediately after -c command as it gets appended to -c
25+ -w ${BINARY_FILE} ${MBED_UPLOAD_BASE_ADDR}
26+ VERBATIM
27+ USES_TERMINAL )
28+
29+ endfunction (gen_upload_target)
You can’t perform that action at this time.
0 commit comments