Skip to content

Commit

Permalink
Migrate to Mbed CE
Browse files Browse the repository at this point in the history
1.  Common change for migration to Mbed CE from Mbed CLI 1/2
    (1) Remove *.lib originally for library import. Replace with git submodule.
    (2) Rename mbed_app.json/mbed_lib.json to mbed_app.json5/mbed_lib.json5
    (3) Add/update CMakeLists.txt
    (4) Remove .mbedignore originally for Mbed CLI 1
    (5) Update document
2.  Support VS Code development
3.  Temporary fix to build profile inconsistent with mbed-lora library build
    See: mbed-ce/mbed-os#407
  • Loading branch information
ccli8 committed Dec 27, 2024
1 parent 62497c8 commit a42bc5b
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 179 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.build
.mbed
projectfiles
*.py*
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cmake.buildDirectory": "${workspaceFolder}/build",
"cmake.generator": "Ninja",
"cmake.configureOnOpen": false
}
69 changes: 69 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) 2022 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19)
cmake_policy(VERSION 3.19)

set(MBED_OS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")

# Set default path for mbed_app.json5 (no force-write for override)
set(MBED_APP_JSON_PATH mbed_app.json5 CACHE INTERNAL "")

# Set default path for custom_targets.json5 (no force-write for override)
set(CUSTOM_TARGETS_PATH custom_targets CACHE INTERNAL "")
set(CUSTOM_TARGETS_JSON_PATH ${CUSTOM_TARGETS_PATH}/custom_targets.json5 CACHE INTERNAL "")

# Load Mbed CE toolchain file and basic build system
include(${MBED_OS_PATH}/tools/cmake/app.cmake)

set(APP_PROJECT NUMAKER_MBED_CE_LORAWAN_EXAMPLE)
set(APP_TARGET NuMaker-mbed-ce-lorawan-example)

# Set up project name
project(${APP_PROJECT})

# Add Nuvoton CMake list files to CMake default module path
#
# Normally, this is added in ${MBED_OS_PATH}, but ${CUSTOM_TARGETS_PATH}
# is in front and needs it.
list(APPEND CMAKE_MODULE_PATH
${MBED_OS_PATH}/targets/TARGET_NUVOTON/scripts
)

# Add Mbed OS library
add_subdirectory(${MBED_OS_PATH})

# User-provided MBEDTLS_USER_CONFIG_FILE for mbedtls
target_include_directories(mbed-mbedtls
PUBLIC
.
)

add_executable(${APP_TARGET})

target_include_directories(${APP_TARGET}
PRIVATE
.
)

target_sources(${APP_TARGET}
PRIVATE
main.cpp
trace_helper.cpp
)

target_link_libraries(${APP_TARGET}
PRIVATE
mbed-os
mbed-lorawan
)

# Temporary fix to build profile inconsistent with mbed-lora library build.
# See: https://github.com/mbed-ce/mbed-os/issues/407
target_link_libraries(mbed-lorawan PUBLIC mbed-rtos-flags)

# Must call this for each target to set up bin file creation, code upload, etc
mbed_set_post_build(${APP_TARGET})

# Make sure this is the last line of the top-level build script
mbed_finalize_build()
158 changes: 0 additions & 158 deletions Jenkinsfile

This file was deleted.

73 changes: 73 additions & 0 deletions cmake-variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
buildType:
default: Develop
choices:
Develop:
short: Develop
long: Emit debug information but also optimize
buildType: Develop
Debug:
short: Debug
long: Emit debug information and don't optimize
buildType: Debug
Release:
short: Release
long: Optimize generated code
buildType: Release
board:
default: NUMAKER_IOT_M467
choices:
NUMAKER_PFM_NANO130:
short: NUMAKER_PFM_NANO130
settings:
MBED_TARGET: NUMAKER_PFM_NANO130
UPLOAD_METHOD: OPENOCD
NUMAKER_PFM_NUC472:
short: NUMAKER_PFM_NUC472
settings:
MBED_TARGET: NUMAKER_PFM_NUC472
UPLOAD_METHOD: OPENOCD
NUMAKER_PFM_M453:
short: NUMAKER_PFM_M453
settings:
MBED_TARGET: NUMAKER_PFM_M453
UPLOAD_METHOD: OPENOCD
NUMAKER_PFM_M487:
short: NUMAKER_PFM_M487
settings:
MBED_TARGET: NUMAKER_PFM_M487
UPLOAD_METHOD: OPENOCD
NUMAKER_IOT_M487:
short: NUMAKER_IOT_M487
settings:
MBED_TARGET: NUMAKER_IOT_M487
UPLOAD_METHOD: OPENOCD
NUMAKER_M483KG:
short: NUMAKER_M483KG
settings:
MBED_TARGET: NUMAKER_M483KG
UPLOAD_METHOD: OPENOCD
NUMAKER_IOT_M467:
short: NUMAKER_IOT_M467
settings:
MBED_TARGET: NUMAKER_IOT_M467
UPLOAD_METHOD: OPENOCD
NUMAKER_IOT_M252:
short: NUMAKER_IOT_M252
settings:
MBED_TARGET: NUMAKER_IOT_M252
UPLOAD_METHOD: OPENOCD
NUMAKER_IOT_M263A:
short: NUMAKER_IOT_M263A
settings:
MBED_TARGET: NUMAKER_IOT_M263A
UPLOAD_METHOD: OPENOCD
NU_M2354:
short: NU_M2354
settings:
MBED_TARGET: NU_M2354
UPLOAD_METHOD: OPENOCD
NU_IOT_M2354:
short: NU_IOT_M2354
settings:
MBED_TARGET: NU_IOT_M2354
UPLOAD_METHOD: OPENOCD
1 change: 0 additions & 1 deletion mbed-os.lib

This file was deleted.

20 changes: 0 additions & 20 deletions mbed_app.json → mbed_app.json5
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,6 @@
"lora-ant-switch": "NC",
"lora-pwr-amp-ctl": "NC",
"lora-tcxo": "NC"
},
"K64F": {
"lora-spi-mosi": "D11",
"lora-spi-miso": "D12",
"lora-spi-sclk": "D13",
"lora-cs": "D10",
"lora-reset": "A0",
"lora-dio0": "D2",
"lora-dio1": "D3",
"lora-dio2": "D4",
"lora-dio3": "D5",
"lora-dio4": "D8",
"lora-dio5": "D9",
"lora-rf-switch-ctl1": "NC",
"lora-rf-switch-ctl2": "NC",
"lora-txctl": "NC",
"lora-rxctl": "NC",
"lora-ant-switch": "A4",
"lora-pwr-amp-ctl": "NC",
"lora-tcxo": "NC"
}
},
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_lora_config.h\""]
Expand Down

0 comments on commit a42bc5b

Please sign in to comment.