mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
build: Fixes for cross-compilation. (#1527)
This commit includes two changes:
* Removes existing `AC_NO_EXECUTABLES` from `configure.ac`, since it
is a hack only intended to be used by the GCC project.
* Adds a new configure argument: `--enable-no-executables-hack`,
which restores `AC_NO_EXECUTABLES` for broken build environemnts
which require it.
* Removes `--target` from example makefiles, since it is only
appropriate when compiling compilers.
As a side effect of the second change, cross compiling with the
makefiles now no longer causes the `arm-none-eabi-` prefix to be
prepended to all built executables. This change updates all of the
documentation accordingly.
This commit is contained in:
committed by
Jonathan Hui
parent
2fa7a13c1b
commit
812cc838eb
+28
-28
@@ -54,35 +54,35 @@ set -x
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-nrf52840 || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
make -f examples/Makefile-cc2650 || die
|
||||
arm-none-eabi-size output/cc2650/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
|
||||
}
|
||||
|
||||
[ $BUILD_TARGET != arm-gcc54 ] || {
|
||||
@@ -92,35 +92,35 @@ set -x
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-nrf52840 || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-cli-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
|
||||
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
|
||||
|
||||
git checkout -- . || die
|
||||
git clean -xfd || die
|
||||
./bootstrap || die
|
||||
make -f examples/Makefile-cc2650 || die
|
||||
arm-none-eabi-size output/cc2650/bin/arm-none-eabi-ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/arm-none-eabi-ot-ncp-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
|
||||
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
|
||||
}
|
||||
|
||||
[ $BUILD_TARGET != posix ] || {
|
||||
|
||||
+19
-16
@@ -88,11 +88,10 @@ AC_CONFIG_MACRO_DIR([third_party/nlbuild-autotools/repo/autoconf/m4])
|
||||
AC_CONFIG_HEADERS([include/openthread-config.h])
|
||||
|
||||
#
|
||||
# Figure out what the canonical build, host and target tuples are.
|
||||
# Figure out what the canonical build and host tuples are.
|
||||
#
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
#
|
||||
# Mac OS X / Darwin ends up putting some versioning cruft on the end of its
|
||||
@@ -102,7 +101,6 @@ AC_CANONICAL_TARGET
|
||||
|
||||
NL_FILTERED_CANONICAL_BUILD
|
||||
NL_FILTERED_CANONICAL_HOST
|
||||
NL_FILTERED_CANONICAL_TARGET
|
||||
|
||||
#
|
||||
# Configure automake with the desired options, indicating that this is not
|
||||
@@ -132,10 +130,10 @@ AM_SILENT_RULES([yes])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
#
|
||||
# Check for target
|
||||
# Host-os-specific checks
|
||||
#
|
||||
|
||||
case ${target_os} in
|
||||
case ${host_os} in
|
||||
|
||||
*darwin*)
|
||||
OPENTHREAD_TARGET=darwin
|
||||
@@ -161,16 +159,22 @@ AC_SUBST(OPENTHREAD_TARGET_DEFINES)
|
||||
# Checks for build host programs
|
||||
#
|
||||
|
||||
# If we are cross-compiling and we are on an embedded target that
|
||||
# doesn't support independent, standalone executables, then all
|
||||
# compiler tests that attempt to create an executable will fail. In
|
||||
# such circumstances, set AC_NO_EXECUTABLES (see http://sourceware.org/
|
||||
# ml/newlib/2006/msg00353.html).
|
||||
|
||||
# This is a hack to restore some old broken behavior that was
|
||||
# removed in pull request #1527. It's use is highly discouraged,
|
||||
# you should try to fix your build environment instead.
|
||||
AC_ARG_ENABLE(no-executables-hack,
|
||||
[AS_HELP_STRING([--enable-no-executables-hack],
|
||||
[Enable hack that prevents link checks at configure time. Highly discouraged.])])
|
||||
AC_MSG_CHECKING([whether to disable executable checking])
|
||||
if test "$cross_compiling" = yes; then
|
||||
AC_NO_EXECUTABLES
|
||||
if test "${enable_no_executables_hack}" = "yes"
|
||||
then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_NO_EXECUTABLES
|
||||
# Here we guess conservative values for tests that require link checks
|
||||
# to test for these features. This will prevent these checks from
|
||||
# being performed later in the configuration process.
|
||||
ac_cv_func_strlcat=${ac_cv_func_strlcat-no}
|
||||
ac_cv_func_strlcpy=${ac_cv_func_strlcpy-no}
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@@ -1114,9 +1118,8 @@ AC_MSG_NOTICE([
|
||||
Interface : ${LIBOPENTHREAD_VERSION_INFO//:/.}
|
||||
Build system : ${build}
|
||||
Host system : ${host}
|
||||
Target system : ${target}
|
||||
Target architecture : ${target_cpu}
|
||||
Target OS : ${target_os}
|
||||
Host architecture : ${host_cpu}
|
||||
Host OS : ${host_os}
|
||||
Cross compiling : ${cross_compiling}
|
||||
Build shared libraries : ${enable_shared}
|
||||
Build static libraries : ${enable_static}
|
||||
|
||||
@@ -154,7 +154,6 @@ $(ECHO) " CONFIG $(TargetTuple)..."
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--target=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
$(configure_OPTIONS))
|
||||
|
||||
@@ -143,7 +143,6 @@ $(ECHO) " CONFIG $(TargetTuple)..."
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--target=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
$(configure_OPTIONS))
|
||||
|
||||
@@ -153,7 +153,6 @@ $(ECHO) " CONFIG $(TargetTuple)..."
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--target=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
$(configure_OPTIONS))
|
||||
|
||||
@@ -207,7 +207,6 @@ $(ECHO) " CONFIG $(TargetTuple)..."
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--target=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
$(configure_OPTIONS))
|
||||
|
||||
@@ -23,4 +23,4 @@ The server listens to the clients.
|
||||
|
||||
The client sends a message to the server and the server echos that message back to the client.
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -28,7 +28,7 @@ After a successful build, the `elf` files are found in
|
||||
`<path-to-openthread>/output/cc2538/bin`. You can convert them to `bin`
|
||||
files using `arm-none-eabi-objcopy`:
|
||||
```bash
|
||||
$ arm-none-eabi-objcopy -O binary arm-none-eabi-ot-cli-ftd arm-none-eabi-ot-cli-ftd.bin
|
||||
$ arm-none-eabi-objcopy -O binary ot-cli-ftd ot-cli-ftd.bin
|
||||
```
|
||||
|
||||
## Flash Binaries
|
||||
|
||||
@@ -67,14 +67,14 @@ To flash the images with [Flash Programmer 2][ti-flash-programmer-2], the files
|
||||
must have the `*.elf` extension.
|
||||
```bash
|
||||
$ cd <path-to-openthread>/output/cc2650/bin
|
||||
$ cp arm-none-eabi-ot-cli arm-none-eabi-ot-cli.elf
|
||||
$ cp ot-cli ot-cli.elf
|
||||
```
|
||||
|
||||
To load the images with the [serial bootloader][ti-cc2650-bootloader], the
|
||||
images must be converted to `bin`. This is done using `arm-none-eabi-objcopy`
|
||||
```bash
|
||||
$ cd <path-to-openthread>/output/cc2650/bin
|
||||
$ arm-none-eabi-objcopy -O binary arm-none-eabi-ot-cli arm-none-eabi-ot-cli.bin
|
||||
$ arm-none-eabi-objcopy -O binary ot-cli ot-cli.bin
|
||||
```
|
||||
The [cc2538-bsl.py script][cc2538-bsl-tool] provides a convenient method
|
||||
for flashing a CC2650 via the UART.
|
||||
|
||||
@@ -38,7 +38,7 @@ Flash Binaries:
|
||||
2. Return to previous terminal window and execute a command in order to flash the board:
|
||||
|
||||
```bash
|
||||
$ ./cli_programmer gdbserver write_qspi_exec ../../../output/da15000/bin/arm-none-eabi-ot-cli-ftd.bin
|
||||
$ ./cli_programmer gdbserver write_qspi_exec ../../../output/da15000/bin/ot-cli-ftd.bin
|
||||
```
|
||||
|
||||
## Interact:
|
||||
|
||||
@@ -26,7 +26,7 @@ After a successful build, the `elf` files can be found in
|
||||
`<path-to-openthread>/output/nrf52840/bin`. You can convert them to `hex`
|
||||
files using `arm-none-eabi-objcopy`:
|
||||
```bash
|
||||
$ arm-none-eabi-objcopy -O ihex arm-none-eabi-ot-cli-ftd arm-none-eabi-ot-cli-ftd.hex
|
||||
$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
|
||||
```
|
||||
|
||||
## Flashing the binaries
|
||||
@@ -37,7 +37,7 @@ part of the [nRF5x Command Line Tools][nRF5x-Command-Line-Tools].
|
||||
[nRF5x-Command-Line-Tools]: https://www.nordicsemi.com/eng/Products/nRF52840#Downloads
|
||||
|
||||
```bash
|
||||
$ nrfjprog -f nrf52 --chiperase --program output/nrf52840/bin/arm-none-eabi-ot-cli-ftd.hex
|
||||
$ nrfjprog -f nrf52 --chiperase --program output/nrf52840/bin/ot-cli-ftd.hex
|
||||
$ nrfjprog -f nrf52 -r
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user