This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Segger Embedded Studio to Makefile

Hello

I developed a project based on the ble_thread_dyn_mtd_coap_cli_pca10056_s140 example (on the latest SDK version) with SEGGER Embeded Studio.

Now I would like to be able to automate the compilation of my code using CI (continuous integration) using a makefile.

To do this, I tried modifying the Makefile located in "examples\multiprotocol\ble_thread\ble_thread_dyn_mtd_coap_cli\pca10056\s140\armgcc" to suit my project.
I'm not familiar with Makefiles.so I don't know if I did the right thing but here's what I changed:
- I put my source files in "SRC_FILES"
- I put my headers folders in "INC_FOLDERS"
- I put my libraries in "LIB_FILES"
- additions to "CFLAGS" and "ASMFLAGS" my preprocessor definitions

Here is my Makefile:

PROJECT_NAME     := BT840
TARGETS          := nrf52840_xxaa
OUTPUT_DIRECTORY := _build

SDK_ROOT := ../../..
PROJ_DIR := ../..
LIBRARIES_DIR := $(SDK_ROOT)/Libraries
SC_DIR := $(PROJ_DIR)/Source_codes

$(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
  LINKER_SCRIPT  := BT840.ld

# Source files common to all targets
SRC_FILES += \
  $(LIBRARIES_DIR)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
  $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_rtt.c \
  $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_serial.c \
  $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_default_backends.c \
  $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_frontend.c \
  $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_str_formatter.c \
  $(LIBRARIES_DIR)/components/libraries/button/app_button.c \
  $(LIBRARIES_DIR)/components/libraries/util/app_error.c \
  $(LIBRARIES_DIR)/components/libraries/util/app_error_handler_gcc.c \
  $(LIBRARIES_DIR)/components/libraries/util/app_error_weak.c \
  $(LIBRARIES_DIR)/components/libraries/fifo/app_fifo.c \
  $(LIBRARIES_DIR)/components/libraries/scheduler/app_scheduler.c \
  $(LIBRARIES_DIR)/components/libraries/timer/app_timer2.c \
  $(LIBRARIES_DIR)/components/libraries/uart/app_uart_fifo.c \
  $(LIBRARIES_DIR)/components/libraries/util/app_util_platform.c \
  $(LIBRARIES_DIR)/components/libraries/assert/assert.c \
  $(LIBRARIES_DIR)/components/libraries/timer/drv_rtc.c \
  $(LIBRARIES_DIR)/components/libraries/hardfault/hardfault_implementation.c \
  $(LIBRARIES_DIR)/components/libraries/mem_manager/mem_manager.c \
  $(LIBRARIES_DIR)/components/libraries/util/nrf_assert.c \
  $(LIBRARIES_DIR)/components/libraries/atomic_fifo/nrf_atfifo.c \
  $(LIBRARIES_DIR)/components/libraries/atomic_flags/nrf_atflags.c \
  $(LIBRARIES_DIR)/components/libraries/atomic/nrf_atomic.c \
  $(LIBRARIES_DIR)/components/libraries/balloc/nrf_balloc.c \
  $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf.c \
  $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf_format.c \
  $(LIBRARIES_DIR)/components/libraries/memobj/nrf_memobj.c \
  $(LIBRARIES_DIR)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \
  $(LIBRARIES_DIR)/components/libraries/ringbuf/nrf_ringbuf.c \
  $(LIBRARIES_DIR)/components/libraries/experimental_section_vars/nrf_section_iter.c \
  $(LIBRARIES_DIR)/components/libraries/sortlist/nrf_sortlist.c \
  $(LIBRARIES_DIR)/components/libraries/strerror/nrf_strerror.c \
  $(LIBRARIES_DIR)/components/libraries/uart/retarget.c \
  $(LIBRARIES_DIR)/components/libraries/serial/nrf_serial.c \
  $(LIBRARIES_DIR)/components/libraries/queue/nrf_queue.c \
  $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage.c \
  $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage_sd.c \
  $(LIBRARIES_DIR)/components/libraries/fds/fds.c \
  $(LIBRARIES_DIR)/components/libraries/ecc/ecc.c \
  $(LIBRARIES_DIR)/components/libraries/crc16/crc16.c \
  $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_async.c \
  $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_drv.c \
  #$(LIBRARIES_DIR)/modules/nrfx/mdk/ses_startup_nrf52840.s \
  #$(LIBRARIES_DIR)/modules/nrfx/mdk/ses_startup_nrf_common.s \
  $(LIBRARIES_DIR)/modules/nrfx/mdk/gcc_startup_nrf52840.s \
  $(LIBRARIES_DIR)/modules/nrfx/mdk/system_nrf52840.c \
  $(SC_DIR)/Utils/multiprotocol_802154_config.c \
  $(LIBRARIES_DIR)/components/boards/boards.c \
  $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_clock.c \
  $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_uart.c \
  $(LIBRARIES_DIR)/modules/nrfx/hal/nrf_nvmc.c \
  $(LIBRARIES_DIR)/modules/nrfx/soc/nrfx_atomic.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_clock.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_gpiote.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_nvmc.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_uart.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_uarte.c \
  $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power/nrf_drv_power.c \
  $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src/nrfx_power.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_wdt.c \
  $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_rng.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rng.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_ppi.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rtc.c \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_timer.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
  $(SC_DIR)/main.c \
  $(SC_DIR)/smartvalve.c \
  $(SC_DIR)/BLE/ble_thread_diagnostic.c \
  $(SC_DIR)/BLE/ble_utils.c \
  $(SC_DIR)/Components/Flash/flashDataStorage.c \
  $(SC_DIR)/Thread/Process/process_change_network_settings.c \
  $(SC_DIR)/Thread/Process/process_get_routing_info.c \
  $(SC_DIR)/Thread/Process/process_get_routing_info_from_neighbors.c \
  $(SC_DIR)/Thread/Process/process_get_hydraulic_data.c \
  $(SC_DIR)/Thread/Thread_ressources/hydraulicData_ressource.c \
  $(SC_DIR)/Thread/Thread_ressources/light_ressource.c \
  $(SC_DIR)/Thread/Thread_ressources/routingInfo_ressource.c \
  $(SC_DIR)/Thread/Thread_ressources/uart_ressource.c \
  $(SC_DIR)/Thread/com.c \
  $(SC_DIR)/Thread/thread_network_utils.c \
  $(SC_DIR)/UART/uart.c \
  $(SC_DIR)/UART/uart_interpreter.c \
  $(SC_DIR)/Utils/utils.c \
  $(SC_DIR)/Utils/log.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
  $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
  $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh.c \
  $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_ble.c \
  $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_soc.c \
  $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT.c \
  $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
  $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_printf.c \
  $(LIBRARIES_DIR)/components/ble/common/ble_advdata.c \
  $(LIBRARIES_DIR)/components/ble/ble_advertising/ble_advertising.c \
  $(LIBRARIES_DIR)/components/ble/common/ble_conn_params.c \
  $(LIBRARIES_DIR)/components/ble/common/ble_conn_state.c \
  $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c \
  $(LIBRARIES_DIR)/components/ble/common/ble_srv_common.c \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr/nrf_ble_qwr.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/auth_status_tracker.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/gatt_cache_manager.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/gatts_cache_manager.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/id_manager.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/nrf_ble_lesc.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/peer_data_storage.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/peer_database.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/peer_id.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager_handler.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/pm_buffer.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/security_dispatcher.c \
  $(LIBRARIES_DIR)/components/ble/peer_manager/security_manager.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aead.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes_shared.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecc.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdh.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdsa.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_eddsa.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_error.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hash.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hkdf.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hmac.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_init.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_rng.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_shared.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_chacha_poly_aead.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecc.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdh.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdsa.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_eddsa.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hash.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hmac.c \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_scan/nrf_ble_scan.c \
  $(LIBRARIES_DIR)/components/ble/ble_db_discovery/ble_db_discovery.c \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_gq/nrf_ble_gq.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_init.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng.c \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng_mbedtls.c \
  $(LIBRARIES_DIR)/external/utf_converter/utf.c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis/ble_dis.c \
  $(LIBRARIES_DIR)/components/thread/utils/thread_utils.c \
  $(PROJ_DIR)/Unit_tests/unitTests.c \
  $(PROJ_DIR)/Unit_tests/test_utils.c \
  $(PROJ_DIR)/Unit_tests/test_smartvalve.c \
  $(PROJ_DIR)/Unit_tests/test_uart_interpreter.c \
  $(PROJ_DIR)/Unit_tests/test_thread_network_utils.c \
  $(PROJ_DIR)/Unit_tests/test_log.c \

# Include folders common to all targets
INC_FOLDERS += \
  ../config \
  $(LIBRARIES_DIR)/components \
  $(LIBRARIES_DIR)/components/ble/ble_advertising \
  $(LIBRARIES_DIR)/components/ble/ble_dtm \
  $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager \
  $(LIBRARIES_DIR)/components/ble/ble_racp \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_ancs_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_ans_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_cscs \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_cts_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_dfu \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_gls \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_hids \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_hts \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_lls \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs_c \
  $(LIBRARIES_DIR)/components/ble/ble_services/ble_tps \
  $(LIBRARIES_DIR)/components/ble/common \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_gq \
  $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr \
  $(LIBRARIES_DIR)/components/ble/peer_manager \
  $(LIBRARIES_DIR)/components/boards \
  $(LIBRARIES_DIR)/components/libraries/atomic \
  $(LIBRARIES_DIR)/components/libraries/atomic_fifo \
  $(LIBRARIES_DIR)/components/libraries/atomic_flags \
  $(LIBRARIES_DIR)/components/libraries/balloc \
  $(LIBRARIES_DIR)/components/libraries/bootloader \
  $(LIBRARIES_DIR)/components/libraries/bootloader/ble_dfu \
  $(LIBRARIES_DIR)/components/libraries/bsp \
  $(LIBRARIES_DIR)/components/libraries/button \
  $(LIBRARIES_DIR)/components/libraries/cli \
  $(LIBRARIES_DIR)/components/libraries/crc16 \
  $(LIBRARIES_DIR)/components/libraries/crc32 \
  $(LIBRARIES_DIR)/components/libraries/crypto \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310 \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310_bl \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/cifra \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/mbedtls \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/micro_ecc \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_sw \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon \
  $(LIBRARIES_DIR)/components/libraries/crypto/backend/optiga \
  $(LIBRARIES_DIR)/components/libraries/csense \
  $(LIBRARIES_DIR)/components/libraries/csense_drv \
  $(LIBRARIES_DIR)/components/libraries/delay \
  $(LIBRARIES_DIR)/components/libraries/ecc \
  $(LIBRARIES_DIR)/components/libraries/experimental_section_vars \
  $(LIBRARIES_DIR)/components/libraries/experimental_task_manager \
  $(LIBRARIES_DIR)/components/libraries/fds \
  $(LIBRARIES_DIR)/components/libraries/fifo \
  $(LIBRARIES_DIR)/components/libraries/fstorage \
  $(LIBRARIES_DIR)/components/libraries/gfx \
  $(LIBRARIES_DIR)/components/libraries/gpiote \
  $(LIBRARIES_DIR)/components/libraries/hardfault \
  $(LIBRARIES_DIR)/components/libraries/hci \
  $(LIBRARIES_DIR)/components/libraries/led_softblink \
  $(LIBRARIES_DIR)/components/libraries/libuarte \
  $(LIBRARIES_DIR)/components/libraries/log \
  $(LIBRARIES_DIR)/components/libraries/log/src \
  $(LIBRARIES_DIR)/components/libraries/low_power_pwm \
  $(LIBRARIES_DIR)/components/libraries/mem_manager \
  $(LIBRARIES_DIR)/components/libraries/memobj \
  $(LIBRARIES_DIR)/components/libraries/mpu \
  $(LIBRARIES_DIR)/components/libraries/mutex \
  $(LIBRARIES_DIR)/components/libraries/pwm \
  $(LIBRARIES_DIR)/components/libraries/pwr_mgmt \
  $(LIBRARIES_DIR)/components/libraries/queue \
  $(LIBRARIES_DIR)/components/libraries/ringbuf \
  $(LIBRARIES_DIR)/components/libraries/scheduler \
  $(LIBRARIES_DIR)/components/libraries/sdcard \
  $(LIBRARIES_DIR)/components/libraries/serial \
  $(LIBRARIES_DIR)/components/libraries/sha256 \
  $(LIBRARIES_DIR)/components/libraries/slip \
  $(LIBRARIES_DIR)/components/libraries/sortlist \
  $(LIBRARIES_DIR)/components/libraries/spi_mngr \
  $(LIBRARIES_DIR)/components/libraries/stack_guard \
  $(LIBRARIES_DIR)/components/libraries/stack_info \
  $(LIBRARIES_DIR)/components/libraries/strerror \
  $(LIBRARIES_DIR)/components/libraries/svc \
  $(LIBRARIES_DIR)/components/libraries/timer \
  $(LIBRARIES_DIR)/components/libraries/twi_mngr \
  $(LIBRARIES_DIR)/components/libraries/twi_sensor \
  $(LIBRARIES_DIR)/components/libraries/uart \
  $(LIBRARIES_DIR)/components/libraries/usbd \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/audio \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc/acm \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/hid \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/generic \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/kbd \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/mouse \
  $(LIBRARIES_DIR)/components/libraries/usbd/class/msc \
  $(LIBRARIES_DIR)/components/libraries/util \
  $(LIBRARIES_DIR)/components/softdevice/common \
  $(LIBRARIES_DIR)/components/softdevice/mbr/headers \
  $(LIBRARIES_DIR)/components/softdevice/s140/headers \
  $(LIBRARIES_DIR)/components/softdevice/s140/headers/nrf52 \
  $(LIBRARIES_DIR)/components/thread/utils \
  $(LIBRARIES_DIR)/components/toolchain/cmsis/include \
  $(LIBRARIES_DIR)/external/fprintf \
  $(LIBRARIES_DIR)/external/micro-ecc/micro-ecc \
  $(LIBRARIES_DIR)/external/nrf_cc310/include \
  $(LIBRARIES_DIR)/external/nrf_cc310_bl/include \
  $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src \
  $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem \
  $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio \
  $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/rsch/raal/softdevice \
  $(LIBRARIES_DIR)/external/nrf_oberon \
  $(LIBRARIES_DIR)/external/nrf_oberon/include \
  $(LIBRARIES_DIR)/external/openthread/include \
  $(LIBRARIES_DIR)/external/openthread/include/openthread \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/config \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/include \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/mbedtls_plat_config \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/nrf_cc310_plat/include \
  $(LIBRARIES_DIR)/external/openthread/project/config \
  $(LIBRARIES_DIR)/external/openthread/project/nrf52840 \
  $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power \
  $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src \
  $(LIBRARIES_DIR)/external/segger_rtt \
  $(LIBRARIES_DIR)/external/utf_converter \
  $(LIBRARIES_DIR)/integration/nrfx \
  $(LIBRARIES_DIR)/integration/nrfx/legacy \
  $(LIBRARIES_DIR)/modules/nrfx \
  $(LIBRARIES_DIR)/modules/nrfx/drivers/include \
  $(LIBRARIES_DIR)/modules/nrfx/hal \
  $(LIBRARIES_DIR)/modules/nrfx/mdk \
  $(SC_DIR) \
  $(SC_DIR)/Thread \
  $(SC_DIR)/Thread/Thread_ressources \
  $(SC_DIR)/Thread/Process \
  $(SC_DIR)/BLE \
  $(SC_DIR)/Components/Flash \
  $(SC_DIR)/UART \
  $(SC_DIR)/Utils \
  $(PROJ_DIR)/Unit_tests \
  External_libs \

# Libraries common to all targets
LIB_FILES += \
  $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-platform-utils.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue_cc310.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_cc310_backend.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_tls_vanilla.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_x509_vanilla.a \
  $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libnrf_cc310_platform_0.9.1.a \
  $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libnordicsemi-nrf52840-radio-driver-softdevice.a \
  $(LIBRARIES_DIR)/external/openthread/project/nrf52840/openthread_nrf52840/softdevice/uart/armgcc/libopenthread-nrf52840-softdevice-sdk.a \
  $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-cli-ftd.a \
  $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-ftd.a \
  $(LIBRARIES_DIR)/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.3.a \

# Optimization flags
OPT = -O3 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto

# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DAPP_TIMER_V2
CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
CFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
CFLAGS += -DBOARD_PCA10056
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DENABLE_FEM
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DINITIALIZE_USER_SECTIONS
CFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
CFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
CFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
CFLAGS += -DNO_VTOR_CONFIG
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DNRF_SD_BLE_API_VERSION=7
CFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
CFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
CFLAGS += -DOPENTHREAD_FTD=1
CFLAGS += -DS140
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
CFLAGS += -DCLOCK_CONFIG_LF_SRC=0
CFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
CFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
CFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
CFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
CFLAGS += -DUART1_ENABLED=1
CFLAGS += -DPOWER_ENABLED=1
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums

# C++ flags common to all targets
CXXFLAGS += $(OPT)
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DAPP_TIMER_V2
ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
ASMFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
ASMFLAGS += -DBOARD_PCA10056
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DENABLE_FEM
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DINITIALIZE_USER_SECTIONS
ASMFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
ASMFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
ASMFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
ASMFLAGS += -DNO_VTOR_CONFIG
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=7
ASMFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
ASMFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
ASMFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
ASMFLAGS += -DOPENTHREAD_FTD=1
ASMFLAGS += -DS140
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
ASMFLAGS += -DCLOCK_CONFIG_LF_SRC=0
ASMFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
ASMFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
ASMFLAGS += -DUART1_ENABLED=1
ASMFLAGS += -DPOWER_ENABLED=1

# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(LIBRARIES_DIR)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs

nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=1024
nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=8192
nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=8192

# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm -lstdc++


.PHONY: default help

# Default target - first one defined
default: nrf52840_xxaa

# Print all targets that can be built
help:
	@echo following targets are available:
	@echo		nrf52840_xxaa
	@echo		flash_softdevice
	@echo		sdk_config - starting external tool for editing sdk_config.h
	@echo		flash      - flashing binary

TEMPLATE_PATH := $(LIBRARIES_DIR)/components/toolchain/gcc


include $(TEMPLATE_PATH)/Makefile.common

$(foreach target, $(TARGETS), $(call define_target, $(target)))

.PHONY: flash flash_softdevice erase

# Flash the program
flash: default
	@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex --sectorerase
	nrfjprog -f nrf52 --reset

# Flash softdevice
flash_softdevice:
	@echo Flashing: s140_nrf52_7.0.1_softdevice.hex
	nrfjprog -f nrf52 --program $(LIBRARIES_DIR)/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --sectorerase
	nrfjprog -f nrf52 --reset

erase:
	nrfjprog -f nrf52 --eraseall

SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(LIBRARIES_DIR)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
	java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)

And here is the error I get:

C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc>make -C C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc
Assembling file: gcc_startup_nrf52840.S
make: Entering directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'
Compiling file: nrf_log_backend_rtt.c
Compiling file: nrf_log_backend_serial.c
Compiling file: nrf_log_default_backends.c
Compiling file: nrf_log_frontend.c
Compiling file: nrf_log_str_formatter.c
Compiling file: app_button.c
Compiling file: app_error.c
Compiling file: app_error_handler_gcc.c
Compiling file: app_error_weak.c
Compiling file: app_fifo.c
Compiling file: app_scheduler.c
Compiling file: app_timer2.c
Compiling file: app_uart_fifo.c
Compiling file: app_util_platform.c
Compiling file: assert.c
Compiling file: drv_rtc.c
Compiling file: hardfault_implementation.c
Compiling file: mem_manager.c
Compiling file: nrf_assert.c
Compiling file: nrf_atfifo.c
Compiling file: nrf_atflags.c
Compiling file: nrf_atomic.c
Compiling file: nrf_balloc.c
Compiling file: nrf_fprintf.c
Compiling file: nrf_fprintf_format.c
Compiling file: nrf_memobj.c
Compiling file: nrf_pwr_mgmt.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_section_iter.c
Compiling file: nrf_sortlist.c
Compiling file: nrf_strerror.c
Compiling file: retarget.c
Compiling file: nrf_serial.c
Compiling file: nrf_queue.c
Compiling file: nrf_fstorage.c
Compiling file: nrf_fstorage_sd.c
Compiling file: fds.c
Compiling file: ecc.c
Compiling file: crc16.c
Compiling file: nrf_libuarte_async.c
Compiling file: nrf_libuarte_drv.c
Linking target: _build/nrf52840_xxaa.out
c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: _build/nrf52840_xxaa.out section `.fini' will not fit in region `UNPLACED_SECTIONS'
c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: region `UNPLACED_SECTIONS' overflowed by 5 bytes
_build/nrf52840_xxaa/nrf_log_backend_rtt.c.o: In function `serial_tx':
C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/components/libraries/log/src/nrf_log_backend_rtt.c:68: undefined reference to `SEGGER_RTT_WriteNoLock'
_build/nrf52840_xxaa/nrf_fstorage_sd.c.o: In function `nrf_fstorage_sys_evt_handler':
C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/components/libraries/fstorage/nrf_fstorage_sd.c:577: undefined reference to `nrf_sdh_request_continue'
C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/components/libraries/fstorage/nrf_fstorage_sd.c:577: undefined reference to `nrf_sdh_request_continue'
C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/components/libraries/fstorage/nrf_fstorage_sd.c:577: undefined reference to `nrf_sdh_request_continue'
collect2.exe: error: ld returned 1 exit status
make: *** [_build/nrf52840_xxaa.out] Error 1
make: Leaving directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'

C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc>


Here is my .ld file:
BT840.ld

Do you have an idea why I have this error ?

Thank you

  • Hello,

    It seems like it would be better to use emBuild for this. That way you know you are always compiling the project with the same set of libraries, toolchain, and project configurations. Or is it something you have considered already?

    In the Makefile you are including the startup files for Segger embedded studio. These need to be replaced with the GCC ones. Please use the existing SDK makefiles as a reference.

    Best regards,

    Vidar

  • Yes I know emBuild and it works well for my project but here I wanted to use a makefile to automate the compilation but also to make it easier to go to another IDE. All the projects in my company use STM32CubeIDE and so I would also like to be able to more easily migrate my project which was developed on SEGGER Embeded Studio to STM32CubeIDE.

    I think the '#' I put in front of these lines were misinterpreted (I wanted to comment them out):
    #$(LIBRARIES_DIR)/modules/nrfx/mdk/ses_startup_nrf52840.s \
    #$(LIBRARIES_DIR)/modules/nrfx/mdk/ses_startup_nrf_common.s\

    But erasing these lines does not change this error.

    Here is my new makefile:

    PROJECT_NAME     := BT840
    TARGETS          := nrf52840_xxaa
    OUTPUT_DIRECTORY := _build
    
    SDK_ROOT := ../../..
    PROJ_DIR := ../..
    LIBRARIES_DIR := $(SDK_ROOT)/Libraries
    SC_DIR := $(PROJ_DIR)/Source_codes
    
    $(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
      LINKER_SCRIPT  := BT840.ld
    
    # Source files common to all targets
    SRC_FILES += \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_rtt.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_serial.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_default_backends.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_frontend.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_str_formatter.c \
      $(LIBRARIES_DIR)/components/libraries/button/app_button.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error_handler_gcc.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error_weak.c \
      $(LIBRARIES_DIR)/components/libraries/fifo/app_fifo.c \
      $(LIBRARIES_DIR)/components/libraries/scheduler/app_scheduler.c \
      $(LIBRARIES_DIR)/components/libraries/timer/app_timer2.c \
      $(LIBRARIES_DIR)/components/libraries/uart/app_uart_fifo.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_util_platform.c \
      $(LIBRARIES_DIR)/components/libraries/assert/assert.c \
      $(LIBRARIES_DIR)/components/libraries/timer/drv_rtc.c \
      $(LIBRARIES_DIR)/components/libraries/hardfault/hardfault_implementation.c \
      $(LIBRARIES_DIR)/components/libraries/mem_manager/mem_manager.c \
      $(LIBRARIES_DIR)/components/libraries/util/nrf_assert.c \
      $(LIBRARIES_DIR)/components/libraries/atomic_fifo/nrf_atfifo.c \
      $(LIBRARIES_DIR)/components/libraries/atomic_flags/nrf_atflags.c \
      $(LIBRARIES_DIR)/components/libraries/atomic/nrf_atomic.c \
      $(LIBRARIES_DIR)/components/libraries/balloc/nrf_balloc.c \
      $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf.c \
      $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf_format.c \
      $(LIBRARIES_DIR)/components/libraries/memobj/nrf_memobj.c \
      $(LIBRARIES_DIR)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \
      $(LIBRARIES_DIR)/components/libraries/ringbuf/nrf_ringbuf.c \
      $(LIBRARIES_DIR)/components/libraries/experimental_section_vars/nrf_section_iter.c \
      $(LIBRARIES_DIR)/components/libraries/sortlist/nrf_sortlist.c \
      $(LIBRARIES_DIR)/components/libraries/strerror/nrf_strerror.c \
      $(LIBRARIES_DIR)/components/libraries/uart/retarget.c \
      $(LIBRARIES_DIR)/components/libraries/serial/nrf_serial.c \
      $(LIBRARIES_DIR)/components/libraries/queue/nrf_queue.c \
      $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage.c \
      $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage_sd.c \
      $(LIBRARIES_DIR)/components/libraries/fds/fds.c \
      $(LIBRARIES_DIR)/components/libraries/ecc/ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crc16/crc16.c \
      $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_async.c \
      $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_drv.c \
      $(LIBRARIES_DIR)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
      $(LIBRARIES_DIR)/modules/nrfx/mdk/system_nrf52840.c \
      $(SC_DIR)/Utils/multiprotocol_802154_config.c \
      $(LIBRARIES_DIR)/components/boards/boards.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_clock.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_uart.c \
      $(LIBRARIES_DIR)/modules/nrfx/hal/nrf_nvmc.c \
      $(LIBRARIES_DIR)/modules/nrfx/soc/nrfx_atomic.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_clock.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_gpiote.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_nvmc.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_uart.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_uarte.c \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power/nrf_drv_power.c \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src/nrfx_power.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_wdt.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_rng.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rng.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_ppi.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rtc.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_timer.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
      $(SC_DIR)/main.c \
      $(SC_DIR)/smartvalve.c \
      $(SC_DIR)/BLE/ble_thread_diagnostic.c \
      $(SC_DIR)/BLE/ble_utils.c \
      $(SC_DIR)/Components/Flash/flashDataStorage.c \
      $(SC_DIR)/Thread/Process/process_change_network_settings.c \
      $(SC_DIR)/Thread/Process/process_get_routing_info.c \
      $(SC_DIR)/Thread/Process/process_get_routing_info_from_neighbors.c \
      $(SC_DIR)/Thread/Process/process_get_hydraulic_data.c \
      $(SC_DIR)/Thread/Thread_ressources/hydraulicData_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/light_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/routingInfo_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/uart_ressource.c \
      $(SC_DIR)/Thread/com.c \
      $(SC_DIR)/Thread/thread_network_utils.c \
      $(SC_DIR)/UART/uart.c \
      $(SC_DIR)/UART/uart_interpreter.c \
      $(SC_DIR)/Utils/utils.c \
      $(SC_DIR)/Utils/log.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_ble.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_soc.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_printf.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_advdata.c \
      $(LIBRARIES_DIR)/components/ble/ble_advertising/ble_advertising.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_conn_params.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_conn_state.c \
      $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_srv_common.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr/nrf_ble_qwr.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/auth_status_tracker.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/gatt_cache_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/gatts_cache_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/id_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/nrf_ble_lesc.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_data_storage.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_database.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_id.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager_handler.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/pm_buffer.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/security_dispatcher.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/security_manager.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aead.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes_shared.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdh.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_eddsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_error.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hash.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hkdf.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hmac.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_init.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_rng.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_shared.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_chacha_poly_aead.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdh.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_eddsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hash.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hmac.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_scan/nrf_ble_scan.c \
      $(LIBRARIES_DIR)/components/ble/ble_db_discovery/ble_db_discovery.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gq/nrf_ble_gq.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_init.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng_mbedtls.c \
      $(LIBRARIES_DIR)/external/utf_converter/utf.c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis/ble_dis.c \
      $(LIBRARIES_DIR)/components/thread/utils/thread_utils.c \
      $(PROJ_DIR)/Unit_tests/unitTests.c \
      $(PROJ_DIR)/Unit_tests/test_utils.c \
      $(PROJ_DIR)/Unit_tests/test_smartvalve.c \
      $(PROJ_DIR)/Unit_tests/test_uart_interpreter.c \
      $(PROJ_DIR)/Unit_tests/test_thread_network_utils.c \
      $(PROJ_DIR)/Unit_tests/test_log.c \
    
    # Include folders common to all targets
    INC_FOLDERS += \
      ../config \
      $(LIBRARIES_DIR)/components \
      $(LIBRARIES_DIR)/components/ble/ble_advertising \
      $(LIBRARIES_DIR)/components/ble/ble_dtm \
      $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager \
      $(LIBRARIES_DIR)/components/ble/ble_racp \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ancs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ans_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_cscs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_cts_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dfu \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_gls \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hids \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hts \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lls \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_tps \
      $(LIBRARIES_DIR)/components/ble/common \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gq \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr \
      $(LIBRARIES_DIR)/components/ble/peer_manager \
      $(LIBRARIES_DIR)/components/boards \
      $(LIBRARIES_DIR)/components/libraries/atomic \
      $(LIBRARIES_DIR)/components/libraries/atomic_fifo \
      $(LIBRARIES_DIR)/components/libraries/atomic_flags \
      $(LIBRARIES_DIR)/components/libraries/balloc \
      $(LIBRARIES_DIR)/components/libraries/bootloader \
      $(LIBRARIES_DIR)/components/libraries/bootloader/ble_dfu \
      $(LIBRARIES_DIR)/components/libraries/bsp \
      $(LIBRARIES_DIR)/components/libraries/button \
      $(LIBRARIES_DIR)/components/libraries/cli \
      $(LIBRARIES_DIR)/components/libraries/crc16 \
      $(LIBRARIES_DIR)/components/libraries/crc32 \
      $(LIBRARIES_DIR)/components/libraries/crypto \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310 \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310_bl \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cifra \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/mbedtls \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/micro_ecc \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_sw \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/optiga \
      $(LIBRARIES_DIR)/components/libraries/csense \
      $(LIBRARIES_DIR)/components/libraries/csense_drv \
      $(LIBRARIES_DIR)/components/libraries/delay \
      $(LIBRARIES_DIR)/components/libraries/ecc \
      $(LIBRARIES_DIR)/components/libraries/experimental_section_vars \
      $(LIBRARIES_DIR)/components/libraries/experimental_task_manager \
      $(LIBRARIES_DIR)/components/libraries/fds \
      $(LIBRARIES_DIR)/components/libraries/fifo \
      $(LIBRARIES_DIR)/components/libraries/fstorage \
      $(LIBRARIES_DIR)/components/libraries/gfx \
      $(LIBRARIES_DIR)/components/libraries/gpiote \
      $(LIBRARIES_DIR)/components/libraries/hardfault \
      $(LIBRARIES_DIR)/components/libraries/hci \
      $(LIBRARIES_DIR)/components/libraries/led_softblink \
      $(LIBRARIES_DIR)/components/libraries/libuarte \
      $(LIBRARIES_DIR)/components/libraries/log \
      $(LIBRARIES_DIR)/components/libraries/log/src \
      $(LIBRARIES_DIR)/components/libraries/low_power_pwm \
      $(LIBRARIES_DIR)/components/libraries/mem_manager \
      $(LIBRARIES_DIR)/components/libraries/memobj \
      $(LIBRARIES_DIR)/components/libraries/mpu \
      $(LIBRARIES_DIR)/components/libraries/mutex \
      $(LIBRARIES_DIR)/components/libraries/pwm \
      $(LIBRARIES_DIR)/components/libraries/pwr_mgmt \
      $(LIBRARIES_DIR)/components/libraries/queue \
      $(LIBRARIES_DIR)/components/libraries/ringbuf \
      $(LIBRARIES_DIR)/components/libraries/scheduler \
      $(LIBRARIES_DIR)/components/libraries/sdcard \
      $(LIBRARIES_DIR)/components/libraries/serial \
      $(LIBRARIES_DIR)/components/libraries/sha256 \
      $(LIBRARIES_DIR)/components/libraries/slip \
      $(LIBRARIES_DIR)/components/libraries/sortlist \
      $(LIBRARIES_DIR)/components/libraries/spi_mngr \
      $(LIBRARIES_DIR)/components/libraries/stack_guard \
      $(LIBRARIES_DIR)/components/libraries/stack_info \
      $(LIBRARIES_DIR)/components/libraries/strerror \
      $(LIBRARIES_DIR)/components/libraries/svc \
      $(LIBRARIES_DIR)/components/libraries/timer \
      $(LIBRARIES_DIR)/components/libraries/twi_mngr \
      $(LIBRARIES_DIR)/components/libraries/twi_sensor \
      $(LIBRARIES_DIR)/components/libraries/uart \
      $(LIBRARIES_DIR)/components/libraries/usbd \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/audio \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc/acm \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/generic \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/kbd \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/mouse \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/msc \
      $(LIBRARIES_DIR)/components/libraries/util \
      $(LIBRARIES_DIR)/components/softdevice/common \
      $(LIBRARIES_DIR)/components/softdevice/mbr/headers \
      $(LIBRARIES_DIR)/components/softdevice/s140/headers \
      $(LIBRARIES_DIR)/components/softdevice/s140/headers/nrf52 \
      $(LIBRARIES_DIR)/components/thread/utils \
      $(LIBRARIES_DIR)/components/toolchain/cmsis/include \
      $(LIBRARIES_DIR)/external/fprintf \
      $(LIBRARIES_DIR)/external/micro-ecc/micro-ecc \
      $(LIBRARIES_DIR)/external/nrf_cc310/include \
      $(LIBRARIES_DIR)/external/nrf_cc310_bl/include \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/rsch/raal/softdevice \
      $(LIBRARIES_DIR)/external/nrf_oberon \
      $(LIBRARIES_DIR)/external/nrf_oberon/include \
      $(LIBRARIES_DIR)/external/openthread/include \
      $(LIBRARIES_DIR)/external/openthread/include/openthread \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/config \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/include \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/mbedtls_plat_config \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/nrf_cc310_plat/include \
      $(LIBRARIES_DIR)/external/openthread/project/config \
      $(LIBRARIES_DIR)/external/openthread/project/nrf52840 \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src \
      $(LIBRARIES_DIR)/external/segger_rtt \
      $(LIBRARIES_DIR)/external/utf_converter \
      $(LIBRARIES_DIR)/integration/nrfx \
      $(LIBRARIES_DIR)/integration/nrfx/legacy \
      $(LIBRARIES_DIR)/modules/nrfx \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/include \
      $(LIBRARIES_DIR)/modules/nrfx/hal \
      $(LIBRARIES_DIR)/modules/nrfx/mdk \
      $(SC_DIR) \
      $(SC_DIR)/Thread \
      $(SC_DIR)/Thread/Thread_ressources \
      $(SC_DIR)/Thread/Process \
      $(SC_DIR)/BLE \
      $(SC_DIR)/Components/Flash \
      $(SC_DIR)/UART \
      $(SC_DIR)/Utils \
      $(PROJ_DIR)/Unit_tests \
      External_libs \
    
    # Libraries common to all targets
    LIB_FILES += \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-platform-utils.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue_cc310.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_cc310_backend.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_tls_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libmbedtls_x509_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/lib/libnrf_cc310_platform_0.9.1.a \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libnordicsemi-nrf52840-radio-driver-softdevice.a \
      $(LIBRARIES_DIR)/external/openthread/project/nrf52840/openthread_nrf52840/softdevice/uart/armgcc/libopenthread-nrf52840-softdevice-sdk.a \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-cli-ftd.a \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-ftd.a \
      $(LIBRARIES_DIR)/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.3.a \
    
    # Optimization flags
    OPT = -O3 -g3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    # C flags common to all targets
    CFLAGS += $(OPT)
    CFLAGS += -DAPP_TIMER_V2
    CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    CFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
    CFLAGS += -DBOARD_PCA10056
    CFLAGS += -DCONFIG_GPIO_AS_PINRESET
    CFLAGS += -DENABLE_FEM
    CFLAGS += -DFLOAT_ABI_HARD
    CFLAGS += -DINITIALIZE_USER_SECTIONS
    CFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
    CFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
    CFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
    CFLAGS += -DNO_VTOR_CONFIG
    CFLAGS += -DNRF52840_XXAA
    CFLAGS += -DNRF_SD_BLE_API_VERSION=7
    CFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
    CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
    CFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
    CFLAGS += -DOPENTHREAD_FTD=1
    CFLAGS += -DS140
    CFLAGS += -DSOFTDEVICE_PRESENT
    CFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
    CFLAGS += -DCLOCK_CONFIG_LF_SRC=0
    CFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
    CFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
    CFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
    CFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
    CFLAGS += -DUART1_ENABLED=1
    CFLAGS += -DPOWER_ENABLED=1
    CFLAGS += -mcpu=cortex-m4
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS += -Wall -Werror
    CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # keep every function in a separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin -fshort-enums
    
    # C++ flags common to all targets
    CXXFLAGS += $(OPT)
    # Assembler flags common to all targets
    ASMFLAGS += -g3
    ASMFLAGS += -mcpu=cortex-m4
    ASMFLAGS += -mthumb -mabi=aapcs
    ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    ASMFLAGS += -DAPP_TIMER_V2
    ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    ASMFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
    ASMFLAGS += -DBOARD_PCA10056
    ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
    ASMFLAGS += -DENABLE_FEM
    ASMFLAGS += -DFLOAT_ABI_HARD
    ASMFLAGS += -DINITIALIZE_USER_SECTIONS
    ASMFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
    ASMFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
    ASMFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
    ASMFLAGS += -DNO_VTOR_CONFIG
    ASMFLAGS += -DNRF52840_XXAA
    ASMFLAGS += -DNRF_SD_BLE_API_VERSION=7
    ASMFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
    ASMFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
    ASMFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
    ASMFLAGS += -DOPENTHREAD_FTD=1
    ASMFLAGS += -DS140
    ASMFLAGS += -DSOFTDEVICE_PRESENT
    ASMFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
    ASMFLAGS += -DCLOCK_CONFIG_LF_SRC=0
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
    ASMFLAGS += -DUART1_ENABLED=1
    ASMFLAGS += -DPOWER_ENABLED=1
    
    # Linker flags
    LDFLAGS += $(OPT)
    LDFLAGS += -mthumb -mabi=aapcs -L$(LIBRARIES_DIR)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m4
    LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # let linker dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs
    
    nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=1024
    nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=8192
    nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
    nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=8192
    
    # Add standard libraries at the very end of the linker input, after all objects
    # that may need symbols provided by these libraries.
    LIB_FILES += -lc -lnosys -lm -lstdc++
    
    
    .PHONY: default help
    
    # Default target - first one defined
    default: nrf52840_xxaa
    
    # Print all targets that can be built
    help:
    	@echo following targets are available:
    	@echo		nrf52840_xxaa
    	@echo		flash_softdevice
    	@echo		sdk_config - starting external tool for editing sdk_config.h
    	@echo		flash      - flashing binary
    
    TEMPLATE_PATH := $(LIBRARIES_DIR)/components/toolchain/gcc
    
    
    include $(TEMPLATE_PATH)/Makefile.common
    
    $(foreach target, $(TARGETS), $(call define_target, $(target)))
    
    .PHONY: flash flash_softdevice erase
    
    # Flash the program
    flash: default
    	@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
    	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    # Flash softdevice
    flash_softdevice:
    	@echo Flashing: s140_nrf52_7.0.1_softdevice.hex
    	nrfjprog -f nrf52 --program $(LIBRARIES_DIR)/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    erase:
    	nrfjprog -f nrf52 --eraseall
    
    SDK_CONFIG_FILE := ../config/sdk_config.h
    CMSIS_CONFIG_TOOL := $(LIBRARIES_DIR)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
    sdk_config:
    	java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)


    And here is the error log I get:

    C:\Users\Quentin>make -C C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc
    Compiling file: nrf_log_backend_rtt.c
    make: Entering directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'
    Compiling file: nrf_log_backend_serial.c
    Compiling file: nrf_log_default_backends.c
    Compiling file: nrf_log_frontend.c
    Compiling file: nrf_log_str_formatter.c
    Compiling file: app_button.c
    Compiling file: app_error.c
    Compiling file: app_error_handler_gcc.c
    Compiling file: app_error_weak.c
    Compiling file: app_fifo.c
    Compiling file: app_scheduler.c
    Compiling file: app_timer2.c
    Compiling file: app_uart_fifo.c
    Compiling file: app_util_platform.c
    Compiling file: assert.c
    Compiling file: drv_rtc.c
    Compiling file: hardfault_implementation.c
    Compiling file: mem_manager.c
    Compiling file: nrf_assert.c
    Compiling file: nrf_atfifo.c
    Compiling file: nrf_atflags.c
    Compiling file: nrf_atomic.c
    Compiling file: nrf_balloc.c
    Compiling file: nrf_fprintf.c
    Compiling file: nrf_fprintf_format.c
    Compiling file: nrf_memobj.c
    Compiling file: nrf_pwr_mgmt.c
    Compiling file: nrf_ringbuf.c
    Compiling file: nrf_section_iter.c
    Compiling file: nrf_sortlist.c
    Compiling file: nrf_strerror.c
    Compiling file: retarget.c
    Compiling file: nrf_serial.c
    Compiling file: nrf_queue.c
    Compiling file: nrf_fstorage.c
    Compiling file: nrf_fstorage_sd.c
    Compiling file: fds.c
    Compiling file: ecc.c
    Compiling file: crc16.c
    Compiling file: nrf_libuarte_async.c
    Compiling file: nrf_libuarte_drv.c
    Assembling file: gcc_startup_nrf52840.S
    Compiling file: system_nrf52840.c
    Compiling file: multiprotocol_802154_config.c
    Compiling file: boards.c
    Compiling file: nrf_drv_clock.c
    Compiling file: nrf_drv_uart.c
    Compiling file: nrf_nvmc.c
    Compiling file: nrfx_atomic.c
    Compiling file: nrfx_clock.c
    Compiling file: nrfx_gpiote.c
    Compiling file: nrfx_nvmc.c
    Compiling file: nrfx_prs.c
    Compiling file: nrfx_uart.c
    Compiling file: nrfx_uarte.c
    Compiling file: nrf_drv_power.c
    Compiling file: nrfx_power.c
    Compiling file: nrfx_wdt.c
    Compiling file: nrf_drv_rng.c
    Compiling file: nrfx_rng.c
    Compiling file: nrfx_ppi.c
    Compiling file: nrfx_rtc.c
    Compiling file: nrfx_timer.c
    Compiling file: bsp.c
    Compiling file: bsp_btn_ble.c
    Compiling file: bsp_thread.c
    Compiling file: main.c
    Compiling file: smartvalve.c
    Compiling file: ble_thread_diagnostic.c
    Compiling file: ble_utils.c
    Compiling file: flashDataStorage.c
    Compiling file: process_change_network_settings.c
    Compiling file: process_get_routing_info.c
    Compiling file: process_get_routing_info_from_neighbors.c
    Compiling file: process_get_hydraulic_data.c
    Compiling file: hydraulicData_ressource.c
    Compiling file: light_ressource.c
    Compiling file: routingInfo_ressource.c
    Compiling file: uart_ressource.c
    Compiling file: com.c
    Compiling file: thread_network_utils.c
    Compiling file: uart.c
    Compiling file: uart_interpreter.c
    Compiling file: utils.c
    Compiling file: log.c
    Compiling file: nrf_sdh.c
    Compiling file: nrf_sdh_ble.c
    Compiling file: nrf_sdh_soc.c
    Compiling file: SEGGER_RTT.c
    Compiling file: SEGGER_RTT_Syscalls_GCC.c
    Compiling file: SEGGER_RTT_printf.c
    Compiling file: ble_advdata.c
    Compiling file: ble_advertising.c
    Compiling file: ble_conn_params.c
    Compiling file: ble_conn_state.c
    Compiling file: ble_link_ctx_manager.c
    Compiling file: ble_srv_common.c
    Compiling file: nrf_ble_gatt.c
    Compiling file: nrf_ble_qwr.c
    Compiling file: auth_status_tracker.c
    Compiling file: gatt_cache_manager.c
    Compiling file: gatts_cache_manager.c
    Compiling file: id_manager.c
    Compiling file: nrf_ble_lesc.c
    Compiling file: peer_data_storage.c
    Compiling file: peer_database.c
    Compiling file: peer_id.c
    Compiling file: peer_manager.c
    Compiling file: peer_manager_handler.c
    Compiling file: pm_buffer.c
    Compiling file: security_dispatcher.c
    Compiling file: security_manager.c
    Compiling file: nrf_crypto_aead.c
    Compiling file: nrf_crypto_aes.c
    Compiling file: nrf_crypto_aes_shared.c
    Compiling file: nrf_crypto_ecc.c
    Compiling file: nrf_crypto_ecdh.c
    Compiling file: nrf_crypto_ecdsa.c
    Compiling file: nrf_crypto_eddsa.c
    Compiling file: nrf_crypto_error.c
    Compiling file: nrf_crypto_hash.c
    Compiling file: nrf_crypto_hkdf.c
    Compiling file: nrf_crypto_hmac.c
    Compiling file: nrf_crypto_init.c
    Compiling file: nrf_crypto_rng.c
    Compiling file: nrf_crypto_shared.c
    Compiling file: oberon_backend_chacha_poly_aead.c
    Compiling file: oberon_backend_ecc.c
    Compiling file: oberon_backend_ecdh.c
    Compiling file: oberon_backend_ecdsa.c
    Compiling file: oberon_backend_eddsa.c
    Compiling file: oberon_backend_hash.c
    Compiling file: oberon_backend_hmac.c
    Compiling file: nrf_ble_scan.c
    Compiling file: ble_db_discovery.c
    Compiling file: nrf_ble_gq.c
    Compiling file: nrf_hw_backend_init.c
    Compiling file: nrf_hw_backend_rng.c
    Compiling file: nrf_hw_backend_rng_mbedtls.c
    Compiling file: utf.c
    Compiling file: ble_dis.c
    Compiling file: thread_utils.c
    Compiling file: unitTests.c
    Compiling file: test_utils.c
    Compiling file: test_smartvalve.c
    Compiling file: test_uart_interpreter.c
    Compiling file: test_thread_network_utils.c
    Compiling file: test_log.c
    Linking target: _build/nrf52840_xxaa.out
    _build/nrf52840_xxaa/nrfx_uarte.c.o: In function `UARTE1_IRQHandler':
    c:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/modules/nrfx/drivers/src/nrfx_uarte.c:645: multiple definition of `UARTE1_IRQHandler'
    _build/nrf52840_xxaa/nrf_libuarte_drv.c.o:c:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc/../../../Libraries/components/libraries/libuarte/nrf_libuarte_drv.c:832: first defined here
    c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: _build/nrf52840_xxaa.out section `.fini' will not fit in region `UNPLACED_SECTIONS'
    c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: region `UNPLACED_SECTIONS' overflowed by 5 bytes
    ../../../Libraries/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a(ctr_drbg.c.obj): In function `block_cipher_df':
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:172: undefined reference to `mbedtls_aes_init'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:196: undefined reference to `mbedtls_aes_setkey_enc'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:218: undefined reference to `mbedtls_aes_crypt_ecb'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:235: undefined reference to `mbedtls_aes_setkey_enc'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:244: undefined reference to `mbedtls_aes_crypt_ecb'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:244: undefined reference to `mbedtls_aes_crypt_ecb'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:252: undefined reference to `mbedtls_aes_free'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:252: undefined reference to `mbedtls_aes_free'
    ../../../Libraries/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a(ctr_drbg.c.obj): In function `ctr_drbg_update_internal':
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:301: undefined reference to `mbedtls_aes_crypt_ecb'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:301: undefined reference to `mbedtls_aes_crypt_ecb'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:313: undefined reference to `mbedtls_aes_setkey_enc'
    ../../../Libraries/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a(ctr_drbg.c.obj): In function `mbedtls_ctr_drbg_free':
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:135: undefined reference to `mbedtls_aes_free'
    ../../../Libraries/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a(ctr_drbg.c.obj): In function `mbedtls_ctr_drbg_seed_entropy_len':
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:94: undefined reference to `mbedtls_aes_init'
    /home/kasr/repos/ncs/mbedtls/library/ctr_drbg.c:105: undefined reference to `mbedtls_aes_setkey_enc'
    c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libnosys.a(sbrk.o): In function `_sbrk':
    sbrk.c:(.text._sbrk+0x18): undefined reference to `end'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/nrf52840_xxaa.out] Error 1
    make: Leaving directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'

  • Sorry, I didn't notice you that you had commented those lines. Anyway, I see you are using the linker script generated by SES. My guess is that it is not compatible with the GCC startup lib. I suggest you try to the linker scripts we provided in the SDK instead.

  • Thanks, that was the problem.

    Now I still have linker problems for the OpenThread... Do you see something I forgot?

    Here is my new makefile:

    PROJECT_NAME     := BT840
    TARGETS          := nrf52840_xxaa
    OUTPUT_DIRECTORY := _build
    
    SDK_ROOT := ../../..
    PROJ_DIR := ../..
    LIBRARIES_DIR := $(SDK_ROOT)/Libraries
    SC_DIR := $(PROJ_DIR)/Source_codes
    
    $(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
      LINKER_SCRIPT  := BT840.ld
    
    # Source files common to all targets
    SRC_FILES += \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_rtt.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_backend_serial.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_default_backends.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_frontend.c \
      $(LIBRARIES_DIR)/components/libraries/log/src/nrf_log_str_formatter.c \
      $(LIBRARIES_DIR)/components/libraries/button/app_button.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error_handler_gcc.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_error_weak.c \
      $(LIBRARIES_DIR)/components/libraries/fifo/app_fifo.c \
      $(LIBRARIES_DIR)/components/libraries/scheduler/app_scheduler.c \
      $(LIBRARIES_DIR)/components/libraries/timer/app_timer2.c \
      $(LIBRARIES_DIR)/components/libraries/util/app_util_platform.c \
      $(LIBRARIES_DIR)/components/libraries/assert/assert.c \
      $(LIBRARIES_DIR)/components/libraries/timer/drv_rtc.c \
      $(LIBRARIES_DIR)/components/libraries/hardfault/hardfault_implementation.c \
      $(LIBRARIES_DIR)/components/libraries/mem_manager/mem_manager.c \
      $(LIBRARIES_DIR)/components/libraries/util/nrf_assert.c \
      $(LIBRARIES_DIR)/components/libraries/atomic_fifo/nrf_atfifo.c \
      $(LIBRARIES_DIR)/components/libraries/atomic_flags/nrf_atflags.c \
      $(LIBRARIES_DIR)/components/libraries/atomic/nrf_atomic.c \
      $(LIBRARIES_DIR)/components/libraries/balloc/nrf_balloc.c \
      $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf.c \
      $(LIBRARIES_DIR)/external/fprintf/nrf_fprintf_format.c \
      $(LIBRARIES_DIR)/components/libraries/memobj/nrf_memobj.c \
      $(LIBRARIES_DIR)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \
      $(LIBRARIES_DIR)/components/libraries/ringbuf/nrf_ringbuf.c \
      $(LIBRARIES_DIR)/components/libraries/experimental_section_vars/nrf_section_iter.c \
      $(LIBRARIES_DIR)/components/libraries/sortlist/nrf_sortlist.c \
      $(LIBRARIES_DIR)/components/libraries/strerror/nrf_strerror.c \
      $(LIBRARIES_DIR)/components/libraries/queue/nrf_queue.c \
      $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage.c \
      $(LIBRARIES_DIR)/components/libraries/fstorage/nrf_fstorage_sd.c \
      $(LIBRARIES_DIR)/components/libraries/fds/fds.c \
      $(LIBRARIES_DIR)/components/libraries/ecc/ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crc16/crc16.c \
      $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_async.c \
      $(LIBRARIES_DIR)/components/libraries/libuarte/nrf_libuarte_drv.c \
      $(LIBRARIES_DIR)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
      $(LIBRARIES_DIR)/modules/nrfx/mdk/system_nrf52840.c \
      $(SC_DIR)/Utils/multiprotocol_802154_config.c \
      $(LIBRARIES_DIR)/components/boards/boards.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_clock.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_uart.c \
      $(LIBRARIES_DIR)/modules/nrfx/hal/nrf_nvmc.c \
      $(LIBRARIES_DIR)/modules/nrfx/soc/nrfx_atomic.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_clock.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_gpiote.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_nvmc.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power/nrf_drv_power.c \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src/nrfx_power.c \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/examples/platforms/utils/logging_rtt.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_wdt.c \
      $(LIBRARIES_DIR)/integration/nrfx/legacy/nrf_drv_rng.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rng.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_ppi.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_rtc.c \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/src/nrfx_timer.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
      $(SC_DIR)/main.c \
      $(SC_DIR)/smartvalve.c \
      $(SC_DIR)/BLE/ble_thread_diagnostic.c \
      $(SC_DIR)/BLE/ble_utils.c \
      $(SC_DIR)/Components/Flash/flashDataStorage.c \
      $(SC_DIR)/Thread/Process/process_change_network_settings.c \
      $(SC_DIR)/Thread/Process/process_get_routing_info.c \
      $(SC_DIR)/Thread/Process/process_get_routing_info_from_neighbors.c \
      $(SC_DIR)/Thread/Process/process_get_hydraulic_data.c \
      $(SC_DIR)/Thread/Thread_ressources/hydraulicData_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/light_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/routingInfo_ressource.c \
      $(SC_DIR)/Thread/Thread_ressources/uart_ressource.c \
      $(SC_DIR)/Thread/com.c \
      $(SC_DIR)/Thread/thread_network_utils.c \
      $(SC_DIR)/UART/uart.c \
      $(SC_DIR)/UART/uart_interpreter.c \
      $(SC_DIR)/Utils/utils.c \
      $(SC_DIR)/Utils/log.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_btn_ble.c \
      $(LIBRARIES_DIR)/components/libraries/bsp/bsp_thread.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_ble.c \
      $(LIBRARIES_DIR)/components/softdevice/common/nrf_sdh_soc.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
      $(LIBRARIES_DIR)/external/segger_rtt/SEGGER_RTT_printf.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_advdata.c \
      $(LIBRARIES_DIR)/components/ble/ble_advertising/ble_advertising.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_conn_params.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_conn_state.c \
      $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c \
      $(LIBRARIES_DIR)/components/ble/common/ble_srv_common.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr/nrf_ble_qwr.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/auth_status_tracker.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/gatt_cache_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/gatts_cache_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/id_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/nrf_ble_lesc.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_data_storage.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_database.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_id.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/peer_manager_handler.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/pm_buffer.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/security_dispatcher.c \
      $(LIBRARIES_DIR)/components/ble/peer_manager/security_manager.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aead.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_aes_shared.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdh.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_ecdsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_eddsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_error.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hash.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hkdf.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_hmac.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_init.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_rng.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/nrf_crypto_shared.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_chacha_poly_aead.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecc.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdh.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_ecdsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_eddsa.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hash.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon/oberon_backend_hmac.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_scan/nrf_ble_scan.c \
      $(LIBRARIES_DIR)/components/ble/ble_db_discovery/ble_db_discovery.c \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gq/nrf_ble_gq.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_init.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng.c \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng_mbedtls.c \
      $(LIBRARIES_DIR)/external/utf_converter/utf.c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis/ble_dis.c \
      $(LIBRARIES_DIR)/components/thread/utils/thread_utils.c \
      $(PROJ_DIR)/Unit_tests/unitTests.c \
      $(PROJ_DIR)/Unit_tests/test_utils.c \
      $(PROJ_DIR)/Unit_tests/test_smartvalve.c \
      $(PROJ_DIR)/Unit_tests/test_uart_interpreter.c \
      $(PROJ_DIR)/Unit_tests/test_thread_network_utils.c \
      $(PROJ_DIR)/Unit_tests/test_log.c \
    
    # Include folders common to all targets
    INC_FOLDERS += \
      ../config \
      $(LIBRARIES_DIR)/components \
      $(LIBRARIES_DIR)/components/ble/ble_advertising \
      $(LIBRARIES_DIR)/components/ble/ble_dtm \
      $(LIBRARIES_DIR)/components/ble/ble_link_ctx_manager \
      $(LIBRARIES_DIR)/components/ble/ble_racp \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ancs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ans_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_bas_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_cscs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_cts_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dfu \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_dis \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_gls \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hids \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hrs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_hts \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_ias_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lbs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_lls \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_nus_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_rscs_c \
      $(LIBRARIES_DIR)/components/ble/ble_services/ble_tps \
      $(LIBRARIES_DIR)/components/ble/common \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gatt \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_gq \
      $(LIBRARIES_DIR)/components/ble/nrf_ble_qwr \
      $(LIBRARIES_DIR)/components/ble/peer_manager \
      $(LIBRARIES_DIR)/components/boards \
      $(LIBRARIES_DIR)/components/libraries/atomic \
      $(LIBRARIES_DIR)/components/libraries/atomic_fifo \
      $(LIBRARIES_DIR)/components/libraries/atomic_flags \
      $(LIBRARIES_DIR)/components/libraries/balloc \
      $(LIBRARIES_DIR)/components/libraries/bootloader \
      $(LIBRARIES_DIR)/components/libraries/bootloader/ble_dfu \
      $(LIBRARIES_DIR)/components/libraries/bsp \
      $(LIBRARIES_DIR)/components/libraries/button \
      $(LIBRARIES_DIR)/components/libraries/cli \
      $(LIBRARIES_DIR)/components/libraries/crc16 \
      $(LIBRARIES_DIR)/components/libraries/crc32 \
      $(LIBRARIES_DIR)/components/libraries/crypto \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310 \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cc310_bl \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/cifra \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/mbedtls \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/micro_ecc \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_hw \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/nrf_sw \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/oberon \
      $(LIBRARIES_DIR)/components/libraries/crypto/backend/optiga \
      $(LIBRARIES_DIR)/components/libraries/csense \
      $(LIBRARIES_DIR)/components/libraries/csense_drv \
      $(LIBRARIES_DIR)/components/libraries/delay \
      $(LIBRARIES_DIR)/components/libraries/ecc \
      $(LIBRARIES_DIR)/components/libraries/experimental_section_vars \
      $(LIBRARIES_DIR)/components/libraries/experimental_task_manager \
      $(LIBRARIES_DIR)/components/libraries/fds \
      $(LIBRARIES_DIR)/components/libraries/fifo \
      $(LIBRARIES_DIR)/components/libraries/fstorage \
      $(LIBRARIES_DIR)/components/libraries/gfx \
      $(LIBRARIES_DIR)/components/libraries/gpiote \
      $(LIBRARIES_DIR)/components/libraries/hardfault \
      $(LIBRARIES_DIR)/components/libraries/hci \
      $(LIBRARIES_DIR)/components/libraries/led_softblink \
      $(LIBRARIES_DIR)/components/libraries/libuarte \
      $(LIBRARIES_DIR)/components/libraries/log \
      $(LIBRARIES_DIR)/components/libraries/log/src \
      $(LIBRARIES_DIR)/components/libraries/low_power_pwm \
      $(LIBRARIES_DIR)/components/libraries/mem_manager \
      $(LIBRARIES_DIR)/components/libraries/memobj \
      $(LIBRARIES_DIR)/components/libraries/mpu \
      $(LIBRARIES_DIR)/components/libraries/mutex \
      $(LIBRARIES_DIR)/components/libraries/pwm \
      $(LIBRARIES_DIR)/components/libraries/pwr_mgmt \
      $(LIBRARIES_DIR)/components/libraries/queue \
      $(LIBRARIES_DIR)/components/libraries/ringbuf \
      $(LIBRARIES_DIR)/components/libraries/scheduler \
      $(LIBRARIES_DIR)/components/libraries/sdcard \
      $(LIBRARIES_DIR)/components/libraries/serial \
      $(LIBRARIES_DIR)/components/libraries/sha256 \
      $(LIBRARIES_DIR)/components/libraries/slip \
      $(LIBRARIES_DIR)/components/libraries/sortlist \
      $(LIBRARIES_DIR)/components/libraries/spi_mngr \
      $(LIBRARIES_DIR)/components/libraries/stack_guard \
      $(LIBRARIES_DIR)/components/libraries/stack_info \
      $(LIBRARIES_DIR)/components/libraries/strerror \
      $(LIBRARIES_DIR)/components/libraries/svc \
      $(LIBRARIES_DIR)/components/libraries/timer \
      $(LIBRARIES_DIR)/components/libraries/twi_mngr \
      $(LIBRARIES_DIR)/components/libraries/twi_sensor \
      $(LIBRARIES_DIR)/components/libraries/uart \
      $(LIBRARIES_DIR)/components/libraries/usbd \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/audio \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/cdc/acm \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/generic \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/kbd \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/hid/mouse \
      $(LIBRARIES_DIR)/components/libraries/usbd/class/msc \
      $(LIBRARIES_DIR)/components/libraries/util \
      $(LIBRARIES_DIR)/components/softdevice/common \
      $(LIBRARIES_DIR)/components/softdevice/mbr/headers \
      $(LIBRARIES_DIR)/components/softdevice/s140/headers \
      $(LIBRARIES_DIR)/components/softdevice/s140/headers/nrf52 \
      $(LIBRARIES_DIR)/components/thread/utils \
      $(LIBRARIES_DIR)/components/toolchain/cmsis/include \
      $(LIBRARIES_DIR)/external/fprintf \
      $(LIBRARIES_DIR)/external/micro-ecc/micro-ecc \
      $(LIBRARIES_DIR)/external/nrf_cc310/include \
      $(LIBRARIES_DIR)/external/nrf_cc310_bl/include \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio \
      $(LIBRARIES_DIR)/external/nRF-IEEE-802.15.4-radio-driver/src/rsch/raal/softdevice \
      $(LIBRARIES_DIR)/external/nrf_oberon \
      $(LIBRARIES_DIR)/external/nrf_oberon/include \
      $(LIBRARIES_DIR)/external/openthread/include \
      $(LIBRARIES_DIR)/external/openthread/include/openthread \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/config \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/include \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/mbedtls_plat_config \
      $(LIBRARIES_DIR)/external/openthread/nrf_security/nrf_cc310_plat/include \
      $(LIBRARIES_DIR)/external/openthread/project/config \
      $(LIBRARIES_DIR)/external/openthread/project/nrf52840 \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/drivers/power \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/third_party/NordicSemiconductor/nrfx/drivers/src \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/examples/platforms \
      $(LIBRARIES_DIR)/external/openthread/project/openthread/examples/platforms/utils \
      $(LIBRARIES_DIR)/external/segger_rtt \
      $(LIBRARIES_DIR)/external/utf_converter \
      $(LIBRARIES_DIR)/integration/nrfx \
      $(LIBRARIES_DIR)/integration/nrfx/legacy \
      $(LIBRARIES_DIR)/modules/nrfx \
      $(LIBRARIES_DIR)/modules/nrfx/drivers/include \
      $(LIBRARIES_DIR)/modules/nrfx/hal \
      $(LIBRARIES_DIR)/modules/nrfx/mdk \
      $(SC_DIR) \
      $(SC_DIR)/Thread \
      $(SC_DIR)/Thread/Thread_ressources \
      $(SC_DIR)/Thread/Process \
      $(SC_DIR)/BLE \
      $(SC_DIR)/Components/Flash \
      $(SC_DIR)/UART \
      $(SC_DIR)/Utils \
      $(PROJ_DIR)/Unit_tests \
      External_libs \
    
    # Libraries common to all targets
    LIB_FILES += \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-ftd.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedcrypto_glue.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedcrypto_glue_cc310.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libopenthread-platform-utils.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedtls_tls_vanilla.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedtls_x509_vanilla.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libnrf_cc310_platform_0.9.2.a \
      $(LIBRARIES_DIR)/external/openthread/project/nrf52840/openthread_nrf52840/softdevice/uart/armgcc/libopenthread-nrf52840-softdevice-sdk.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedcrypto_cc310_backend.a \
      $(LIBRARIES_DIR)/external/nrf_security/lib/libmbedtls_base_vanilla.a \
      $(LIBRARIES_DIR)/external/openthread/lib/nrf52840/gcc/libnordicsemi-nrf52840-radio-driver-softdevice.a \
      $(LIBRARIES_DIR)/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.3.a \
    
    # Optimization flags
    OPT = -O3 -g3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    # C flags common to all targets
    CFLAGS += $(OPT)
    CFLAGS += -DAPP_TIMER_V2
    CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    CFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
    CFLAGS += -DBOARD_PCA10056
    CFLAGS += -DCONFIG_GPIO_AS_PINRESET
    CFLAGS += -DENABLE_FEM
    CFLAGS += -DFLOAT_ABI_HARD
    CFLAGS += -DINITIALIZE_USER_SECTIONS
    CFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
    CFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
    CFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
    CFLAGS += -DNO_VTOR_CONFIG
    CFLAGS += -DNRF52840_XXAA
    CFLAGS += -DNRF_SD_BLE_API_VERSION=7
    CFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
    CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
    CFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
    CFLAGS += -DOPENTHREAD_FTD=1
    CFLAGS += -DS140
    CFLAGS += -DSOFTDEVICE_PRESENT
    CFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
    CFLAGS += -DCLOCK_CONFIG_LF_SRC=0
    CFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
    CFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
    CFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
    CFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
    CFLAGS += -DUART1_ENABLED=1
    CFLAGS += -DPOWER_ENABLED=1
    CFLAGS += -mcpu=cortex-m4
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS += -Wall -Werror
    CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # keep every function in a separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin -fshort-enums
    
    # C++ flags common to all targets
    CXXFLAGS += $(OPT)
    # Assembler flags common to all targets
    ASMFLAGS += -g3
    ASMFLAGS += -mcpu=cortex-m4
    ASMFLAGS += -mthumb -mabi=aapcs
    ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    ASMFLAGS += -DAPP_TIMER_V2
    ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    ASMFLAGS += -DAPP_UART_DRIVER_INSTANCE=1
    ASMFLAGS += -DBOARD_PCA10056
    ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
    ASMFLAGS += -DENABLE_FEM
    ASMFLAGS += -DFLOAT_ABI_HARD
    ASMFLAGS += -DINITIALIZE_USER_SECTIONS
    ASMFLAGS += -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\"
    ASMFLAGS += -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\"
    ASMFLAGS += -DMULTIPROTOCOL_802154_CONFIG_PRESENT
    ASMFLAGS += -DNO_VTOR_CONFIG
    ASMFLAGS += -DNRF52840_XXAA
    ASMFLAGS += -DNRF_SD_BLE_API_VERSION=7
    ASMFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE
    ASMFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
    ASMFLAGS += -DOPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\"
    ASMFLAGS += -DOPENTHREAD_FTD=1
    ASMFLAGS += -DS140
    ASMFLAGS += -DSOFTDEVICE_PRESENT
    ASMFLAGS += -DNRFX_CLOCK_CONFIG_LF_SRC=0
    ASMFLAGS += -DCLOCK_CONFIG_LF_SRC=0
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_SRC=0
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_CTIV=16
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2
    ASMFLAGS += -DNRF_SDH_CLOCK_LF_ACCURACY=1
    ASMFLAGS += -DUART1_ENABLED=1
    ASMFLAGS += -DPOWER_ENABLED=1
    
    # Linker flags
    LDFLAGS += $(OPT)
    LDFLAGS += -mthumb -mabi=aapcs -L$(LIBRARIES_DIR)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m4
    LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # let linker dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs
    
    nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=1024
    nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=8192
    nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
    nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=8192
    
    # Add standard libraries at the very end of the linker input, after all objects
    # that may need symbols provided by these libraries.
    LIB_FILES += -lc -lnosys -lm -lstdc++
    
    
    .PHONY: default help
    
    # Default target - first one defined
    default: nrf52840_xxaa
    
    # Print all targets that can be built
    help:
    	@echo following targets are available:
    	@echo		nrf52840_xxaa
    	@echo		flash_softdevice
    	@echo		sdk_config - starting external tool for editing sdk_config.h
    	@echo		flash      - flashing binary
    
    TEMPLATE_PATH := $(LIBRARIES_DIR)/components/toolchain/gcc
    
    
    include $(TEMPLATE_PATH)/Makefile.common
    
    $(foreach target, $(TARGETS), $(call define_target, $(target)))
    
    .PHONY: flash flash_softdevice erase
    
    # Flash the program
    flash: default
    	@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
    	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    # Flash softdevice
    flash_softdevice:
    	@echo Flashing: s140_nrf52_7.0.1_softdevice.hex
    	nrfjprog -f nrf52 --program $(LIBRARIES_DIR)/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    erase:
    	nrfjprog -f nrf52 --eraseall
    
    SDK_CONFIG_FILE := ../config/sdk_config.h
    CMSIS_CONFIG_TOOL := $(LIBRARIES_DIR)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
    sdk_config:
    	java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
    


    And here is the error log I get:
    C:\Users\Quentin>make -C C:\DocTA\Soft\ble-thread\BT840\Embedded\Application\Project\armgcc
    Compiling file: nrf_log_backend_rtt.c
    make: Entering directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'
    Compiling file: nrf_log_backend_serial.c
    Compiling file: nrf_log_default_backends.c
    Compiling file: nrf_log_frontend.c
    Compiling file: nrf_log_str_formatter.c
    Compiling file: app_button.c
    Compiling file: app_error.c
    Compiling file: app_error_handler_gcc.c
    Compiling file: app_error_weak.c
    Compiling file: app_fifo.c
    Compiling file: app_scheduler.c
    Compiling file: app_timer2.c
    Compiling file: app_util_platform.c
    Compiling file: assert.c
    Compiling file: drv_rtc.c
    Compiling file: hardfault_implementation.c
    Compiling file: mem_manager.c
    Compiling file: nrf_assert.c
    Compiling file: nrf_atfifo.c
    Compiling file: nrf_atflags.c
    Compiling file: nrf_atomic.c
    Compiling file: nrf_balloc.c
    Compiling file: nrf_fprintf.c
    Compiling file: nrf_fprintf_format.c
    Compiling file: nrf_memobj.c
    Compiling file: nrf_pwr_mgmt.c
    Compiling file: nrf_ringbuf.c
    Compiling file: nrf_section_iter.c
    Compiling file: nrf_sortlist.c
    Compiling file: nrf_strerror.c
    Compiling file: nrf_queue.c
    Compiling file: nrf_fstorage.c
    Compiling file: nrf_fstorage_sd.c
    Compiling file: fds.c
    Compiling file: ecc.c
    Compiling file: crc16.c
    Compiling file: nrf_libuarte_async.c
    Compiling file: nrf_libuarte_drv.c
    Assembling file: gcc_startup_nrf52840.S
    Compiling file: system_nrf52840.c
    Compiling file: multiprotocol_802154_config.c
    Compiling file: boards.c
    Compiling file: nrf_drv_clock.c
    Compiling file: nrf_drv_uart.c
    Compiling file: nrf_nvmc.c
    Compiling file: nrfx_atomic.c
    Compiling file: nrfx_clock.c
    Compiling file: nrfx_gpiote.c
    Compiling file: nrfx_nvmc.c
    Compiling file: nrfx_prs.c
    Compiling file: nrf_drv_power.c
    Compiling file: nrfx_power.c
    Compiling file: logging_rtt.c
    Compiling file: nrfx_wdt.c
    Compiling file: nrf_drv_rng.c
    Compiling file: nrfx_rng.c
    Compiling file: nrfx_ppi.c
    Compiling file: nrfx_rtc.c
    Compiling file: nrfx_timer.c
    Compiling file: bsp.c
    Compiling file: bsp_btn_ble.c
    Compiling file: bsp_thread.c
    Compiling file: main.c
    Compiling file: smartvalve.c
    Compiling file: ble_thread_diagnostic.c
    Compiling file: ble_utils.c
    Compiling file: flashDataStorage.c
    Compiling file: process_change_network_settings.c
    Compiling file: process_get_routing_info.c
    Compiling file: process_get_routing_info_from_neighbors.c
    Compiling file: process_get_hydraulic_data.c
    Compiling file: hydraulicData_ressource.c
    Compiling file: light_ressource.c
    Compiling file: routingInfo_ressource.c
    Compiling file: uart_ressource.c
    Compiling file: com.c
    Compiling file: thread_network_utils.c
    Compiling file: uart.c
    Compiling file: uart_interpreter.c
    Compiling file: utils.c
    Compiling file: log.c
    Compiling file: nrf_sdh.c
    Compiling file: nrf_sdh_ble.c
    Compiling file: nrf_sdh_soc.c
    Compiling file: SEGGER_RTT.c
    Compiling file: SEGGER_RTT_Syscalls_GCC.c
    Compiling file: SEGGER_RTT_printf.c
    Compiling file: ble_advdata.c
    Compiling file: ble_advertising.c
    Compiling file: ble_conn_params.c
    Compiling file: ble_conn_state.c
    Compiling file: ble_link_ctx_manager.c
    Compiling file: ble_srv_common.c
    Compiling file: nrf_ble_gatt.c
    Compiling file: nrf_ble_qwr.c
    Compiling file: auth_status_tracker.c
    Compiling file: gatt_cache_manager.c
    Compiling file: gatts_cache_manager.c
    Compiling file: id_manager.c
    Compiling file: nrf_ble_lesc.c
    Compiling file: peer_data_storage.c
    Compiling file: peer_database.c
    Compiling file: peer_id.c
    Compiling file: peer_manager.c
    Compiling file: peer_manager_handler.c
    Compiling file: pm_buffer.c
    Compiling file: security_dispatcher.c
    Compiling file: security_manager.c
    Compiling file: nrf_crypto_aead.c
    Compiling file: nrf_crypto_aes.c
    Compiling file: nrf_crypto_aes_shared.c
    Compiling file: nrf_crypto_ecc.c
    Compiling file: nrf_crypto_ecdh.c
    Compiling file: nrf_crypto_ecdsa.c
    Compiling file: nrf_crypto_eddsa.c
    Compiling file: nrf_crypto_error.c
    Compiling file: nrf_crypto_hash.c
    Compiling file: nrf_crypto_hkdf.c
    Compiling file: nrf_crypto_hmac.c
    Compiling file: nrf_crypto_init.c
    Compiling file: nrf_crypto_rng.c
    Compiling file: nrf_crypto_shared.c
    Compiling file: oberon_backend_chacha_poly_aead.c
    Compiling file: oberon_backend_ecc.c
    Compiling file: oberon_backend_ecdh.c
    Compiling file: oberon_backend_ecdsa.c
    Compiling file: oberon_backend_eddsa.c
    Compiling file: oberon_backend_hash.c
    Compiling file: oberon_backend_hmac.c
    Compiling file: nrf_ble_scan.c
    Compiling file: ble_db_discovery.c
    Compiling file: nrf_ble_gq.c
    Compiling file: nrf_hw_backend_init.c
    Compiling file: nrf_hw_backend_rng.c
    Compiling file: nrf_hw_backend_rng_mbedtls.c
    Compiling file: utf.c
    Compiling file: ble_dis.c
    Compiling file: thread_utils.c
    Compiling file: unitTests.c
    Compiling file: test_utils.c
    Compiling file: test_smartvalve.c
    Compiling file: test_uart_interpreter.c
    Compiling file: test_thread_network_utils.c
    Compiling file: test_log.c
    Linking target: _build/nrf52840_xxaa.out
    ../../../Libraries/external/openthread/project/nrf52840/openthread_nrf52840/softdevice/uart/armgcc/libopenthread-nrf52840-softdevice-sdk.a(radio.c.o): In function `nrf_802154_random_get':
    c:\DocTA\Soft\ble-thread\Nordic\SDK\external\openthread\project\nrf52840\openthread_nrf52840\softdevice\uart\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/radio.c:963: undefined reference to `otRandomNonCryptoGetUint32'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher.c.obj): In function `mbedtls_cipher_set_iv':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:278: undefined reference to `mbedtls_chacha20_starts'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher.c.obj): In function `mbedtls_cipher_update':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:394: undefined reference to `mbedtls_chachapoly_update'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher.c.obj): In function `mbedtls_cipher_auth_encrypt':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:1063: undefined reference to `mbedtls_ccm_encrypt_and_tag'
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:1079: undefined reference to `mbedtls_chachapoly_encrypt_and_tag'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher.c.obj): In function `mbedtls_cipher_auth_decrypt':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:1127: undefined reference to `mbedtls_ccm_auth_decrypt'
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher.c:1150: undefined reference to `mbedtls_chachapoly_auth_decrypt'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chachapoly_ctx_free':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:2011: undefined reference to `mbedtls_chachapoly_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chachapoly_ctx_alloc':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:2004: undefined reference to `mbedtls_chachapoly_init'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chachapoly_setkey_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:1990: undefined reference to `mbedtls_chachapoly_setkey'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chacha20_ctx_free':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:1939: undefined reference to `mbedtls_chacha20_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chacha20_ctx_alloc':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:1932: undefined reference to `mbedtls_chacha20_init'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chacha20_setkey_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:1905: undefined reference to `mbedtls_chacha20_setkey'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `chacha20_stream_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:1917: undefined reference to `mbedtls_chacha20_update'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `ccm_ctx_free':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:121: undefined reference to `mbedtls_ccm_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `ccm_ctx_alloc':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:114: undefined reference to `mbedtls_ccm_init'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(cipher_wrap.c.obj): In function `ccm_aes_setkey_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/cipher_wrap.c:588: undefined reference to `mbedtls_ccm_setkey'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_process_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:368: undefined reference to `mbedtls_internal_sha1_process'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_clone_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:356: undefined reference to `mbedtls_sha1_clone'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_ctx_free':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:362: undefined reference to `mbedtls_sha1_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_ctx_alloc':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:349: undefined reference to `mbedtls_sha1_init'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_finish_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:341: undefined reference to `mbedtls_sha1_finish_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_update_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:335: undefined reference to `mbedtls_sha1_update_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha1_starts_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:329: undefined reference to `mbedtls_sha1_starts_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha224_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:415: undefined reference to `mbedtls_sha256_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj): In function `sha256_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/md_wrap.c:469: undefined reference to `mbedtls_sha256_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(md_wrap.c.obj):(.rodata.mbedtls_sha1_info+0x1c): undefined reference to `mbedtls_sha1_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `ecdsa_alloc_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:539: undefined reference to `mbedtls_ecdsa_init'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `ecdsa_free_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:546: undefined reference to `mbedtls_ecdsa_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `ecdsa_sign_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:496: undefined reference to `mbedtls_ecdsa_write_signature'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `eckey_sign_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:262: undefined reference to `mbedtls_ecdsa_init'
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:264: undefined reference to `mbedtls_ecdsa_from_keypair'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `ecdsa_sign_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:496: undefined reference to `mbedtls_ecdsa_write_signature'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `eckey_sign_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:268: undefined reference to `mbedtls_ecdsa_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `ecdsa_verify_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:482: undefined reference to `mbedtls_ecdsa_read_signature'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(pk_wrap.c.obj): In function `eckey_verify_wrap':
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:244: undefined reference to `mbedtls_ecdsa_init'
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:246: undefined reference to `mbedtls_ecdsa_from_keypair'
    /home/piko/Documents/project/pikoncs/mbedtls/library/pk_wrap.c:249: undefined reference to `mbedtls_ecdsa_free'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(entropy.c.obj): In function `entropy_update':
    /home/piko/Documents/project/pikoncs/nrfxlib/nrf_security/src/backend/cc310/replacements/entropy.c:196: undefined reference to `mbedtls_sha256_ret'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(entropy.c.obj): In function `mbedtls_entropy_init':
    /home/piko/Documents/project/pikoncs/nrfxlib/nrf_security/src/backend/cc310/replacements/entropy.c:121: undefined reference to `mbedtls_hardware_poll'
    ../../../Libraries/external/nrf_security/lib/libmbedtls_base_vanilla.a(entropy.c.obj): In function `mbedtls_entropy_func':
    /home/piko/Documents/project/pikoncs/nrfxlib/nrf_security/src/backend/cc310/replacements/entropy.c:420: undefined reference to `mbedtls_sha256_ret'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/nrf52840_xxaa.out] Error 1
    make: Leaving directory `/c/DocTA/Soft/ble-thread/BT840/Embedded/Application/Project/armgcc'

  • Hi,

    It looks like you have included the necessary libraries. Still, the linker errors indicates that you are missing some. Could you please try to copy the LIB_FILES list from one of the SDK examples. e.g. from the Makefile in /examples/multiprotocol/ble_thread/ble_thread_dyn_hrs_coap_srv_freertos/pca10056/s140/armgcc. Just copy the list and keep the same include order.

Related