I am trying to set up VS Code to build the “blinky” example for the MAX32620FTHR connected to the MAX32625PICO. All of that was fairly simple to get running using the MBed Studio – I just built the example with the PICO cabled up to my MacBook, and the generated executable auto-magically got installed and started running on the FTHR.
I’m now trying to get the same kind of build with VS Code. I was directed to the VS Code setup at Project Setup: VS Code · mbed-ce/mbed-os Wiki · GitHub which got me partway through, but I’m had some difficulty understanding the UPLOAD_METHOD entry in the cmake-variants.yaml file. I copied the yaml file I found at the project setup link, and just changed the target and upload stuff, as follows:
buildType:
default: Debug
choices:
Debug:
short: Debug
long: Emit debug information and don't optimize
buildType: Debug
Develop:
short: Develop
long: Emit debug information but also optimize
buildType: Develop
Release:
short: Release
long: Optimize generated code
buildType: Release
board:
default: MAX32620FTHR
choices:
YOUR_MBED_TARGET:
short: MAX32620FTHR
settings:
MBED_TARGET: MAX32620FTHR
UPLOAD_METHOD: PYOCD
The UPLOAD_METHOD was just a guess. The choices were MBED and PYOCD, and PYOCD seemed to be supported by the MAX32620FTHR, although I’m not sure about that.
When I selected a configuration, I got cmake configuration errors:
[cmake] CMake Error at mbed-os/tools/cmake/UploadMethodManager.cmake:24 (message):
[cmake] The upload method PYOCD is not enabled in the config code for this target
[cmake] -- set PYOCD_UPLOAD_ENABLED to TRUE to enable it.
[cmake] Call Stack (most recent call first):
[cmake] mbed-os/CMakeLists.txt:219 (include)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/Users/howardharkness/arm-workspace/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "/Users/howardharkness/arm-workspace/build/CMakeFiles/CMakeError.log".
[proc] The command: /opt/homebrew/bin/cmake --no-warn-unused-cli -DMBED_TARGET:STRING=MAX32620FTHR -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/opt/homebrew/bin/arm-none-eabi-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/opt/homebrew/bin/arm-none-eabi-g++ -S/Users/howardharkness/arm-workspace -B/Users/howardharkness/arm-workspace/build -G Ninja exited with code: 1 and signal: null
At this point, I was scratching my head wondering if I even need the UPLOAD_METHOD, and I can’t find anything like that in the MBed Studio directory. However, I tried leaving that out of the yaml file, and got the same errors.
I concluded that I need to have a set(PYOCD_UPLOAD_ENABLED TRUE) in one of my CMakeLists.txt files (assume the topmost). That appeared to work — the make configuration completed, and the build finished, but I was unable to copy the resulting Example.bin file to the FTHR board. There was an error dialog that said “The operation can’t be completed because an unexpected error occurred (error code -1407)” I googled that error message, but didn’t get any hits that made sense to me.
In addition to the Example.bin, I saw that VSCode built Example.elf and Example.hex, neither of which I recognize, and neither of which appears to be an executable. The hex file resembles stuff I worked with 35 years ago — is that something I can download to the FTHR with some translation tool?
So, how do I get past this? I just want to build a “Blinky” example using VSCode, and run it on the FTHR.