Skip to content

Commit

Permalink
Glue standalone application to a device layer for POSIX platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Jul 9, 2020
1 parent e0f65ef commit deec3aa
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
6 changes: 4 additions & 2 deletions config/standalone/standalone-chip.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ CHIP_OUTPUT_DIR = $(OUTPUT_DIR)/chip
# An optional file containing application-specific configuration overrides.
CHIP_PROJECT_CONFIG = $(wildcard $(PROJECT_ROOT)/include/CHIPProjectConfig.h)

# Architcture on which CHIP is being built.
# Architecture on which CHIP is being built.
CHIP_BUILD_ARCH = $(shell $(CHIP_ROOT)/third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$$//g')

# Archtecture for which CHIP will be built.
# Architecture for which CHIP will be built.
CHIP_HOST_ARCH := $(CHIP_BUILD_ARCH)


Expand Down Expand Up @@ -135,6 +135,7 @@ STD_LDFLAGS += -L$(CHIP_OUTPUT_DIR)/lib
# Add CHIP libraries to standard libraries list.
STD_LIBS += \
-lCHIP \
-lDeviceLayer \
-lInetLayer \
-lnlfaultinjection \
-lSystemLayer
Expand All @@ -149,6 +150,7 @@ STD_COMPILE_PREREQUISITES += install-chip
# Add the CHIP libraries as prerequisites for linking the application.
STD_LINK_PREREQUISITES += \
$(CHIP_OUTPUT_DIR)/lib/libCHIP.a \
$(CHIP_OUTPUT_DIR)/lib/libDeviceLayer.a \
$(CHIP_OUTPUT_DIR)/lib/libInetLayer.a \
$(CHIP_OUTPUT_DIR)/lib/libnlfaultinjection.a \
$(CHIP_OUTPUT_DIR)/lib/libSystemLayer.a
Expand Down
24 changes: 21 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -996,11 +996,11 @@ AC_DEFINE_UNQUOTED([CONFIG_NETWORK_LAYER_INET],[${CONFIG_NETWORK_LAYER_INET}],[D
AC_MSG_CHECKING([device layer])
AC_ARG_WITH(device-layer,
[AS_HELP_STRING([--with-device-layer=LAYER],
[Specify the target environment for the CHIP Device Layer. Choose one of: darwin, efr32, esp32, nrf5, linux, or none @<:@default=none@:>@.])],
[Specify the target environment for the CHIP Device Layer. Choose one of: auto, darwin, efr32, esp32, nrf5, linux, or none @<:@default=auto@:>@.])],
[
case "${with_device_layer}" in
darwin|efr32|esp32|nrf5|linux|none)
auto|darwin|efr32|esp32|nrf5|linux|none)
;;
*)
Expand All @@ -1009,7 +1009,7 @@ AC_ARG_WITH(device-layer,
esac
],
[with_device_layer=none])
[with_device_layer=auto])
AC_MSG_RESULT(${with_device_layer})

# Disable all device layer targets by default
Expand All @@ -1019,6 +1019,24 @@ CHIP_DEVICE_LAYER_TARGET_ESP32=0
CHIP_DEVICE_LAYER_TARGET_NRF5=0
CHIP_DEVICE_LAYER_TARGET_LINUX=0

if test "${with_device_layer}" = "auto"; then
case ${target_os} in

*darwin*)
with_device_layer=darwin
;;

*linux*)
with_device_layer=linux
;;

*)
with_device_layer=none
;;

esac
fi

case "${with_device_layer}" in

darwin)
Expand Down
1 change: 1 addition & 0 deletions src/include/platform/CHIPDeviceEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ typedef void (*AsyncWorkFunct)(intptr_t arg);
#include CHIPDEVICEPLATFORMEVENT_HEADER
#endif

#include <ble/BleConfig.h>
#include <system/SystemPacketBuffer.h>

namespace chip {
Expand Down
2 changes: 1 addition & 1 deletion src/include/platform/ConnectivityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ConnectivityManager
bool HaveServiceConnectivity(void);

// CHIPoBLE service methods
typedef void (*BleConnectionReceivedFunct)(BLEEndPoint * endpoint);
typedef void (*BleConnectionReceivedFunct)(Ble::BLEEndPoint * endpoint);
void AddCHIPoBLEConnectionHandler(BleConnectionReceivedFunct handler);
void RemoveCHIPoBLEConnectionHandler(void);
CHIPoBLEServiceMode GetCHIPoBLEServiceMode(void);
Expand Down
16 changes: 16 additions & 0 deletions src/platform/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ noinst_HEADERS = \
@top_srcdir@/src/include/platform/internal/EventLogging.h \
@top_srcdir@/src/include/platform/internal/GenericConfigurationManagerImpl.h \
@top_srcdir@/src/include/platform/internal/GenericConfigurationManagerImpl.ipp \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_BLE.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_BLE.ipp \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_NoBLE.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_NoTunnel.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h \
@top_srcdir@/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp \
@top_srcdir@/src/include/platform/internal/GenericPlatformManagerImpl.h \
@top_srcdir@/src/include/platform/internal/GenericPlatformManagerImpl.ipp \
@top_srcdir@/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.h \
Expand All @@ -61,8 +70,11 @@ noinst_HEADERS = \
@top_srcdir@/src/include/platform/internal/CHIPDeviceLayerInternal.h \
@top_srcdir@/src/platform/Darwin/CHIPDevicePlatformConfig.h \
@top_srcdir@/src/platform/Darwin/CHIPDevicePlatformEvent.h \
@top_srcdir@/src/platform/Darwin/CHIPPlatformConfig.h \
@top_srcdir@/src/platform/Darwin/ConfigurationManagerImpl.h \
@top_srcdir@/src/platform/Darwin/ConnectivityManagerImpl.h \
@top_srcdir@/src/platform/Darwin/PlatformManagerImpl.h \
@top_srcdir@/src/platform/Darwin/PosixConfig.h \
@top_srcdir@/src/platform/nRF5/ConnectivityManagerImpl.h \
@top_srcdir@/src/platform/nRF5/nRF5Config.h \
@top_srcdir@/src/platform/nRF5/CHIPDevicePlatformConfig.h \
Expand Down Expand Up @@ -93,8 +105,12 @@ noinst_HEADERS = \
@top_srcdir@/src/platform/ESP32/ESP32Config.h \
@top_srcdir@/src/platform/Linux/CHIPDevicePlatformConfig.h \
@top_srcdir@/src/platform/Linux/CHIPDevicePlatformEvent.h \
@top_srcdir@/src/platform/Linux/CHIPPlatformConfig.h \
@top_srcdir@/src/platform/Linux/ConfigurationManagerImpl.h \
@top_srcdir@/src/platform/Linux/ConnectivityManagerImpl.h \
@top_srcdir@/src/platform/Linux/PlatformManagerImpl.h \
@top_srcdir@/src/platform/Linux/PosixConfig.h \
@top_srcdir@/src/include/platform/testing/ConfigUnitTest.h \
$(NULL)

if CONFIG_DEVICE_LAYER
Expand Down
7 changes: 7 additions & 0 deletions third_party/mbedtls/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ nodist_libmbedtls_a_SOURCES +=
$(NULL)
endif

if CHIP_DEVICE_LAYER_TARGET_LINUX
nodist_libmbedtls_a_SOURCES += \
repo/library/entropy_poll.c \
repo/library/timing.c \
$(NULL)
endif

libmbedtls_a_CPPFLAGS = \
-I$(top_srcdir)/third_party/mbedtls/repo/include \
$(MBEDTLS_CPPFLAGS) \
Expand Down

0 comments on commit deec3aa

Please sign in to comment.