I’m on Linux, using VS Code, PlatformIO, and the latest version of mbed. I’ve got basic compilation/uploading working, but I can’t seem to get rtos working.
I need to #include “rtos/rtos.h”
in order that
ThisThread::sleep_for(500);
is found.
I’m not sure if I’m supposed to include the include line or not. When I try to build, the compilation fails with
undefined reference to `rtos::ThisThread::sleep_for(unsigned long)’
I presume I need to add some kind of configuration option to some json or ini file. What do I need to do?
but it didn’t help. The sources do exist. It just doesn’t seem to want to compile them.
Undoubtedly it’s simple to fix, if only I knew what that something was. As a newbie to all this, there’s so many unfathomable layers of complexity, with build tools, directories and configuration files all over the place.
I did notice some output:
Library Manager: Installing rtos/source
Warning! Could not find the package with 'rtos/source' requirements for your system 'linux_x86_64'
Found 5 compatible libraries
I am using mbed with platformio with no problem. By default it comes with mbed-os 6.2. I do not have lib_deps or lib_extra_dirs in my platformio.ini files.
It looks like you are using the baremetal version of mbed-os to me. What’s the content of the mbed-app.json? (and what do you mean by “latest version of mbed” in the context of platformio? )
Can you compile any of the platformio’s mbed-os example? (especially this one?
PACKAGES:
- framework-mbed 6.51504.200716 (5.15.4)
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
mbed build API internal error
Attempt to override undefined parameter 'platform.callback-nontrivial' in 'application[*]'
Also, if I go back to my original project, and edit the file mbed_app.json to remove the “requires” entry, I still get the same compilation error as before. Maybe there’s a stale build environment somehow (??).
Hmm. For a minute there I thought I had cracked it, but it appears not to be.
I guess I don’t actually need threading at this stage. I did spot an interesting async library online which looks interesting if I wanted to go down the concurrency route.
Still, it’s disappointing that mbed’s threading doesn’t seem to build for mcu. It’s difficult to ascertain what the problem is: a configuration problem, board incompatibility, or something else.
It’s difficult to give answers to some of these questions, as a lot of it was set up automagically by PlatformIO.
I don’t have a NUCLEO_F103RB itself. BUT, looking at mbed online, selecting NUCLEO_F103RB seems to be compatible with the STM32 blue pill (although I don’t know the full extent of compatibility)
I tried mbed online using ThisThread and NUCLEO_F103RB. When I uploaded the binary to my blue pill, it worked as expected.
I’ll tinker around and see if I can cajole PlatformIO to compile on mbed 6. Then I should be able to compile for NUCLEO_F103RB and have it work on the blue pill.