I started an “Issue” over on GitHub but will keep this thread going.
Isn’t that the information/settings in the cmake-variants.yaml file provides?
I actually had tried including a custom “upload_method_.cmake” file with those lines in it and include it in the top level CMakeLists.txt file, but no joy.
I tried adding what you suggested to the top level CMakeLists.txt file:
cmake_minimum_required(VERSION 3.19)
cmake_policy(VERSION 3.19)
Initialize Mbed OS build system.
Note: This block must be before the include of app.cmake
set(MBED_APP_JSON_PATH mbed_app.json)
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL “”)
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL “”)
set(CUSTOM_TARGETS_JSON_PATH custom_targets.json)
set(APP_TARGET loraSensor)
include(${MBED_PATH}/tools/cmake/app.cmake)
Config options for STM32Cube
-------------------------------------------------------------
set(UPLOAD_METHOD STM32CUBE)
set(STM32CUBE_UPLOAD_ENABLED TRUE)
set(STM32CUBE_CONNECT_COMMAND -c port=SWD reset=HWrst)
set(STM32CUBE_GDBSERVER_ARGS --swd)
add_subdirectory(custom_targets)
add_subdirectory(${MBED_PATH})
project(${APP_TARGET})
mbed_finalize_build()
add_executable(${APP_TARGET})
target_include_directories(${APP_TARGET}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
src
)
target_sources(${APP_TARGET}
PRIVATE
loraSensor.cpp
src/BMA400.cpp
src/BQ35100.cpp
src/Cmd.cpp
src/gnss.cpp
src/eep.cpp
)
target_link_libraries(${APP_TARGET}
mbed-os
mbed-baremetal
mbed-lorawan
mbed-usb
)
mbed_set_post_build(${APP_TARGET})
option(VERBOSE_BUILD “Have a verbose build process”)
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
and get the following:
[proc] Executing command: cmake --version
[proc] Executing command: cmake -E capabilities
[variant] Loaded new set of variants
[kit] Successfully loaded 1 kits from C:\Users\tim\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: “C:\Program Files\CMake\bin\cmake.EXE” --version
[proc] Executing command: “C:\Program Files\CMake\bin\cmake.EXE” -E capabilities
[main] Configuring project: loraSensor
[proc] Executing command: “C:\Program Files\CMake\bin\cmake.EXE” --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DMBED_TARGET:STRING=LATIUM_HVC_ABZ -DUPLOAD_METHOD:STRING=STM32CUBE -DSTM32CUBE_UPLOAD_ENABLED:BOOL=TRUE “-DSTM32CUBE_CONNECT_COMMAND:STRING=-c;port=swd;reset=HWrst” -DSTM32CUBE_GDBSERVER_ARGS:STRING=–swd -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE “-SC:/Users/tim/Mbed Programs/mbed-ce/loraSensor” “-Bc:/Users/tim/Mbed Programs/mbed-ce/loraSensor/build/LATIUM_HVC_ABZ-Debug” -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] – Found Python3: C:/Program Files/Python311/python.exe (found version “3.11.7”) found components: Interpreter
[cmake] – Checking for Python package intelhex – found
[cmake] – Checking for Python package prettytable – found
[cmake] – Checking for Python package future – found
[cmake] – Checking for Python package jinja2 – found
[cmake] – Mbed: First CMake run detected, generating configs…
[cmake] mbed_config.cmake has been generated and written to ‘C:\Users\tim\Mbed Programs\mbed-ce\loraSensor\build\LATIUM_HVC_ABZ-Debug\mbed_config.cmake’
[cmake] – The C compiler identification is GNU 13.2.1
[cmake] – The CXX compiler identification is GNU 13.2.1
[cmake] – The ASM compiler identification is GNU
[cmake] – Found assembler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.2 Rel1/bin/arm-none-eabi-gcc.exe
[cmake] – Detecting C compiler ABI info
[cmake] – Detecting C compiler ABI info - done
[cmake] – Check for working C compiler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.2 Rel1/bin/arm-none-eabi-gcc.exe - skipped
[cmake] – Detecting C compile features
[cmake] – Detecting C compile features - done
[cmake] – Detecting CXX compiler ABI info
[cmake] – Detecting CXX compiler ABI info - done
[cmake] – Check for working CXX compiler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.2 Rel1/bin/arm-none-eabi-g++.exe - skipped
[cmake] – Detecting CXX compile features
[cmake] – Detecting CXX compile features - done
[cmake] – Mbed: Target does not have any upload method configuration. ‘make flash-’ commands will not be available unless configured by the upper-level project.
[cmake] – Mbed: Not building any Mbed OS tests.
[cmake] – Located STM32CubeIDE: C:/ST/STM32CubeIDE_1.14.0/STM32CubeIDE
[cmake] – Found STLINKTools: C:/ST/STM32CubeIDE_1.14.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.100.202311100844/tools/bin/STM32_Programmer_CLI.exe
[cmake] – Mbed: Code upload and debugging enabled via upload method STM32CUBE
[cmake] – Mbed: Detected VS Code IDE, will generate VS Code debug configurations
[cmake] – Configuring done (11.0s)
[cmake] – Generating done (1.3s)
[cmake] – Build files have been written to: C:/Users/tim/Mbed Programs/mbed-ce/loraSensor/build/LATIUM_HVC_ABZ-Debug
You mention setting -DUPLOAD_METHOD=STM32CUBE, that is set in the cmake-variants.yaml file. Is there someplace else it should be set? My .vscode/launch.json file still does not contain any configurations but the .vscode/tasks.json file is being created
// Auto-generated by Mbed CE. Edits will be erased when CMake is rerun.
{
“version”: “2.0.0”,
“tasks”: [
{
“label”: “GDB Server”,
“type”: “shell”,
“command”: “C:/ST/STM32CubeIDE_1.14.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.1.100.202310302101/tools/bin/ST-LINK_gdbserver.exe”,
“args”: [“–swd”, “-cp”, “C:/ST/STM32CubeIDE_1.14.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.100.202311100844/tools/bin”, “-p”, “23331”, “–halt”],
“isBackground”: true,
// This task is run to start the GDB server, so that the launch configuration can connect to it.
// Problem is, it’s a GDB server, and since it never exits, VSCode
// will never start the debug session. All this is needed so VSCode just lets it run.
“problemMatcher”: [
{
“pattern”: [
{
“regexp”: “________________”,
“file”: 1,
“location”: 2,
“message”: 3
}
],
“background”: {
“activeOnStart”: true,
“beginsPattern”: “.",
“endsPattern”: ".”,
}
}
],
}
]
}