Closed tdjastrzebski closed 3 years ago
the issue is not with pthread, the error is cmake related, as written in your message:
CMake Error at CMakeLists.txt:20 (mbed_set_mbed_target_linker_script):
Unknown CMake command "mbed_set_mbed_target_linker_script".
mbed_set_mbed_target_linker_script
was removed in commit 0f733baeae5a8d4cd0214835d2520db38c5988ff in February.
Thank you @ladislas. Does it mean this tool is currently broken?
No it means the example CMakeLists.txt you're using is out of date.
Try the blinky example: https://github.com/ARMmbed/mbed-os-example-blinky
Well, this example has been created with this tool by executing mbed-tools new .
, it contains nothing but simple main.cpp and CMakeLists.txt files. That makes me believe the problem is somewhere in the tool itself.
/* mbed Microcontroller Library
* Copyright (c) 2021 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
int main()
{
printf("Hello, Mbed!\n");
return 0;
}
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.19.0)
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
set(APP_TARGET )
include(${MBED_PATH}/tools/cmake/app.cmake)
add_subdirectory(${MBED_PATH})
add_executable(${APP_TARGET}
main.cpp
)
mbed_configure_app_target(${APP_TARGET})
mbed_set_mbed_target_linker_script(${APP_TARGET})
project(${APP_TARGET})
target_link_libraries(${APP_TARGET} mbed-os)
mbed_set_post_build(${APP_TARGET})
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
You need to compare the two CMakeLists.txt, look at this one: https://github.com/ARMmbed/mbed-os-example-blinky/blob/master/CMakeLists.txt
As you can see yours is using mbed_set_mbed_target_linker_script
while the blinky example is not.
If there is something wrong with the tool it's with the new
command templates. Try using the blinky example cmake file.
Actually nothing is wrong, I've just tried the tools and it works perfectly. The CMakeLists.txt is the right one and it compiles correctly. Try running:
python3 -m pip install -U --user mbed-tools
with or without --user
depending on how you installed it.
I updated mbed-tools, started once again from scratch and this time it worked. I have to say I am puzzled since I already had the latest version 7.32. Definitely CMakeLists.txt was broken.
It does not compile with "requires": ["bare-metal"]
in mbed_app.json but maybe this option is no longer available. Anyway, it is a different problem. Thank you.
Should this be closed as resolved? I'll close it now
Baremetal is available via mbed-baremetal
CMake target
Today I attempted to use new mbed-tool for the first time ever. I tried the most trivial test I could think of.
mbed-tools version 7.32.0 Probably pthreads is missing.