Skip to content

Commit 1471366

Browse files
committed
Remove creating symlinks to Mbed OS , Mbed OS posix socket from build script
Improve examples CMakeLists files - use env variable to Mbed OS , Mbed OS posix socket and ISM43362 Wi-Fi
1 parent 594a3c8 commit 1471366

File tree

3 files changed

+37
-41
lines changed

3 files changed

+37
-41
lines changed

examples/lighting-app/mbed/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ configure_file(
1414
@ONLY
1515
)
1616

17-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
17+
set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
1818
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1919
set(APP_TARGET chip-mbed-lighting-app-example)
2020

2121
include(${MBED_PATH}/tools/cmake/app.cmake)
2222
add_subdirectory(${MBED_PATH} ./mbed_build)
2323

24-
add_subdirectory(mbed-os-posix-socket)
24+
add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build)
2525

2626
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
27-
add_subdirectory(wifi-ism43362)
27+
add_subdirectory($ENV{WIFI_ISM43362_PATH} ./wifi_ism43362_build)
2828
endif()
2929

3030
add_executable(${APP_TARGET})

examples/lock-app/mbed/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ configure_file(
1414
@ONLY
1515
)
1616

17-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
18-
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
17+
#set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
18+
#set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1919
set(APP_TARGET chip-mbed-lock-app-example)
2020

2121
include(${MBED_PATH}/tools/cmake/app.cmake)
2222
add_subdirectory(${MBED_PATH} ./mbed_build)
2323

24-
add_subdirectory(mbed-os-posix-socket)
24+
add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build)
2525

2626
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
27-
add_subdirectory(wifi-ism43362)
27+
add_subdirectory($ENV{WIFI_ISM43362_PATH} ./wifi_ism43362_build)
2828
endif()
2929

3030
add_executable(${APP_TARGET})

scripts/examples/mbed_example.sh

+30-34
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,29 @@ PROFILE=release
3434

3535
for i in "$@"; do
3636
case $i in
37-
-a=* | --app=*)
38-
APP="${i#*=}"
39-
shift
40-
;;
41-
-b=* | --board=*)
42-
TARGET_BOARD="${i#*=}"
43-
shift
44-
;;
45-
-t=* | --toolchain=*)
46-
TOOLCHAIN="${i#*=}"
47-
shift
48-
;;
49-
-p=* | --profile=*)
50-
PROFILE="${i#*=}"
51-
shift
52-
;;
53-
-c=* | --command=*)
54-
COMMAND="${i#*=}"
55-
shift
56-
;;
57-
*)
58-
# unknown option
59-
;;
37+
-a=* | --app=*)
38+
APP="${i#*=}"
39+
shift
40+
;;
41+
-b=* | --board=*)
42+
TARGET_BOARD="${i#*=}"
43+
shift
44+
;;
45+
-t=* | --toolchain=*)
46+
TOOLCHAIN="${i#*=}"
47+
shift
48+
;;
49+
-p=* | --profile=*)
50+
PROFILE="${i#*=}"
51+
shift
52+
;;
53+
-c=* | --command=*)
54+
COMMAND="${i#*=}"
55+
shift
56+
;;
57+
*)
58+
# unknown option
59+
;;
6060
esac
6161
done
6262

@@ -100,26 +100,22 @@ if [[ "$COMMAND" == *"build"* ]]; then
100100
# Config directory setup
101101
MBED_CONFIG_PATH="$APP"/mbed/cmake_build/"$TARGET_BOARD"/develop/"$TOOLCHAIN"/
102102

103-
# Override Mbed OS path to development directory
104-
MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo
103+
# Set Mbed OS path
104+
export MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo
105105

106-
# Create symlinks to mbed-os submodule
107-
ln -sfTr "$MBED_OS_PATH" "$APP/mbed/mbed-os"
108-
109-
# Create symlinks to mbed-os-posix-socket submodule
110-
MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo
111-
ln -sfTr "$MBED_OS_POSIX_SOCKET_PATH" "$APP/mbed/mbed-os-posix-socket"
106+
# Set Mbed OS posix socket submodule path
107+
export MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo
112108

113109
if [ "$TARGET_BOARD" == "DISCO_L475VG_IOT01A" ]; then
114-
# Add the Mbed OS driver for the ISM43362 Wi-Fi module
115-
WIFI_ISM43362_PATH="$CHIP_ROOT"/third_party/wifi-ism43362/repo
110+
# Set ISM43362 Wi-Fi submodule path
111+
export WIFI_ISM43362_PATH="$CHIP_ROOT"/third_party/wifi-ism43362/repo
116112

117113
# Create symlinks to WIFI-ISM43362 submodule
118114
ln -sfTr "$WIFI_ISM43362_PATH" "$APP/mbed/wifi-ism43362"
119115
fi
120116

121117
# Generate config file for selected target, toolchain and hardware
122-
mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -p "$APP"/mbed/
118+
mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -p "$APP"/mbed/ --mbed-os-path "$MBED_OS_PATH"
123119

124120
# Remove old artifacts to force linking
125121
rm -rf "$BUILD_DIRECTORY/chip-"*

0 commit comments

Comments
 (0)