You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2021/02/20 17:24:43 UTC
[mynewt-core] branch master updated: apps/rust_blinky: use cargo
release profile when mynewt build profile is not debug
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new a2161f0 apps/rust_blinky: use cargo release profile when mynewt build profile is not debug
new 5651eab Merge pull request #2493 from stuffmatic/rust-blinky-build-profile-fix
a2161f0 is described below
commit a2161f059d7cd72d2d538914cac21368b9c7ffa2
Author: Per <pe...@stuffmatic.com>
AuthorDate: Sat Feb 20 13:49:26 2021 +0100
apps/rust_blinky: use cargo release profile when mynewt build profile is not debug
---
apps/rust_blinky/cargo_build.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/apps/rust_blinky/cargo_build.sh b/apps/rust_blinky/cargo_build.sh
index 2ae27a8..230d59a 100755
--- a/apps/rust_blinky/cargo_build.sh
+++ b/apps/rust_blinky/cargo_build.sh
@@ -17,6 +17,7 @@ set -eu
# limitations under the License.
#
+# Map mynewt architecture to cargo target
if [[ ${MYNEWT_VAL_ARCH_NAME} == '"cortex_m0"' ]]; then
TARGET="thumbv6m-none-eabi"
elif [[ ${MYNEWT_VAL_ARCH_NAME} == '"cortex_m3"' ]]; then
@@ -32,5 +33,16 @@ else
exit 1
fi
-cargo build --target="${TARGET}" --target-dir="${MYNEWT_PKG_BIN_DIR}"
-cp "${MYNEWT_PKG_BIN_DIR}"/${TARGET}/debug/*.a "${MYNEWT_PKG_BIN_ARCHIVE}"
+# Map mynewt build profile to cargo build profile
+if [[ ${MYNEWT_BUILD_PROFILE} == 'debug' ]]; then
+ # mynewt debug profile -> cargo debug profile
+ CARGO_PROFILE="debug"
+ CARGO_ARGS=""
+else
+ # all other mynewt profiles -> cargo release profile
+ CARGO_PROFILE="release"
+ CARGO_ARGS="--release"
+fi
+
+cargo build --target="${TARGET}" --target-dir="${MYNEWT_PKG_BIN_DIR}" ${CARGO_ARGS}
+cp "${MYNEWT_PKG_BIN_DIR}"/${TARGET}/${CARGO_PROFILE}/*.a "${MYNEWT_PKG_BIN_ARCHIVE}"