[build] rename example platform POSIX to simulation (#4555)

Having examples/posix and src/core/posix is confusing. This commit
renames the examples posix platform to simulation.
This commit is contained in:
Yakun Xu
2020-02-28 04:55:56 +08:00
committed by GitHub
parent fb16fd44d7
commit a551133493
48 changed files with 205 additions and 205 deletions
+11 -11
View File
@@ -94,23 +94,23 @@ jobs:
- env: BUILD_TARGET="gn-build" VERBOSE=1
os: linux
script: .travis/script.sh
- env: BUILD_TARGET="posix-distcheck" VERBOSE=1 VIRTUAL_TIME=1
- env: BUILD_TARGET="simulation-distcheck" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: clang
script: .travis/script.sh
- env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1
- env: BUILD_TARGET="simulation-32-bit" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
script: .travis/script.sh
- env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1 TIME_SYNC=1
- env: BUILD_TARGET="simulation-32-bit" VERBOSE=1 VIRTUAL_TIME=1 TIME_SYNC=1
os: linux
compiler: gcc
script: .travis/script.sh
- env: BUILD_TARGET="posix-ncp" VERBOSE=1 VIRTUAL_TIME=1
- env: BUILD_TARGET="simulation-ncp" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
script: .travis/script.sh
- env: BUILD_TARGET="posix-mtd" VERBOSE=1 VIRTUAL_TIME=1
- env: BUILD_TARGET="simulation-mtd" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
script: .travis/script.sh
@@ -144,7 +144,7 @@ jobs:
os: linux
compiler: gcc
script: .travis/script.sh
- env: BUILD_TARGET="posix" CC="gcc-5" CXX="g++-5"
- env: BUILD_TARGET="simulation" CC="gcc-5" CXX="g++-5"
os: linux
compiler: gcc
addons:
@@ -153,7 +153,7 @@ jobs:
- gcc-5
- g++-5
script: .travis/script.sh
- env: BUILD_TARGET="posix" CC="gcc-6" CXX="g++-6"
- env: BUILD_TARGET="simulation" CC="gcc-6" CXX="g++-6"
os: linux
compiler: gcc
addons:
@@ -162,7 +162,7 @@ jobs:
- gcc-6
- g++-6
script: .travis/script.sh
- env: BUILD_TARGET="posix" CC="gcc-7" CXX="g++-7"
- env: BUILD_TARGET="simulation" CC="gcc-7" CXX="g++-7"
os: linux
compiler: gcc
addons:
@@ -171,7 +171,7 @@ jobs:
- gcc-7
- g++-7
script: .travis/script.sh
- env: BUILD_TARGET="posix" CC="gcc-8" CXX="g++-8"
- env: BUILD_TARGET="simulation" CC="gcc-8" CXX="g++-8"
os: linux
compiler: gcc
addons:
@@ -180,7 +180,7 @@ jobs:
- gcc-8
- g++-8
script: .travis/script.sh
- env: BUILD_TARGET="posix" CC="gcc-9" CXX="g++-9"
- env: BUILD_TARGET="simulation" CC="gcc-9" CXX="g++-9"
os: linux
compiler: gcc
addons:
@@ -191,7 +191,7 @@ jobs:
- gcc-9
- g++-9
script: .travis/script.sh
- env: BUILD_TARGET="posix-ncp-spi" VERBOSE=1
- env: BUILD_TARGET="simulation-ncp-spi" VERBOSE=1
os: linux
compiler: gcc
script: .travis/script.sh
+4 -4
View File
@@ -48,10 +48,10 @@ cd /tmp || die
pip3 install cmake
case "${BUILD_TARGET}" in
posix-distcheck|posix-32-bit|posix-app-cli|posix-mtd|posix-ncp|posix-app-ncp|v1.2)
simulation-distcheck|simulation-32-bit|posix-app-cli|simulation-mtd|simulation-ncp|posix-app-ncp|v1.2)
pip install --upgrade pip || die
pip install -r $TRAVIS_BUILD_DIR/tests/scripts/thread-cert/requirements.txt || die
[ $BUILD_TARGET != posix-ncp -a $BUILD_TARGET != posix-app-ncp ] || {
[ $BUILD_TARGET != simulation-ncp -a $BUILD_TARGET != posix-app-ncp ] || {
# Packages used by ncp tools.
pip install git+https://github.com/openthread/pyspinel || die
}
@@ -156,11 +156,11 @@ cd /tmp || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != posix-32-bit -a $BUILD_TARGET != posix-mtd ] || {
[ $BUILD_TARGET != simulation-32-bit -a $BUILD_TARGET != simulation-mtd ] || {
sudo apt-get install g++-multilib || die
}
[ $BUILD_TARGET != posix-distcheck ] || {
[ $BUILD_TARGET != simulation-distcheck ] || {
sudo apt-get install llvm-runtime || die
}
+1 -1
View File
@@ -42,7 +42,7 @@ at_exit() {
}
build() {
make -f examples/Makefile-posix
make -f examples/Makefile-simulation
make -f src/posix/Makefile-posix
}
+1 -1
View File
@@ -47,7 +47,7 @@ at_exit() {
}
build() {
make -f examples/Makefile-posix
make -f examples/Makefile-simulation
make -f src/posix/Makefile-posix PLATFORM_NETIF=1 PLATFORM_UDP=1 UDP_FORWARD=0
}
+27 -28
View File
@@ -80,7 +80,7 @@ python --version || die
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--with-examples=posix || die
--with-examples=simulation || die
scan-build --status-bugs -analyze-headers -v make -j2 || die
@@ -93,7 +93,7 @@ python --version || die
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--with-examples=posix || die
--with-examples=simulation || die
scan-build --status-bugs -analyze-headers -v make -j2 || die
}
@@ -415,23 +415,23 @@ build_samr21() {
build_samr21
}
[ $BUILD_TARGET != posix ] || {
[ $BUILD_TARGET != simulation ] || {
git checkout -- . || die
git clean -xfd || die
mkdir build && cd build || die
cmake -GNinja -DOT_PLATFORM=posix -DOT_COMPILE_WARNING_AS_ERROR=ON .. || die
cmake -GNinja -DOT_PLATFORM=simulation -DOT_COMPILE_WARNING_AS_ERROR=ON .. || die
ninja || die
cd .. || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE make -f examples/Makefile-posix || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE make -f examples/Makefile-simulation || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG make -f examples/Makefile-posix || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG make -f examples/Makefile-simulation || die
export CPPFLAGS=" \
-DOPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE=1 \
@@ -477,7 +477,7 @@ build_samr21() {
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-posix || die
make -f examples/Makefile-simulation || die
export CPPFLAGS=" \
-DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \
@@ -494,12 +494,12 @@ build_samr21() {
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 make -f examples/Makefile-posix || die
CPPFLAGS=-DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 make -f examples/Makefile-simulation || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE=1 make -f examples/Makefile-posix || die
CPPFLAGS=-DOPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE=1 make -f examples/Makefile-simulation || die
git checkout -- . || die
git clean -xfd || die
@@ -508,7 +508,7 @@ build_samr21() {
--enable-ncp \
--enable-ftd \
--enable-mtd \
--with-examples=posix \
--with-examples=simulation \
--disable-docs \
--disable-tests \
--with-vendor-extension=./src/core/common/extension_example.cpp || die
@@ -520,7 +520,7 @@ build_samr21() {
./configure \
--enable-cli \
--enable-mtd \
--with-examples=posix \
--with-examples=simulation \
--disable-docs \
--disable-tests || die
make -j 8 || die
@@ -539,7 +539,7 @@ build_samr21() {
--enable-ftd \
--enable-mtd \
--enable-radio-only \
--with-examples=posix || die
--with-examples=simulation || die
make -j 8 || die
export CPPFLAGS=" \
@@ -552,30 +552,30 @@ build_samr21() {
--enable-ncp \
--enable-ftd \
--enable-mtd \
--with-examples=posix \
--with-examples=simulation \
--disable-docs \
--disable-tests \
--with-ncp-vendor-hook-source=./src/ncp/example_vendor_hook.cpp || die
make -j 8 || die
}
[ $BUILD_TARGET != posix-distcheck ] || {
[ $BUILD_TARGET != simulation-distcheck ] || {
export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer` || die
export ASAN_OPTIONS=symbolize=1 || die
export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_POSIX_VIRTUAL_TIME=1 || die
export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1 || die
./bootstrap || die
REFERENCE_DEVICE=1 make -f examples/Makefile-posix distcheck || die
REFERENCE_DEVICE=1 make -f examples/Makefile-simulation distcheck || die
}
[ $BUILD_TARGET != posix-32-bit ] || {
[ $BUILD_TARGET != simulation-32-bit ] || {
./bootstrap || die
REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-posix check || die
REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-simulation check || die
}
[ $BUILD_TARGET != posix-app-cli ] || {
./bootstrap || die
# enable code coverage for OpenThread transceiver only
COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die
COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-simulation || die
# readline supports pipe, editline does not
REFERENCE_DEVICE=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die
REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli) -v" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check || die
@@ -616,22 +616,21 @@ build_samr21() {
.travis/check-ncp-rcp-migrate || die
}
[ $BUILD_TARGET != posix-mtd ] || {
[ $BUILD_TARGET != simulation-mtd ] || {
./bootstrap || die
REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-posix check || die
REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-simulation check || die
}
[ $BUILD_TARGET != posix-ncp-spi ] || {
[ $BUILD_TARGET != simulation-ncp-spi ] || {
CPPFLAGS="-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
./bootstrap || die
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ncp --enable-ftd --with-examples=posix" || die
make -f examples/Makefile-simulation check configure_OPTIONS="--enable-ncp --enable-ftd --with-examples=simulation" || die
}
[ $BUILD_TARGET != posix-app-ncp ] || {
./bootstrap || die
REFERENCE_DEVICE=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die
# enable code coverage for OpenThread posix radio
REFERENCE_DEVICE=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-simulation || die
REFERENCE_DEVICE=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die
REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" NODE_TYPE=ncp-sim make -f src/posix/Makefile-posix check || die
}
@@ -641,9 +640,9 @@ build_samr21() {
REFERENCE_DEVICE=1 READLINE=readline RCP_SPI=1 make -f src/posix/Makefile-posix || die
}
[ $BUILD_TARGET != posix-ncp ] || {
[ $BUILD_TARGET != simulation-ncp ] || {
./bootstrap || die
REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die
REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 NODE_TYPE=ncp-simulation make -f examples/Makefile-simulation check || die
}
[ $BUILD_TARGET != toranj-test-framework ] || {
@@ -654,7 +653,7 @@ build_samr21() {
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-posix || die
make -f examples/Makefile-simulation || die
git checkout -- . || die
git clean -xfd || die
+1 -1
View File
@@ -37,7 +37,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--with-examples=posix \
--with-examples=simulation \
$(NULL)
SUBDIRS = \
+7 -7
View File
@@ -828,7 +828,7 @@ AC_MSG_CHECKING([whether to build examples])
AC_ARG_WITH(examples,
[AS_HELP_STRING([--with-examples=TARGET],
[Build example applications for one of: posix, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg13, efr32mg21,
[Build example applications for one of: simulation, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg13, efr32mg21,
gp712, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.
Note that building example applications also builds the associated OpenThread platform libraries
and any third_party libraries needed to support the examples.])],
@@ -836,7 +836,7 @@ AC_ARG_WITH(examples,
case "${with_examples}" in
no)
;;
posix|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg13|efr32mg21|gp712|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg13|efr32mg21|gp712|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
if test ${enable_posix_app} = "yes"; then
AC_MSG_RESULT(ERROR)
AC_MSG_ERROR([--with-examples must be no when POSIX apps are enabled by --enable-posix-app])
@@ -852,7 +852,7 @@ AC_ARG_WITH(examples,
AM_CONDITIONAL([OPENTHREAD_ENABLE_EXAMPLES], [test ${with_examples} != "no"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_POSIX], [test "${with_examples}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SIMULATION],[test "${with_examples}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC1352], [test "${with_examples}" = "cc1352"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${with_examples}" = "cc2650"])
@@ -868,7 +868,7 @@ AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf5
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6095], [test "${with_examples}" = "qpg6095"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${with_examples}" = "samr21"])
AM_COND_IF([OPENTHREAD_EXAMPLES_POSIX], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_POSIX=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_POSIX=0")
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF528XX], [test OPENTHREAD_EXAMPLES_NRF52811 || test OPENTHREAD_EXAMPLES_NRF52833 || test OPENTHREAD_EXAMPLES_NRF52840])
@@ -925,7 +925,7 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM], [test ${with_platform} != "no"])
OPENTHREAD_ENABLE_PLATFORM=${with_platform}
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC1352], [test "${with_platform}" = "cc1352"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2538], [test "${with_platform}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2650], [test "${with_platform}" = "cc2650"])
@@ -988,7 +988,7 @@ NL_ENABLE_DOCS([auto],[NO])
AM_CONDITIONAL(OPENTHREAD_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
AM_CONDITIONAL(OPENTHREAD_POSIX, [test "${enable_posix_app}" = "yes" -o "${with_examples}" = "posix"])
AM_CONDITIONAL(OPENTHREAD_POSIX, [test "${enable_posix_app}" = "yes" -o "${with_examples}" = "simulation"])
#
# Checks for libraries and packages.
@@ -1099,7 +1099,7 @@ examples/platforms/kw41z/Makefile
examples/platforms/nrf528xx/Makefile
examples/platforms/qpg6095/Makefile
examples/platforms/samr21/Makefile
examples/platforms/posix/Makefile
examples/platforms/simulation/Makefile
examples/platforms/utils/Makefile
tools/Makefile
tools/harness-automation/Makefile
+6 -6
View File
@@ -1,7 +1,7 @@
VERSION=0.1
all: arm32v7_linux x86_linux sim
all: arm32v7_linux x86_linux simulation
arm32v7_linux: arm32v7_ubuntu_wpantund
docker build -t openthread/wpantund_arm32v7_linux arm32v7_ubuntu_wpantund && \
@@ -15,11 +15,11 @@ x86_linux: x86_ubuntu_wpantund
docker tag openthread/wpantund_amd64_linux openthread/wpantund_amd64_linux:$(VERSION) && \
docker push openthread/wpantund_amd64_linux:$(VERSION)
sim: ot_sim
docker build -t openthread/sim ot_sim && \
docker push openthread/sim && \
docker tag openthread/sim openthread/sim:$(VERSION) && \
docker push openthread/sim:$(VERSION)
simulation: ot_simulation
docker build -t openthread/simulation ot_sim && \
docker push openthread/simulation && \
docker tag openthread/simulation openthread/simulation:$(VERSION) && \
docker push openthread/simulation:$(VERSION)
publish_manifest:
docker manifest create openthread/wpantund openthread/wpantund_arm32v7_linux openthread/wpantund_amd64_linux
+1 -1
View File
@@ -36,4 +36,4 @@ RUN cd ~/src && \
git clone --recursive https://github.com/openthread/openthread.git && \
cd openthread && \
./bootstrap && \
make -f examples/Makefile-posix
make -f examples/Makefile-simulation
+1 -1
View File
@@ -7,7 +7,7 @@ RUN apk add -U autoconf automake ca-certificates flex git g++ libtool linux-head
RUN git clone --recursive https://github.com/openthread/openthread.git && \
cd /openthread && \
./bootstrap && \
make -f examples/Makefile-posix
make -f examples/Makefile-simulation
FROM alpine:3.6
+1 -1
View File
@@ -3,7 +3,7 @@
To start the OpenThread simulator, run:
```
docker run --rm -d --name otsim openthread/sim tail -F /dev/null
docker run --rm -d --name otsim openthread/simulation tail -F /dev/null
```
or
```
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/bash
docker run --rm -d --name otsim openthread/sim tail -F /dev/null
docker run --rm -d --name otsim openthread/simulation tail -F /dev/null
@@ -73,7 +73,7 @@ configure_OPTIONS = \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--with-examples=posix \
--with-examples=simulation \
$(NULL)
# Platform specific switches
@@ -91,11 +91,11 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1
endif # NCP_SPI == 1
ifeq ($(VIRTUAL_TIME),1)
COMMONCFLAGS += -DOPENTHREAD_POSIX_VIRTUAL_TIME=1
COMMONCFLAGS += -DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1
endif
ifeq ($(VIRTUAL_TIME_UART),1)
COMMONCFLAGS += -DOPENTHREAD_POSIX_VIRTUAL_TIME_UART=1
COMMONCFLAGS += -DOPENTHREAD_SIMULATION_VIRTUAL_TIME_UART=1
endif
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
@@ -103,8 +103,8 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-posix-config.h\"'
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/posix/
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-simulation-config.h\"'
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/simulation/
COMMONCFLAGS += \
-D$(CONFIG_FILE) \
-I$(CONFIG_FILE_PATH) \
+1 -1
View File
@@ -7,7 +7,7 @@ This example application exposes OpenThread configuration and management APIs vi
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-posix
$ make -f examples/Makefile-simulation
```
## 2. Start node 1
+2 -2
View File
@@ -37,7 +37,7 @@
#include "openthread-system.h"
#if OPENTHREAD_EXAMPLES_POSIX
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_POSIX
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
+2 -2
View File
@@ -36,7 +36,7 @@
#include "openthread-system.h"
#if OPENTHREAD_EXAMPLES_POSIX
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_POSIX
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
+4 -4
View File
@@ -41,7 +41,7 @@ DIST_SUBDIRS = \
gp712 \
kw41z \
nrf528xx \
posix \
simulation \
qpg6095 \
samr21 \
utils \
@@ -93,8 +93,8 @@ if OPENTHREAD_PLATFORM_NRF528XX
SUBDIRS += nrf528xx
endif
if OPENTHREAD_PLATFORM_POSIX
SUBDIRS += posix
if OPENTHREAD_PLATFORM_SIMULATION
SUBDIRS += simulation
endif
if OPENTHREAD_PLATFORM_QPG6095
@@ -122,7 +122,7 @@ PRETTY_SUBDIRS = \
gp712 \
kw41z \
nrf528xx \
posix \
simulation \
qpg6095 \
samr21 \
utils \
+2 -2
View File
@@ -97,6 +97,6 @@ if OPENTHREAD_EXAMPLES_SAMR21
include $(top_srcdir)/examples/platforms/samr21/Makefile.platform.am
endif # OPENTHREAD_EXAMPLES_SAMR21
if OPENTHREAD_EXAMPLES_POSIX
include $(top_srcdir)/examples/platforms/posix/Makefile.platform.am
if OPENTHREAD_EXAMPLES_SIMULATION
include $(top_srcdir)/examples/platforms/simulation/Makefile.platform.am
endif
@@ -26,17 +26,17 @@
# POSSIBILITY OF SUCH DAMAGE.
#
set(OT_PLATFORM_LIB "openthread-posix" PARENT_SCOPE)
set(OT_PLATFORM_LIB "openthread-simulation" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-posix-config.h")
set(OT_CONFIG "openthread-core-simulation-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"_BSD_SOURCE=1"
"_DEFAULT_SOURCE=1"
"OPENTHREAD_EXAMPLES_POSIX=1"
"OPENTHREAD_EXAMPLES_SIMULATION=1"
"OPENTHREAD_POSIX=1"
"OPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
)
@@ -44,7 +44,7 @@ set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-posix
add_library(openthread-simulation
alarm.c
diag.c
entropy.c
@@ -54,28 +54,28 @@ add_library(openthread-posix
radio.c
spi-stubs.c
system.c
uart-posix.c
sim/alarm-sim.c
sim/platform-sim.c
uart.c
virtual_time/alarm-sim.c
virtual_time/platform-sim.c
$<TARGET_OBJECTS:openthread-platform-utils>
)
set_property(TARGET openthread-posix PROPERTY C_STANDARD 99)
set_property(TARGET openthread-simulation PROPERTY C_STANDARD 99)
find_library(LIBRT rt)
if(LIBRT)
target_link_libraries(openthread-posix PRIVATE ${LIBRT})
target_link_libraries(openthread-simulation PRIVATE ${LIBRT})
endif()
target_link_libraries(openthread-posix PRIVATE openthread-platform-utils)
target_link_libraries(openthread-simulation PRIVATE openthread-platform-utils)
target_compile_definitions(openthread-posix PUBLIC ${OT_PLATFORM_DEFINES})
target_compile_definitions(openthread-simulation PUBLIC ${OT_PLATFORM_DEFINES})
target_compile_options(openthread-posix PRIVATE
target_compile_options(openthread-simulation PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-posix PRIVATE
target_include_directories(openthread-simulation PRIVATE
${OT_PUBLIC_INCLUDES}
${OT_PRIVATE_INCLUDES}
${PROJECT_SOURCE_DIR}/examples/platforms
@@ -28,9 +28,9 @@
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
lib_LIBRARIES = libopenthread-posix.a
lib_LIBRARIES = libopenthread-simulation.a
libopenthread_posix_a_CPPFLAGS = \
libopenthread_simulation_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/src/core \
@@ -44,17 +44,18 @@ PLATFORM_SOURCES = \
flash.c \
logging.c \
misc.c \
openthread-core-posix-config.h \
platform-posix.h \
openthread-core-simulation-config.h \
platform-config.h \
platform-simulation.h \
radio.c \
spi-stubs.c \
system.c \
uart-posix.c \
sim/alarm-sim.c \
sim/platform-sim.c \
uart.c \
virtual_time/alarm-sim.c \
virtual_time/platform-sim.c \
$(NULL)
libopenthread_posix_a_SOURCES = \
libopenthread_simulation_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
@@ -63,11 +64,11 @@ PRETTY_FILES = \
$(NULL)
Dash = -
libopenthread_posix_a_LIBADD = \
libopenthread_simulation_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
if OPENTHREAD_BUILD_COVERAGE
libopenthread_posix_a_CPPFLAGS += \
libopenthread_simulation_a_CPPFLAGS += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
@@ -27,11 +27,11 @@
#
#
# posix platform-specific Makefile
# Simulation platform-specific Makefile
#
LDADD_COMMON += \
$(top_builddir)/examples/platforms/posix/libopenthread-posix.a \
LDADD_COMMON += \
$(top_builddir)/examples/platforms/simulation/libopenthread-simulation.a \
$(NULL)
if OPENTHREAD_TARGET_LINUX
@@ -1,6 +1,6 @@
# OpenThread on POSIX Emulation Example
# OpenThread Simulation on POSIX
This directory contains example platform drivers for POSIX emulation.
This directory contains example platform drivers for simulation on POSIX.
## Build Examples
@@ -9,7 +9,7 @@ This directory contains example platform drivers for POSIX emulation.
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-posix
$ make -f examples/Makefile-simulation
```
After a successful build, the `elf` files are found in:
@@ -21,7 +21,7 @@ After a successful build, the `elf` files are found in:
```bash
$ cd <path-to-openthread>
$ mkdir build && cd build
$ cmake -GNinja -DOT_PLATFORM=posix ..
$ cmake -GNinja -DOT_PLATFORM=simulation ..
$ ninja
```
@@ -26,9 +26,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
#include <stdbool.h>
#include <stdio.h>
@@ -316,4 +316,4 @@ uint16_t otPlatTimeGetXtalAccuracy(void)
}
#endif
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <stdbool.h>
#include <stdio.h>
@@ -32,7 +32,7 @@
*
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <assert.h>
#include <stdio.h>
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <fcntl.h>
#include <stdio.h>
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <openthread-core-config.h>
#include <openthread/config.h>
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <setjmp.h>
#include <unistd.h>
@@ -28,12 +28,12 @@
/**
* @file
* This file includes posix compile-time configuration constants
* This file includes simulation compile-time configuration constants
* for OpenThread.
*/
#ifndef OPENTHREAD_CORE_POSIX_CONFIG_H_
#define OPENTHREAD_CORE_POSIX_CONFIG_H_
#ifndef OPENTHREAD_CORE_SIMULATION_CONFIG_H_
#define OPENTHREAD_CORE_SIMULATION_CONFIG_H_
#ifndef OPENTHREAD_RADIO
#define OPENTHREAD_RADIO 0
@@ -45,7 +45,7 @@
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "POSIX"
#define OPENTHREAD_CONFIG_PLATFORM_INFO "SIMULATION"
/**
* @def OPENTHREAD_CONFIG_LOG_OUTPUT
@@ -145,4 +145,4 @@
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1
#endif
#endif // OPENTHREAD_CORE_POSIX_CONFIG_H_
#endif // OPENTHREAD_CORE_SIMULATION_CONFIG_H_
@@ -33,33 +33,33 @@
*/
/**
* @def OPENTHREAD_POSIX_UART_BAUDRATE
* @def OPENTHREAD_SIMULATION_UART_BAUDRATE
*
* This setting configures the baud rate of the UART.
*
*/
#ifndef OPENTHREAD_POSIX_UART_BAUDRATE
#define OPENTHREAD_POSIX_UART_BAUDRATE B115200
#ifndef OPENTHREAD_SIMULATION_UART_BAUDRATE
#define OPENTHREAD_SIMULATION_UART_BAUDRATE B115200
#endif
/**
* @def OPENTHREAD_POSIX_VIRTUAL_TIME
* @def OPENTHREAD_SIMULATION_VIRTUAL_TIME
*
* This setting configures whether to use virtual time (used for simulation) in POSIX platform.
* This setting configures whether to use virtual time (used for simulation) in simulation platform.
*
*/
#ifndef OPENTHREAD_POSIX_VIRTUAL_TIME
#define OPENTHREAD_POSIX_VIRTUAL_TIME 0
#ifndef OPENTHREAD_SIMULATION_VIRTUAL_TIME
#define OPENTHREAD_SIMULATION_VIRTUAL_TIME 0
#endif
/**
* @def OPENTHREAD_POSIX_VIRTUAL_TIME_UART
* @def OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
*
* This setting configures whether to use virtual time for UART.
*
*/
#ifndef OPENTHREAD_POSIX_VIRTUAL_TIME_UART
#define OPENTHREAD_POSIX_VIRTUAL_TIME_UART 0
#ifndef OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
#define OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART 0
#endif
/**
@@ -32,8 +32,8 @@
* This file includes the platform-specific initializers.
*/
#ifndef PLATFORM_POSIX_H_
#define PLATFORM_POSIX_H_
#ifndef PLATFORM_SIMULATION_H_
#define PLATFORM_SIMULATION_H_
#include <openthread-core-config.h>
#include <openthread/config.h>
@@ -230,4 +230,4 @@ void otSimSendUartWriteEvent(const uint8_t *aData, uint16_t aLength);
*/
bool platformRadioIsTransmitPending(void);
#endif // PLATFORM_POSIX_H_
#endif // PLATFORM_SIMULATION_H_
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <errno.h>
@@ -56,14 +56,14 @@ enum
enum
{
POSIX_RECEIVE_SENSITIVITY = -100, // dBm
SIM_RECEIVE_SENSITIVITY = -100, // dBm
POSIX_HIGH_RSSI_SAMPLE = -30, // dBm
POSIX_LOW_RSSI_SAMPLE = -98, // dBm
POSIX_HIGH_RSSI_PROB_INC_PER_CHANNEL = 5,
SIM_HIGH_RSSI_SAMPLE = -30, // dBm
SIM_LOW_RSSI_SAMPLE = -98, // dBm
SIM_HIGH_RSSI_PROB_INC_PER_CHANNEL = 5,
};
#if OPENTHREAD_POSIX_VIRTUAL_TIME
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
extern int sSockFd;
extern uint16_t sPortOffset;
#else
@@ -75,8 +75,8 @@ static uint16_t sPort = 0;
enum
{
POSIX_RADIO_CHANNEL_MIN = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN,
POSIX_RADIO_CHANNEL_MAX = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX,
SIM_RADIO_CHANNEL_MIN = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN,
SIM_RADIO_CHANNEL_MAX = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX,
};
OT_TOOL_PACKED_BEGIN
@@ -226,7 +226,7 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
sPromiscuous = aEnable;
}
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
static void initFds(void)
{
int fd;
@@ -290,11 +290,11 @@ exit:
exit(EXIT_FAILURE);
}
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
void platformRadioInit(void)
{
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
char *offset;
offset = getenv("PORT_OFFSET");
@@ -315,7 +315,7 @@ void platformRadioInit(void)
}
initFds();
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
sReceiveFrame.mPsdu = sReceiveMessage.mPsdu;
sTransmitFrame.mPsdu = sTransmitMessage.mPsdu;
@@ -417,21 +417,21 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
assert(aInstance != NULL);
int8_t rssi = POSIX_LOW_RSSI_SAMPLE;
int8_t rssi = SIM_LOW_RSSI_SAMPLE;
uint8_t channel = sReceiveFrame.mChannel;
uint32_t probabilityThreshold;
otEXPECT((POSIX_RADIO_CHANNEL_MIN <= channel) && channel <= (POSIX_RADIO_CHANNEL_MAX));
otEXPECT((SIM_RADIO_CHANNEL_MIN <= channel) && channel <= (SIM_RADIO_CHANNEL_MAX));
// To emulate a simple interference model, we return either a high or
// a low RSSI value with a fixed probability per each channel. The
// probability is increased per channel by a constant.
probabilityThreshold = (channel - POSIX_RADIO_CHANNEL_MIN) * POSIX_HIGH_RSSI_PROB_INC_PER_CHANNEL;
probabilityThreshold = (channel - SIM_RADIO_CHANNEL_MIN) * SIM_HIGH_RSSI_PROB_INC_PER_CHANNEL;
if (otRandomNonCryptoGetUint16() < (probabilityThreshold * 0xffff / 100))
{
rssi = POSIX_HIGH_RSSI_SAMPLE;
rssi = SIM_HIGH_RSSI_SAMPLE;
}
exit:
@@ -469,7 +469,7 @@ static void radioReceive(otInstance *aInstance)
{
isTxDone = isAck && otMacFrameGetSequence(&sReceiveFrame) == otMacFrameGetSequence(&sTransmitFrame);
}
#if OPENTHREAD_POSIX_VIRTUAL_TIME
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
// Simulate tx done when receiving the echo frame.
else
{
@@ -555,7 +555,7 @@ void radioSendMessage(otInstance *aInstance)
radioComputeCrc(&sTransmitMessage, sTransmitFrame.mLength);
radioTransmit(&sTransmitMessage, &sTransmitFrame);
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
sTxWait = otMacFrameIsAckRequested(&sTransmitFrame);
if (!sTxWait)
@@ -577,7 +577,7 @@ void radioSendMessage(otInstance *aInstance)
#else
// Wait for echo radio in virtual time mode.
sTxWait = true;
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
}
bool platformRadioIsTransmitPending(void)
@@ -585,7 +585,7 @@ bool platformRadioIsTransmitPending(void)
return sState == OT_RADIO_STATE_TRANSMIT && !sTxWait;
}
#if OPENTHREAD_POSIX_VIRTUAL_TIME
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLength)
{
assert(sizeof(sReceiveMessage) >= aBufLength);
@@ -633,14 +633,14 @@ void platformRadioDeinit(void)
close(sTxFd);
}
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet)
{
OT_UNUSED_VARIABLE(aReadFdSet);
OT_UNUSED_VARIABLE(aWriteFdSet);
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
if (FD_ISSET(sRxFd, aReadFdSet))
{
struct sockaddr_in sockaddr;
@@ -681,7 +681,7 @@ void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFrame)
{
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
ssize_t rval;
struct sockaddr_in sockaddr;
@@ -698,7 +698,7 @@ void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFr
perror("sendto(sTxFd)");
exit(EXIT_FAILURE);
}
#else // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#else // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
struct Event event;
event.mDelay = 1; // 1us for now
@@ -707,7 +707,7 @@ void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFr
memcpy(event.mData, aMessage, event.mDataLength);
otSimSendEvent(&event);
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
}
void radioSendAck(void)
@@ -777,7 +777,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
assert(aInstance != NULL);
assert(aScanChannel >= POSIX_RADIO_CHANNEL_MIN && aScanChannel <= POSIX_RADIO_CHANNEL_MAX);
assert(aScanChannel >= SIM_RADIO_CHANNEL_MIN && aScanChannel <= SIM_RADIO_CHANNEL_MAX);
assert(aScanDuration > 0);
return OT_ERROR_NOT_IMPLEMENTED;
@@ -823,7 +823,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
assert(aInstance != NULL);
return POSIX_RECEIVE_SENSITIVITY;
return SIM_RECEIVE_SENSITIVITY;
}
otRadioState otPlatRadioGetState(otInstance *aInstance)
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <stdio.h>
#include <stdlib.h>
@@ -47,7 +47,7 @@ otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aComplete
OT_UNUSED_VARIABLE(aProcessCallback);
OT_UNUSED_VARIABLE(aContext);
fprintf(stderr, "\nNo SPI support for posix platform.");
fprintf(stderr, "\nNo SPI support for simulation platform.");
exit(0);
return OT_ERROR_NOT_IMPLEMENTED;
@@ -32,9 +32,9 @@
* This file includes the platform-specific initializers.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#if OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
#include <assert.h>
#include <errno.h>
@@ -162,4 +162,4 @@ void otSysProcessDrivers(otInstance *aInstance)
}
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#include <assert.h>
#include <errno.h>
@@ -43,7 +43,7 @@
#include "utils/code_utils.h"
#if OPENTHREAD_POSIX_VIRTUAL_TIME_UART == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
#ifdef OPENTHREAD_TARGET_LINUX
#include <sys/prctl.h>
int posix_openpt(int oflag);
@@ -128,7 +128,7 @@ otError otPlatUartEnable(void)
termios.c_cc[VTIME] = 0;
// configure baud rate
otEXPECT_ACTION(cfsetispeed(&termios, OPENTHREAD_POSIX_UART_BAUDRATE) == 0, perror("cfsetispeed");
otEXPECT_ACTION(cfsetispeed(&termios, OPENTHREAD_SIMULATION_UART_BAUDRATE) == 0, perror("cfsetispeed");
error = OT_ERROR_GENERIC);
// set configuration
@@ -151,7 +151,7 @@ otError otPlatUartEnable(void)
termios.c_cflag |= HUPCL | CREAD | CLOCAL;
// configure baud rate
otEXPECT_ACTION(cfsetospeed(&termios, OPENTHREAD_POSIX_UART_BAUDRATE) == 0, perror("cfsetospeed");
otEXPECT_ACTION(cfsetospeed(&termios, OPENTHREAD_SIMULATION_UART_BAUDRATE) == 0, perror("cfsetospeed");
error = OT_ERROR_GENERIC);
// set configuration
@@ -317,7 +317,7 @@ void platformUartProcess(void)
}
}
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME_UART == 0
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART && (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART)
@@ -26,9 +26,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#if OPENTHREAD_POSIX_VIRTUAL_TIME
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
#include <stdbool.h>
#include <stdio.h>
@@ -193,4 +193,4 @@ uint16_t otPlatTimeGetXtalAccuracy(void)
}
#endif
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
@@ -32,9 +32,9 @@
* This file includes the platform-specific initializers.
*/
#include "platform-posix.h"
#include "platform-simulation.h"
#if OPENTHREAD_POSIX_VIRTUAL_TIME
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
#include <assert.h>
#include <errno.h>
@@ -133,7 +133,7 @@ static void platformSendSleepEvent(void)
otSimSendEvent(&event);
}
#if OPENTHREAD_POSIX_VIRTUAL_TIME_UART
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
void platformUartRestore(void)
{
}
@@ -170,7 +170,7 @@ otError otPlatUartFlush(void)
{
return OT_ERROR_NOT_IMPLEMENTED;
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME_UART
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
static void socket_init(void)
{
@@ -283,7 +283,7 @@ void otSysProcessDrivers(otInstance *aInstance)
FD_SET(sSockFd, &read_fds);
max_fd = sSockFd;
#if OPENTHREAD_POSIX_VIRTUAL_TIME_UART == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
platformUartUpdateFdSet(&read_fds, &write_fds, &error_fds, &max_fd);
#endif
@@ -307,9 +307,9 @@ void otSysProcessDrivers(otInstance *aInstance)
platformAlarmProcess(aInstance);
platformRadioProcess(aInstance, &read_fds, &write_fds);
#if OPENTHREAD_POSIX_VIRTUAL_TIME_UART == 0
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
platformUartProcess();
#endif
}
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
+1 -1
View File
@@ -173,7 +173,7 @@ void otPlatDebugUart_write_bytes(const uint8_t *pBytes, int nBytes);
void otPlatDebugUart_puts_no_nl(const char *s);
/**
* Some platforms (posix) can log to a file.
* Some platforms (simulation) can log to a file.
*
* @returns OT_ERROR_NONE
* @returns OT_ERROR_FAILED
+2 -2
View File
@@ -81,9 +81,9 @@ install_packages_brew()
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc
# check for gcc for posix examples
# check for gcc for simulation
if ! which gcc; then
echo 'warning: clang/gcc needed for posix examples'
echo 'warning: clang/gcc needed for simulation'
echo 'warning: please install Command Line Tools from https://developer.apple.com/download/more/'
fi
+3 -3
View File
@@ -44,7 +44,7 @@ do_build() {
OPTIONS="VIRTUAL_TIME_UART=1"
fi
make -f examples/Makefile-posix ${OPTIONS}
make -f examples/Makefile-simulation ${OPTIONS}
if [[ -n "${RADIO_DEVICE}" ]]; then
make -f src/posix/Makefile-posix
@@ -54,7 +54,7 @@ do_build() {
if [ "${THREAD_VERSION}" = "1.2" ]; then
./bootstrap
OPTIONS="TargetTuple=${SYSTEM_TRIPLET}-1.1 THREAD_VERSION=1.1 ${OPTIONS}"
make -f examples/Makefile-posix ${OPTIONS}
make -f examples/Makefile-simulation ${OPTIONS}
if [[ -n "${RADIO_DEVICE}" ]]; then
make -f src/posix/Makefile-posix
@@ -116,7 +116,7 @@ do_package() {
local builddir="${OT_BUILDDIR}/cmake/openthread-sim"
(mkdir -p "${builddir}" \
&& cd "${builddir}" \
&& cmake "${OT_SRCDIR}" -DOT_PLATFORM="posix" \
&& cmake "${OT_SRCDIR}" -DOT_PLATFORM="simulation" \
&& make -j${OT_BUILD_JOBS} package \
&& ls "${builddir}"/openthread-simulation-*.deb)
+1 -1
View File
@@ -718,7 +718,7 @@ Done
### logfilename \<filename\>
- Note: POSIX Platform Only, ie: `OPENTHREAD_EXAMPLES_POSIX`
- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
Specifies filename to capture otPlatLog() messages, useful when
+1 -1
View File
@@ -10,7 +10,7 @@ Use the `COAP=1` build switch to enable CoAP API support.
```bash
> ./bootstrap
> make -f examples/Makefile-posix COAP=1
> make -f examples/Makefile-simulation COAP=1
```
### Form Network
+1 -1
View File
@@ -10,7 +10,7 @@ Use the `COAPS=1` build switch to enable CoAPS API support.
```bash
> ./bootstrap
> make -f examples/Makefile-posix COAPS=1
> make -f examples/Makefile-simulation COAPS=1
```
### Form Network
+2 -2
View File
@@ -8,7 +8,7 @@ Use the `JOINER=1` build switch to enable Joiner support.
```bash
> ./bootstrap
> make -f examples/Makefile-posix JOINER=1
> make -f examples/Makefile-simulation JOINER=1
```
### Build with Commissioner support
@@ -17,7 +17,7 @@ Use the `COMMISSIONER=1` build switch to enable Commissioner support.
```bash
> ./bootstrap
> make -f examples/Makefile-posix COMMISSIONER=1
> make -f examples/Makefile-simulation COMMISSIONER=1
```
### Form Network
+1 -1
View File
@@ -36,7 +36,7 @@ You can also perform radio diagnostics using the command [diag](../../src/core/d
### With Simulation
```sh
make -f examples/Makefile-posix
make -f examples/Makefile-simulation
./output/posix/x86_64-unknown-linux-gnu/bin/ot-cli ./output/x86_64-unknown-linux-gnu/bin/ot-rcp 1
```
+6 -6
View File
@@ -36,8 +36,8 @@ display_usage() {
echo ""
echo "Usage: $(basename $0) [options] <config>"
echo " <config> can be:"
echo " ncp : Build OpenThread NCP FTD mode with POSIX platform"
echo " rcp : Build OpenThread RCP (NCP in radio mode) with POSIX platform"
echo " ncp : Build OpenThread NCP FTD mode with simulation platform"
echo " rcp : Build OpenThread RCP (NCP in radio mode) with simulation platform"
echo " posix-app : Build OpenThread POSIX App NCP"
echo " cmake : Configure and build OpenThread using cmake/ninja (RCP and NCP) only"
echo ""
@@ -108,7 +108,7 @@ case ${build_config} in
cd "${top_builddir}"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-examples=posix \
--with-examples=simulation \
$configure_options || die
make -j 8 || die
;;
@@ -124,7 +124,7 @@ case ${build_config} in
--enable-coverage=${coverage} \
--enable-ncp \
--enable-radio-only \
--with-examples=posix \
--with-examples=simulation \
--disable-docs \
--enable-tests=$tests || die
make -j 8 || die
@@ -145,9 +145,9 @@ case ${build_config} in
cmake)
echo "===================================================================================================="
echo "Building OpenThread (NCP/CLI for FTD/MTD/RCP mode) with POSIX platform using cmake"
echo "Building OpenThread (NCP/CLI for FTD/MTD/RCP mode) with simulation platform using cmake"
echo "===================================================================================================="
cmake -GNinja -DOT_PLATFORM=posix -DOT_CONFIG=../tests/toranj/openthread-core-toranj-config.h . || die
cmake -GNinja -DOT_PLATFORM=simulation -DOT_CONFIG=../tests/toranj/openthread-core-toranj-config.h . || die
ninja || die
;;
+1 -1
View File
@@ -59,7 +59,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/core \
$(NULL)
if OPENTHREAD_EXAMPLES_POSIX
if OPENTHREAD_EXAMPLES_SIMULATION
AM_CPPFLAGS += \
-I$(top_srcdir)/examples/platforms \
$(NULL)
+4 -4
View File
@@ -732,7 +732,7 @@ Publicly Available
</td>
<td><b>Location</b></td>
<td id="location" name="location">
[as_installed]/examples/Makefile-posix
[as_installed]/examples/Makefile-simulation
</td>
</tr>
<tr>
@@ -745,7 +745,7 @@ Publicly Available
<tbody>
<tr>
<td id="name" name="name" rowspan="2">
posix platform layer
simulation platform layer
</td>
<td id="version" name="version" rowspan="2">
0.01.00
@@ -761,7 +761,7 @@ Publicly Available
</td>
<td><b>Location</b></td>
<td id="location" name="location">
[as_installed]/examples/platforms/posix
[as_installed]/examples/platforms/simulation
</td>
</tr>
<tr>
@@ -1813,4 +1813,4 @@ Publicly Available
with 100,000+ analog ICs and embedded processors, along with software, tools
and the industry's largest sales/support staff.</p>
</footer>
</body></html>
</body></html>