November 19, 2020

STM32 Microcontrollers - Mbed - my first project

So I have the mbed cli installed on my linux system, I can launch the mbed and mbed-cli commands, and have (somewhat to my chagrin) installed mercurial. I try the Youtube tutorial and the first issue I hit is:
mbed import https://developer/mbed.org/users/mbed-demo/code/mbed_blinky
[mbed] Working path "/u1/Projects/STM32/mbed" (directory)
[mbed] Importing program "mbed_blinky" from "https://developer/mbed.org/users/mbed-demo/code/mbed_blinky" at latest revision in the current branch
[mbed] ERROR: Unable to clone repository (https://developer/mbed.org/users/mbed-demo/code/mbed_blinky)
So, it looks like whatever it wants to clone has vanished from their tutorial. In fact before I installed mercurial, it gave me the following error which yields extra information:
"hg clone --config progress.assume-tty=true https://developer/mbed.org/users/mbed-demo/code/mbed_blinky /u1/Projects/STM32/mbed/mbed_blinky" in "/u1/Projects/STM32/mbed".
The video tutorial is dated 2016 and when I navigate to this URL using a browser, I do find something. It is labeled ast "Mbed 2, "deprecated"" -- so it seems like using the cli is very much the "path least traveled". There are a variety of buttons saying import, export, build, ... that would seem to be in some way integrated into their studio (perhaps). They all want me to log in, but I have yet to set up an Mbed login. However there is a link to download the repository as a zip file, and that seems to work. Then I do this:
cd mbed
mkdir first
cd first
mv /home/tom/mbed_blinky-363f52776e64.zip .
unzip mbed_blinky-363f52776e64.zip
cd mbed_blinky-363f52776e64
This gives me a directory with main.cpp and mbed.bld Now I try "mbed detect" and get the following error:
The mbed-os tools were not found in "/u1/Projects/STM32/mbed/first/mbed_blinky-363f52776e64"
So, the quickstart video is out of date and basically useless. Note that nothing so far says anything at all about what hardware I might want to be using or how to set it up.

Forget the quickstart video

They say that the way to start a new project is:
mbed new first
This goes away at length with the following messages:
mbed new first
[mbed] Working path "/u1/Projects/STM32" (directory)
[mbed] Creating new program "first" (git)
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at branch/tag "latest"
[mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#8ef0a435b2356f8159dea8e427b2935d177309f8"
[mbed] Auto-installing missing Python modules (jsonschema, mbed_cloud_sdk, jinja2, mbed_ls, mbed_host_tests, mbed_greentea, pyelftools, manifest_tool, icetea, pycryptodome, pyusb, cmsis_pack_manager, psutil, cbor)...
It does finish (after maybe 2 minutes). And it does seem to have downloaded everything but the kitchen sink in the "mbed-os" directory.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org