From 8ac5d7cc4b380105615ab4f02484c135c8a8b468 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 13 Sep 2016 08:31:50 +0200 Subject: o Adding new working(!) examples, blinky and ble_app_hrs. --- examples/ble_peripheral/ble_app_hrs/CMakeLists.txt | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 examples/ble_peripheral/ble_app_hrs/CMakeLists.txt (limited to 'examples/ble_peripheral/ble_app_hrs') diff --git a/examples/ble_peripheral/ble_app_hrs/CMakeLists.txt b/examples/ble_peripheral/ble_app_hrs/CMakeLists.txt new file mode 100644 index 0000000..a21c44f --- /dev/null +++ b/examples/ble_peripheral/ble_app_hrs/CMakeLists.txt @@ -0,0 +1,119 @@ +set(T ble_app_hrs) +set(D ${MCU_NRF5X_SDK_PATH}/examples/ble_peripheral/${T}) + +if (NOT EXISTS ${D}) + message("${T}: Not available in this SDK version: ${D}") + return() +endif () + +if (MCU_CHIP MATCHES "nrf51.*") + set(SOFTDEVICE 130) + set(SDK_CONFIG ${D}/pca10028/s130/config/sdk_config.h) + set(D_BOARD BOARD_PCA10028) +elseif (MCU_CHIP MATCHES "nrf52.*") + set(SOFTDEVICE 132) + set(SDK_CONFIG ${D}/pca10040/s132/config/sdk_config.h) + set(D_BOARD BOARD_PCA10040) +endif () + +message("${T}: Configured for chip ${MCU_CHIP}, using sdk config=${SDK_CONFIG}, board define: ${D_BOARD}") + +if (MCU_NRF5X_SDK_VERSION VERSION_GREATER 7) + list(APPEND EXTRA_SOURCE_DIRS + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/delay + ${MCU_NRF5X_SDK_PATH}/components/libraries/experimental_section_vars + ${MCU_NRF5X_SDK_PATH}/components/libraries/crc32 + ) +endif () + +mcu_include_directories_from_sources( + SOURCES_VAR SOURCES + HEADERS_VAR HEADERS + INCLUDES_VAR INCLUDES + SOURCE_DIR + ${MCU_NRF5X_SDK_PATH}/components/ble/ble_advertising + ${MCU_NRF5X_SDK_PATH}/components/ble/common + ${MCU_NRF5X_SDK_PATH}/components/ble/ble_services/ble_bas + ${MCU_NRF5X_SDK_PATH}/components/ble/ble_services/ble_hrs + ${MCU_NRF5X_SDK_PATH}/components/ble/ble_services/ble_dis + ${MCU_NRF5X_SDK_PATH}/components/ble/peer_manager + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/clock + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/common + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/gpiote + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/hal + ${MCU_NRF5X_SDK_PATH}/components/libraries/button + ${MCU_NRF5X_SDK_PATH}/components/libraries/fds + ${MCU_NRF5X_SDK_PATH}/components/libraries/fstorage + ${MCU_NRF5X_SDK_PATH}/components/libraries/log + ${MCU_NRF5X_SDK_PATH}/components/libraries/scheduler + ${MCU_NRF5X_SDK_PATH}/components/libraries/sensorsim + ${MCU_NRF5X_SDK_PATH}/components/libraries/util + ${MCU_NRF5X_SDK_PATH}/components/softdevice/common/softdevice_handler + ${EXTRA_SOURCE_DIRS} + EXCLUDE + "app_error_weak_cmock" +) + +add_executable(${T} + ${D}/main.c ${SDK_CONFIG} + ${MCU_NRF5X_SDK_PATH}/components/libraries/timer/app_timer.c + ${MCU_NRF5X_SDK_PATH}/examples/bsp/bsp.c + ${MCU_NRF5X_SDK_PATH}/examples/bsp/bsp_btn_ble.c + ${SOURCES} ${HEADERS}) + +target_include_directories(${T} PUBLIC + ${INCLUDES} + ${MCU_NRF5X_SDK_PATH}/examples/bsp + ${MCU_NRF5X_SDK_PATH}/components/libraries/timer + ) +target_compile_definitions(${T} PUBLIC + ${D_BOARD} + BLE_STACK_SUPPORT_REQD + DEBUG + NRF_SD_BLE_API_VERSION=3) + +mcu_add_executable(TARGET ${T} + SDK_CONFIG ${SDK_CONFIG} + SOFTDEVICE ${SOFTDEVICE} + LINKER_SCRIPT ${D}/pca10040/s132/armgcc/${T}_gcc_nrf52.ld) + +# Copied from the Makefile +target_compile_definitions(${T} PUBLIC + __HEAP_SIZE=0 + CONFIG_GPIO_AS_PINRESET + SWI_DISABLE0 + NRF52_PAN_12 + NRF52_PAN_15 + NRF52_PAN_20 + NRF52_PAN_30 + NRF52_PAN_31 + NRF52_PAN_36 + NRF52_PAN_51 + NRF52_PAN_53 + NRF52_PAN_54 + NRF52_PAN_55 + NRF52_PAN_58 + NRF52_PAN_62 + NRF52_PAN_63 + NRF52_PAN_64) + +set(ENABLE_LOGGING 1) + +if (ENABLE_LOGGING) + mcu_include_directories_from_sources( + SOURCES_VAR SOURCES + HEADERS_VAR HEADERS + INCLUDES_VAR INCLUDES + SOURCE_DIR + ${MCU_NRF5X_SDK_PATH}/components/drivers_nrf/uart/ + EXCLUDE + ".*dox.*" + ) + + target_sources(${T} PUBLIC ${SOURCES} ${HEADERS}) + target_include_directories(${T} PUBLIC ${INCLUDES}) + target_compile_definitions(${T} PUBLIC + NRF_LOG_ENABLED + NRF_LOG_DEFAULT_LEVEL=4 + ) +endif () -- cgit v1.2.3