diff --git a/CMakeLists.txt b/CMakeLists.txt index 72c9f83..449097b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,28 +3,28 @@ cmake_policy(VERSION 3.19) #### Initialize Mbed OS build system. #### ###################################################################################################### -### Block of including .json files. Files of this block must be included before the app.cmake +### Block of including .json5 files. Files of this block must be included before the app.cmake -#[[ Set path of mbed_app.json (necessary everytime if mbed_app.json is in project) ]] +#[[ Set path of mbed_app.json (necessary everytime if mbed_app.json5 is in project) ]] set(MBED_APP_JSON_PATH mbed_app.json5) ###--------------------------------------------------------------------------------------------------- -#[[ This part is intended to custom targets and activates the custom_targets.json +#[[ This part is intended to custom targets5 and activates the custom_targets.json5 and upload method config otherwise functions below should be commented ]] -#[[ Here set path for custom_targets.json (this is our default) ]] +#[[ Here set path for custom_targets.json5 (this is our default) ]] set(CUSTOM_TARGETS_JSON_PATH custom_targets/custom_targets.json5) - #[[ Note: For custom target you need also an upload method and we have few options how you can do that +#[[ Here you can set path for custom upload config .cmake (optional example) ]] +# set(CUSTOM_UPLOAD_CFG_PATH ${CMAKE_SOURCE_DIR}/${MBED_TARGET}/${MBED_TARGET}.cmake) + +#[[ Note: For custom target you need also an upload method and we have few options how you can do that - use the variable CUSTOM_UPLOAD_CFG_PATH below - use default expected path for custom targets upload methods where you create your own config MY_PROJECT/custom_targets/upload_method_cfg + - of course you can do it by your self dierectly via cmake in this file - For regular targets we have note you an check for an insperation - https://github.com/mbed-ce/mbed-os/tree/master/targets/upload_method_cfg ]] - -#[[ Here you can set path for custom upload config .cmake (optional example) ]] -# set(CUSTOM_UPLOAD_CFG_PATH ${CMAKE_SOURCE_DIR}/${MBED_TARGET}/${MBED_TARGET}.cmake) + For regular targets we use mbed-os/tree/master/targets/upload_method_cfg ]] ### End of block ###################################################################################################### @@ -59,9 +59,7 @@ add_executable(main main.cpp) ###################################################################################################### ### Link libraries block - -#[[For more about this configuraion visit wiki page -https://github.com/mbed-ce/mbed-os/wiki/MbedOS-configuration#configuration-via-cmake-files]] +#[[For more about this configuraion visit wiki page MbedOS-configuration ]] #[[link MbedOS and its libraries (necessary everytime)]] target_link_libraries(main mbed-os) diff --git a/README.md b/README.md index 99b9dca..017aab4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Mbed CE Custom Targets Example -This project shows how to use Mbed OS Community Edition to create custom targets. +This project shows how to use Mbed OS Community Edition to create custom targets and also defines the standard structure of custom target project from Mbed CE perspective. This repo includes three different custom targets you can use based on the `NUCLEO_L452RE_P` target. (No real reason it's this target in particular, it's just a board I happen to use). @@ -10,9 +10,11 @@ This repo includes three different custom targets you can use based on the `NUCL ## How to set up this project: -1. Clone it to your machine. Don't forget to use `--recursive` to clone the submodules: `git clone --recursive https://github.com/mbed-ce/mbed-ce-custom-targets.git` +1. Clone it to your machine. Don't forget to use `--recursive` to clone the submodules: `git clone --recursive https://github.com/mbed-ce/mbed-ce-custom-targets.git`and update MbedOS with `git submodule update --remote mbed-os` (call it in project folder) 2. Set up the GNU ARM toolchain (and other programs) on your machine using [the toolchain setup guide](https://github.com/mbed-ce/mbed-os/wiki/Toolchain-Setup-Guide). -3. Set up the CMake project for editing. Use one of the target names listed above. We have three ways to do this: +3. Set up the CMake project for editing. We have three ways to do this: - On the [command line](https://github.com/mbed-ce/mbed-os/wiki/Project-Setup:-Command-Line) - Using the [CLion IDE](https://github.com/mbed-ce/mbed-os/wiki/Project-Setup:-CLion) - Using the [VS Code IDE](https://github.com/mbed-ce/mbed-os/wiki/Project-Setup:-VS-Code) +4. Use one of the target names listed above and choose an [upload method](https://github.com/mbed-ce/mbed-os/wiki/Upload-Methods) according to your requirments. Default settings is target L452RE_SIMPLE and upload method STM32CUBE. + diff --git a/cmake-variants.yaml b/cmake-variants.yaml index 8cf8f71..e93f8ff 100644 --- a/cmake-variants.yaml +++ b/cmake-variants.yaml @@ -14,10 +14,14 @@ buildType: long: Optimize generated code buildType: Release board: - default: L452RE_CUSTOM_PINMAP + # Fill name of your targer which has to corespond to + # target name in custom_targets.json5 file + default: L452RE_SIMPLE choices: YOUR_MBED_TARGET: - short: L452RE_CUSTOM_PINMAP + short: L452RE_SIMPLE settings: - MBED_TARGET: L452RE_CUSTOM_PINMAP ## One name of targer in custom_targets.json5 file - UPLOAD_METHOD: STM32CUBE ## NONE, MBED, STLINK, JLINK, PYOCD, OPENOCD, STM32CUBE \ No newline at end of file + MBED_TARGET: L452RE_SIMPLE + # Fill your upload method + # variants are: NONE, MBED, STLINK, JLINK, PYOCD, OPENOCD, STM32CUBE + UPLOAD_METHOD: STM32CUBE \ No newline at end of file