commit ebce09f00cb7c18fa48a95692b2ca692e84f9c42 Author: Yilin Sun Date: Thu Dec 8 12:09:44 2022 +0800 Initial commit. Signed-off-by: Yilin Sun diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..64d528d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.mbedbuild +cmake_build/ +cmake-build-* +mbed-os diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..da9aca2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (c) 2022 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_BINARY_DIR} CACHE INTERNAL "") +set(APP_TARGET hello_world) + +include(${MBED_PATH}/tools/cmake/app.cmake) + +project(${APP_TARGET}) + +add_subdirectory(${MBED_PATH}) + +add_executable(${APP_TARGET} + main.cpp +) + +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() \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..47d561f --- /dev/null +++ b/main.cpp @@ -0,0 +1,20 @@ +/* mbed Microcontroller Library + * Copyright (c) 2022 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" + +int main() +{ + printf("Hello, Mbed!\n"); + + DigitalOut led(GPIO_AD_B0_00); + + for(;;) { + led = !led; + ThisThread::sleep_for(500ms); + } + + return 0; +} \ No newline at end of file diff --git a/mbed-os.lib b/mbed-os.lib new file mode 100644 index 0000000..7ee06b3 --- /dev/null +++ b/mbed-os.lib @@ -0,0 +1 @@ +https://github.com/imi415/mbed-os#imxrt_ldscript_syntax diff --git a/mbed_app.json b/mbed_app.json new file mode 100644 index 0000000..4c04807 --- /dev/null +++ b/mbed_app.json @@ -0,0 +1,7 @@ +{ + "target_overrides": { + "K64F": { + "platform.stdio-baud-rate": 9600 + } + } +} \ No newline at end of file