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

Fix a few CMake issues after the recent upload and memory bank changes #371

Merged
merged 1 commit into from
Oct 10, 2024
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
6 changes: 3 additions & 3 deletions tools/cmake/mbed_ide_debug_cfg_generator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if(MBED_GENERATE_CLION_DEBUG_CFGS)
"<!-- Autogenerated by Mbed OS. Do not edit! -->
<component name=\"ProjectRunConfigurationManager\">
<configuration default=\"false\" name=\"${CONFIG_NAME}\" type=\"com.jetbrains.cidr.embedded.customgdbserver.type\" PROGRAM_PARAMS=\"${GDBSERVER_ARGS_STR}\" REDIRECT_INPUT=\"false\" ELEVATE=\"false\" USE_EXTERNAL_CONSOLE=\"false\" PASS_PARENT_ENVS_2=\"true\" PROJECT_NAME=\"${PROJECT_NAME}\" TARGET_NAME=\"${CMAKE_TARGET}\" CONFIG_NAME=\"${MBED_CLION_PROFILE_NAME}\" version=\"1\" RUN_TARGET_PROJECT_NAME=\"${PROJECT_NAME}\" RUN_TARGET_NAME=\"${CMAKE_TARGET}\">
<custom-gdb-server version=\"1\" gdb-connect=\"127.0.0.1:${GDB_PORT}\" executable=\"${GDBSERVER_EXECUTABLE}\" warmup-ms=\"0\" download-type=\"UPDATED_ONLY\" reset-cmd=\"monitor reset\" reset-type=\"AFTER_DOWNLOAD\">
<custom-gdb-server version=\"1\" gdb-connect=\"127.0.0.1:${MBED_GDB_PORT}\" executable=\"${GDBSERVER_EXECUTABLE}\" warmup-ms=\"0\" download-type=\"UPDATED_ONLY\" reset-cmd=\"monitor reset\" reset-type=\"AFTER_DOWNLOAD\">
<debugger kind=\"GDB\" isBundled=\"true\" />
</custom-gdb-server>
<method v=\"2\">
Expand Down Expand Up @@ -135,7 +135,7 @@ elseif(MBED_GENERATE_VS_CODE_DEBUG_CFGS)
\"gdbPath\": \"${MBED_GDB}\",
\"objdumpPath\": \"${MBED_OBJDUMP}\",
\"servertype\": \"external\",
\"gdbTarget\": \"127.0.0.1:${GDB_PORT}\",
\"gdbTarget\": \"127.0.0.1:${MBED_GDB_PORT}\",
\"request\": \"launch\",
\"preLaunchTask\": \"Build ${CMAKE_TARGET} and start GDB server\",
// Override the command sequences used by VS Code to be correct for this GDB server
Expand Down Expand Up @@ -266,7 +266,7 @@ elseif(MBED_UPLOAD_SUPPORTS_DEBUG)

file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/mbed-cmake.gdbinit CONTENT
"# connect to GDB server
target ${UPLOAD_GDB_REMOTE_KEYWORD} 127.0.0.1:${GDB_PORT}
target ${UPLOAD_GDB_REMOTE_KEYWORD} 127.0.0.1:${MBED_GDB_PORT}
${MBED_UPLOAD_LAUNCH_COMMANDS_FOR_GDBINIT}
c"
)
Expand Down
11 changes: 8 additions & 3 deletions tools/cmake/mbed_target_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ function(mbed_generate_map_file target)

# Config process saves the JSON file here
set(MEMORY_BANKS_JSON_PATH ${CMAKE_BINARY_DIR}/memory_banks.json)
set(MEMORY_BANKS_ARG "")
if(EXISTS ${MEMORY_BANKS_JSON_PATH})
set(MEMORY_BANKS_ARG --memory-banks-json ${MEMORY_BANKS_JSON_PATH})
endif()

# generate table for screen
add_custom_command(
Expand All @@ -58,7 +62,8 @@ function(mbed_generate_map_file target)
POST_BUILD
COMMAND ${Python3_EXECUTABLE} -m memap.memap
-t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
--depth ${MBED_MEMAP_DEPTH} --memory-banks-json ${MEMORY_BANKS_JSON_PATH}
--depth ${MBED_MEMAP_DEPTH}
${MEMORY_BANKS_ARG}
WORKING_DIRECTORY
${mbed-os_SOURCE_DIR}/tools/python
)
Expand All @@ -74,7 +79,7 @@ function(mbed_generate_map_file target)
--depth ${MBED_MEMAP_DEPTH}
-e json
-o ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.memmap.json
--memory-banks-json ${MEMORY_BANKS_JSON_PATH}
${MEMORY_BANKS_ARG}
WORKING_DIRECTORY
${mbed-os_SOURCE_DIR}/tools/python
)
Expand All @@ -91,7 +96,7 @@ function(mbed_generate_map_file target)
--depth ${MBED_MEMAP_DEPTH}
-e html
-o ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.memmap.html
--memory-banks-json ${MEMORY_BANKS_JSON_PATH}
${MEMORY_BANKS_ARG}
WORKING_DIRECTORY
${mbed-os_SOURCE_DIR}/tools/python
)
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodJLINK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
-JTAGConf -1,-1
-LocalhostOnly
-noIR
-port ${GDB_PORT}
-port ${MBED_GDB_PORT}
-singlerun # Terminate GDB server after GDB disconnects
)

Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
${LinkServer_PATH}
gdbserver
${LINKSERVER_PROBE_ARGS}
--gdb-port ${GDB_PORT}
--gdb-port ${MBED_GDB_PORT}
${LINKSERVER_DEVICE}
)

Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodOPENOCD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
# Shut down OpenOCD when GDB disconnects.
# see https://github.com/Marus/cortex-debug/issues/371#issuecomment-999727626
-c "[target current] configure -event gdb-detach {shutdown}"
-c "gdb_port ${GDB_PORT}")
-c "gdb_port ${MBED_GDB_PORT}")

# request extended-remote GDB sessions
set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE)
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodPYOCD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
-t ${PYOCD_TARGET_NAME}
${PYOCD_PROBE_ARGS}
-f ${PYOCD_CLOCK_SPEED}
-p ${GDB_PORT})
-p ${MBED_GDB_PORT})

# Reference: https://github.com/Marus/cortex-debug/blob/056c03f01e008828e6527c571ef5c9adaf64083f/src/pyocd.ts#L40
set(UPLOAD_LAUNCH_COMMANDS
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodSTLINK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
${st-util_PATH}
${STLINK_SERIAL_ARGUMENT}
${STLINK_ARGS}
--listen_port=${GDB_PORT}
--listen_port=${MBED_GDB_PORT}
--multi)

# Reference: https://github.com/Marus/cortex-debug/blob/056c03f01e008828e6527c571ef5c9adaf64083f/src/stutil.ts#L39
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/upload_methods/UploadMethodSTM32CUBE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
${STLINK_gdbserver_COMMAND}
${STM32CUBE_GDBSERVER_ARGS}
-cp "${CUBE_PROG_DIR}"
-p ${GDB_PORT}
-p ${MBED_GDB_PORT}
--halt
${STM32CUBE_GDB_PROBE_ARGS})

Expand Down
Loading