Skip to content
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
4 changes: 2 additions & 2 deletions tools/cmake/UploadMethodManager.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function(mbed_adjust_upload_debug_commands target)
# GDB load command doesn't support binary format. Ignore OUTPUT_EXT
# and fix to Intel Hex format.
#
# NOTE: The <app>.hex file name needs to be quoted (\\\") to pass along
# NOTE: The <app>.hex file name needs to be quoted (\") to pass along
# to gdb correctly.
list(TRANSFORM MBED_UPLOAD_LAUNCH_COMMANDS APPEND " \\\"${HEX_FILE}\\\"" AT ${LOAD_INDEX})
list(TRANSFORM MBED_UPLOAD_LAUNCH_COMMANDS APPEND " \"${HEX_FILE}\"" AT ${LOAD_INDEX})

# Update MBED_UPLOAD_LAUNCH_COMMANDS in cache
set(MBED_UPLOAD_LAUNCH_COMMANDS ${MBED_UPLOAD_LAUNCH_COMMANDS} CACHE INTERNAL "" FORCE)
Expand Down
8 changes: 6 additions & 2 deletions tools/cmake/mbed_ide_debug_cfg_generator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,13 @@ elseif(MBED_GENERATE_VS_CODE_DEBUG_CFGS)
# Create name (combine target name, Mbed target, and build config to generate a unique string)
set(CONFIG_NAME "Debug ${CMAKE_TARGET} ${MBED_TARGET} ${CMAKE_BUILD_TYPE}")

# Escape quotes in the launch commands
string(REPLACE "\"" "\\\"" UPLOAD_LAUNCH_COMMANDS_FOR_JSON "${MBED_UPLOAD_LAUNCH_COMMANDS}")
string(REPLACE "\"" "\\\"" UPLOAD_RESTART_COMMANDS_FOR_JSON "${MBED_UPLOAD_RESTART_COMMANDS}")

# Convert CMake lists to json
list(JOIN MBED_UPLOAD_LAUNCH_COMMANDS "\", \"" UPLOAD_LAUNCH_COMMANDS_FOR_JSON)
list(JOIN MBED_UPLOAD_RESTART_COMMANDS "\", \"" UPLOAD_RESTART_COMMANDS_FOR_JSON)
list(JOIN UPLOAD_LAUNCH_COMMANDS_FOR_JSON "\", \"" UPLOAD_LAUNCH_COMMANDS_FOR_JSON)
list(JOIN UPLOAD_RESTART_COMMANDS_FOR_JSON "\", \"" UPLOAD_RESTART_COMMANDS_FOR_JSON)

# property list here: https://github.com/Marus/cortex-debug/blob/master/debug_attributes.md
set_property(GLOBAL APPEND_STRING PROPERTY VSCODE_LAUNCH_JSON_CONTENT "
Expand Down
7 changes: 3 additions & 4 deletions tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ set(UPLOAD_LAUNCH_COMMANDS
"break main"
"monitor reset"

# Workaround for LinkServer supplying incomplete memory information to GDB
# (in particular, seems to be missing the peripheral memory space and external RAM).
# Without this command, GDB will block the user from accessing values in any of these
# memory spaces.
# Tell GDB to allow reads to any region of memory, ignoring the memory map sent by the GDB server.
# This is needed because often the GDB server's memory map doesn't include peripheral memory, so
# the user can't inspect peripheral registers.
"set mem inaccessible-by-default off"
)
set(UPLOAD_RESTART_COMMANDS
Expand Down
5 changes: 5 additions & 0 deletions tools/cmake/upload_methods/UploadMethodOPENOCD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ set(UPLOAD_LAUNCH_COMMANDS
# Increase remote timeout to 30 sec in case programming takes a long time
"set remotetimeout 30"

# Tell GDB to allow reads to any region of memory, ignoring the memory map sent by the GDB server.
# This is needed because often the GDB server's memory map doesn't include peripheral memory, so
# the user can't inspect peripheral registers.
"set mem inaccessible-by-default off"

"load"
"tbreak main"
"monitor reset halt"
Expand Down
5 changes: 5 additions & 0 deletions tools/cmake/upload_methods/UploadMethodPYOCD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ set(UPLOAD_LAUNCH_COMMANDS
"load"
"tbreak main"

# Tell GDB to allow reads to any region of memory, ignoring the memory map sent by the GDB server.
# This is needed because often the GDB server's memory map doesn't include peripheral memory, so
# the user can't inspect peripheral registers.
"set mem inaccessible-by-default off"

# It appears the device under debug must be halted after UPLOAD_LAUNCH_COMMANDS,
# or debugger will become abnormal.
"monitor reset halt"
Expand Down
6 changes: 6 additions & 0 deletions tools/cmake/upload_methods/UploadMethodSTLINK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ set(UPLOAD_LAUNCH_COMMANDS
"monitor halt"
"monitor reset"
"load"

# Tell GDB to allow reads to any region of memory, ignoring the memory map sent by the GDB server.
# This is needed because often the GDB server's memory map doesn't include peripheral memory, so
# the user can't inspect peripheral registers.
"set mem inaccessible-by-default off"

"tbreak main"
"monitor reset"
)
Expand Down
6 changes: 6 additions & 0 deletions tools/cmake/upload_methods/UploadMethodSTM32CUBE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
set(UPLOAD_LAUNCH_COMMANDS
"monitor reset"
"load"

# Tell GDB to allow reads to any region of memory, ignoring the memory map sent by the GDB server.
# This is needed because often the GDB server's memory map doesn't include peripheral memory, so
# the user can't inspect peripheral registers.
"set mem inaccessible-by-default off"

"tbreak main"
"monitor reset"
)
Expand Down