From dfcacc2d3837054a61e1eaf3cd6530aa74a0245f Mon Sep 17 00:00:00 2001 From: James Date: Fri, 1 Sep 2023 22:26:37 -0500 Subject: [PATCH] Create basic mbed project --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ mbed-os.lib | 1 + mbed_app.json | 8 ++++++++ testRunner.cpp | 6 ++++++ 4 files changed, 45 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 mbed-os.lib create mode 100644 mbed_app.json create mode 100644 testRunner.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..785405e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) + +set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") +set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") +set(APP_TARGET embedded-mbed) + +include(${MBED_PATH}/tools/cmake/app.cmake) + +project(${APP_TARGET}) + +add_subdirectory(${MBED_PATH}) + +add_executable(${APP_TARGET} testRunner.cpp) + +target_sources(${APP_TARGET} + PRIVATE + testRunner.cpp +) + +target_link_libraries(${APP_TARGET} + PRIVATE + 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() diff --git a/mbed-os.lib b/mbed-os.lib new file mode 100644 index 0000000..144619b --- /dev/null +++ b/mbed-os.lib @@ -0,0 +1 @@ +https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed diff --git a/mbed_app.json b/mbed_app.json new file mode 100644 index 0000000..14ca336 --- /dev/null +++ b/mbed_app.json @@ -0,0 +1,8 @@ +{ + "target_overrides": { + "*": { + "target.printf_lib": "std", + "target.c_lib": "small" + } + } +} diff --git a/testRunner.cpp b/testRunner.cpp new file mode 100644 index 0000000..3227510 --- /dev/null +++ b/testRunner.cpp @@ -0,0 +1,6 @@ +#include "mbed.h" + +int main() +{ + printf("Hello World!\n"); +}