This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

arm-none-eabi-gcc: error: No such file or directory

Hi,

I am currently trying to compile my project via the makefile on a Windows PC to a NRF52840 DK with SDK 15.3.0, however, I keep on getting the following errors:

$ make
mkdir _build
cd _build && mkdir nrf52840_xxaa_mbr
Assembling file: gcc_startup_nrf52.S
Compiling file: system_nrf52.c
Compiling file: nrf_log_frontend.c
Compiling file: nrf_log_str_formatter.c
Compiling file: boards.c
Compiling file: micro_ecc_backend_ecc.c
Compiling file: micro_ecc_backend_ecdh.c
Compiling file: micro_ecc_backend_ecdsa.c
Compiling file: optiga_backend_ecc.c
Compiling file: app_error_weak.c
Compiling file: app_scheduler.c
Compiling file: app_util_platform.c
Compiling file: crc32.c
Compiling file: mem_manager.c
Compiling file: nrf_assert.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_fstorage.c
Compiling file: nrf_fstorage_nvmc.c
Compiling file: nrf_memobj.c
Compiling file: nrf_queue.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_strerror.c
Compiling file: sha256.c
Compiling file: slip.c
Compiling file: nrf_drv_uart.c
Compiling file: nrf_nvic.c
Compiling file: nrf_nvmc.c
Compiling file: nrf_soc.c
Compiling file: nrfx_prs.c
Compiling file: nrfx_uart.c
Compiling file: nrfx_uarte.c
Compiling file: nrf_crypto_ecc.c
Compiling file: nrf_crypto_ecdsa.c
Compiling file: nrf_crypto_hash.c
Compiling file: nrf_crypto_init.c
Compiling file: nrf_crypto_shared.c
Compiling file: nrf_sw_backend_hash.c
Compiling file: nrf_bootloader.c
Compiling file: nrf_bootloader_app_start.c
Compiling file: nrf_bootloader_app_start_final.c
Compiling file: nrf_bootloader_dfu_timers.c
Compiling file: nrf_bootloader_fw_activation.c
Compiling file: nrf_bootloader_info.c
Compiling file: nrf_bootloader_wdt.c
Compiling file: pb_common.c
Compiling file: pb_decode.c
Compiling file: dfu-cc.pb.c
Compiling file: nrf_dfu.c
Compiling file: nrf_dfu_flash.c
Compiling file: nrf_dfu_handling_error.c
Compiling file: nrf_dfu_mbr.c
Compiling file: nrf_dfu_req_handler.c
Compiling file: nrf_dfu_serial_uart.c
Compiling file: nrf_dfu_settings.c
Compiling file: nrf_dfu_transport.c
Compiling file: nrf_dfu_utils.c
Compiling file: nrf_dfu_validation.c
Compiling file: nrf_dfu_ver_validation.c
Compiling file: nrf_dfu_serial.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: dfu_public_key.c
Compiling file: main.c
Linking target: _build/nrf52840_xxaa_mbr.out
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrgcc_startup_nrf52.S.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrsystem_nrf52.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_log_frontend.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_log_str_formatter.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrboards.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrmicro_ecc_backend_ecc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrmicro_ecc_backend_ecdh.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrmicro_ecc_backend_ecdsa.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroptiga_backend_ecc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrapp_error_weak.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrapp_scheduler.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrapp_util_platform.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrcrc32.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrmem_manager.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_assert.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_atomic.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_balloc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_fprintf.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_fprintf_format.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_fstorage.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_fstorage_nvmc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_memobj.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_queue.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_ringbuf.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_strerror.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrsha256.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrslip.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_drv_uart.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_nvic.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_nvmc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_soc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrfx_prs.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrfx_uart.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrfx_uarte.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_crypto_ecc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_crypto_ecdsa.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_crypto_hash.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_crypto_init.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_crypto_shared.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_sw_backend_hash.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_app_start.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_app_start_final.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_dfu_timers.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_fw_activation.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_info.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_bootloader_wdt.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrpb_common.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrpb_decode.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrdfu-cc.pb.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_flash.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_handling_error.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_mbr.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_req_handler.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_serial_uart.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_settings.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_transport.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_utils.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_validation.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_ver_validation.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrnrf_dfu_serial.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_chacha_poly_aead.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_ecc.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_ecdh.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_ecdsa.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_eddsa.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_hash.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbroberon_backend_hmac.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrdfu_public_key.c.o: No such file or directory
arm-none-eabi-gcc: error: _buildnrf52840_xxaa_mbrmain.c.o: No such file or directory
arm-none-eabi-gcc: error: C;C:Program: No such file or directory
arm-none-eabi-gcc: error: FilesGitUsersJaneAppDataSeggernRF5_SDK_15.3.0_59ac345externalnrf_oberonlibcortex-m4hard-floatliboberon_2.0.7.a: No such file or directory
arm-none-eabi-gcc: error: C;C:Program: No such file or directory
arm-none-eabi-gcc: error: FilesGitUsersJaneAppDataSeggernRF5_SDK_15.3.0_59ac345externalmicro-eccnrf52hf_armgccarmgccmicro_ecc_lib_nrf52.a: No such file or directory
make: *** [C:/Users/Jane/AppData/Segger/nRF5_SDK_15.3.0_59ac345/components/toolchain/gcc/Makefile.common:294: _build/nrf52840_xxaa_mbr.out] Error 1

Looking at the code, I think it has to do with the compiler not being able to detect each individual folder with "/ ". I am currently using the GNU 7 2018-q2-update compiler. I had upgrading and down grading GNU versions but the output is still the same. However, if I run the make file on a different project it would work just fine. I am very confused as to why this error is occurring. The code for my makefile is given below. Any help is greatly appreciated!!

TARGETS          := nrf52840_xxaa_mbr
PROJ_DIR         := .
OUTPUT_DIRECTORY := _build
SDK_ROOT         := ../../../../../nRF5_SDK_15.3.0_59ac345
SOFT_DEVICE      := "${SDK_ROOT}/components/softdevice/s140/hex/s140_nrf52_6.1.1_softdevice.hex"

GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Tools ARM Embedded/7 2018-q2-update/bin/
GNU_VERSION      := 7.3.1

$(OUTPUT_DIRECTORY)/nrf52840_xxaa_mbr.out: \
  LINKER_SCRIPT  := secure_bootloader_gcc_nrf52.ld

# Source files common to all targets
SRC_FILES += \
  $(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52.S \
  $(SDK_ROOT)/modules/nrfx/mdk/system_nrf52.c \
  $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
  $(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
  $(SDK_ROOT)/components/boards/boards.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecc.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdh.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdsa.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/optiga/optiga_backend_ecc.c \
  $(SDK_ROOT)/components/libraries/util/app_error_weak.c \
  $(SDK_ROOT)/components/libraries/scheduler/app_scheduler.c \
  $(SDK_ROOT)/components/libraries/util/app_util_platform.c \
  $(SDK_ROOT)/components/libraries/crc32/crc32.c \
  $(SDK_ROOT)/components/libraries/mem_manager/mem_manager.c \
  $(SDK_ROOT)/components/libraries/util/nrf_assert.c \
  $(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \
  $(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \
  $(SDK_ROOT)/external/fprintf/nrf_fprintf.c \
  $(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
  $(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage.c \
  $(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage_nvmc.c \
  $(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \
  $(SDK_ROOT)/components/libraries/queue/nrf_queue.c \
  $(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c \
  $(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
  $(SDK_ROOT)/components/libraries/sha256/sha256.c \
  $(SDK_ROOT)/components/libraries/slip/slip.c \
  $(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \
  $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c \
  $(SDK_ROOT)/modules/nrfx/hal/nrf_nvmc.c \
  $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c \
  $(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
  $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
  $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
  $(SDK_ROOT)/components/libraries/crypto/nrf_crypto_ecc.c \
  $(SDK_ROOT)/components/libraries/crypto/nrf_crypto_ecdsa.c \
  $(SDK_ROOT)/components/libraries/crypto/nrf_crypto_hash.c \
  $(SDK_ROOT)/components/libraries/crypto/nrf_crypto_init.c \
  $(SDK_ROOT)/components/libraries/crypto/nrf_crypto_shared.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/nrf_sw/nrf_sw_backend_hash.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_app_start.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_app_start_final.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_dfu_timers.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_fw_activation.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_info.c \
  $(SDK_ROOT)/components/libraries/bootloader/nrf_bootloader_wdt.c \
  $(SDK_ROOT)/external/nano-pb/pb_common.c \
  $(SDK_ROOT)/external/nano-pb/pb_decode.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/dfu-cc.pb.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_flash.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_handling_error.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_mbr.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_req_handler.c \
  $(SDK_ROOT)/components/libraries/bootloader/serial_dfu/nrf_dfu_serial_uart.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_settings.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_transport.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_utils.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_validation.c \
  $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_ver_validation.c \
  $(SDK_ROOT)/components/libraries/bootloader/serial_dfu/nrf_dfu_serial.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_chacha_poly_aead.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_ecc.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_ecdh.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_ecdsa.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_eddsa.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_hash.c \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon/oberon_backend_hmac.c \
  $(PROJ_DIR)/dfu_public_key.c \
  $(PROJ_DIR)/main.c \

# Include folders common to all targets
INC_FOLDERS += \
  $(SDK_ROOT)/modules/nrfx/drivers/include \
  $(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc \
  $(SDK_ROOT)/components/libraries/crypto/backend/optiga \
  $(SDK_ROOT)/components/libraries/memobj \
  $(SDK_ROOT)/components/libraries/sha256 \
  $(SDK_ROOT)/components/libraries/crc32 \
  $(SDK_ROOT)/components/libraries/experimental_section_vars \
  $(SDK_ROOT)/components/libraries/mem_manager \
  $(SDK_ROOT)/components/libraries/fstorage \
  $(SDK_ROOT)/components/libraries/util \
  $(SDK_ROOT)/modules/nrfx \
  $(SDK_ROOT)/external/nrf_oberon/include \
  $(SDK_ROOT)/components/libraries/crypto/backend/oberon \
  $(SDK_ROOT)/components/libraries/crypto/backend/cifra \
  $(SDK_ROOT)/components/libraries/atomic \
  $(SDK_ROOT)/integration/nrfx \
  $(SDK_ROOT)/components/libraries/crypto/backend/cc310_bl \
  $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
  $(SDK_ROOT)/components/libraries/log/src \
  $(SDK_ROOT)/components/libraries/bootloader/dfu \
  $(SDK_ROOT)/components/libraries/bootloader/serial_dfu \
  $(SDK_ROOT)/components/libraries/delay \
  $(SDK_ROOT)/integration/nrfx/legacy \
  $(SDK_ROOT)/modules/nrfx/hal \
  $(SDK_ROOT)/components/libraries/crypto/backend/nrf_hw \
  $(SDK_ROOT)/components/libraries/log \
  $(SDK_ROOT)/external/nrf_oberon \
  $(SDK_ROOT)/components/libraries/strerror \
  $(SDK_ROOT)/components/libraries/crypto/backend/mbedtls \
  $(SDK_ROOT)/components/boards \
  $(SDK_ROOT)/components/libraries/crypto/backend/cc310 \
  $(SDK_ROOT)/components/libraries/bootloader \
  $(SDK_ROOT)/external/fprintf \
  $(SDK_ROOT)/components/libraries/crypto \
  $(SDK_ROOT)/components/libraries/scheduler \
  $(SDK_ROOT)/components/libraries/slip \
  $(SDK_ROOT)/components/toolchain/cmsis/include \
  $(SDK_ROOT)/components/libraries/balloc \
  $(SDK_ROOT)/components/libraries/stack_info \
  $(SDK_ROOT)/external/micro-ecc/micro-ecc \
  $(PROJ_DIR) \
  $(SDK_ROOT)/components/libraries/crypto/backend/nrf_sw \
  $(SDK_ROOT)/modules/nrfx/mdk \
  $(SDK_ROOT)/external/nano-pb \
  $(SDK_ROOT)/components/softdevice/mbr/nrf52840/headers \
  $(SDK_ROOT)/components/libraries/queue \
  $(SDK_ROOT)/components/libraries/ringbuf \
  $(PROJ_DIR)/config

# Libraries common to all targets
LIB_FILES += \
  $(SDK_ROOT)/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_2.0.7.a \
  $(SDK_ROOT)/external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a \

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

# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_CUSTOM
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DNRF52
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DNRF52_PAN_74
CFLAGS += -DNRF_DFU_SETTINGS_VERSION=1
CFLAGS += -DSVC_INTERFACE_CALL_AS_NORMAL_FUNCTION
CFLAGS += -DuECC_ENABLE_VLI_API=0
CFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
CFLAGS += -DuECC_SQUARE_FUNC=0
CFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
CFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=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 -flto
CFLAGS += -DHW_DEVICE_ID=${HW_DEVICE_ID}

# 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 += -DBOARD_PCA10056
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DNRF52_PAN_74
ASMFLAGS += -DNRF_DFU_SETTINGS_VERSION=1
ASMFLAGS += -DSVC_INTERFACE_CALL_AS_NORMAL_FUNCTION
ASMFLAGS += -DuECC_ENABLE_VLI_API=0
ASMFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
ASMFLAGS += -DuECC_SQUARE_FUNC=0
ASMFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
ASMFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=1

# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/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_mbr: CFLAGS += -D__HEAP_SIZE=0
nrf52840_xxaa_mbr: ASMFLAGS += -D__HEAP_SIZE=0

# 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


.PHONY: default help

# Default target - first one defined
default: nrf52840_xxaa_mbr

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

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


include $(TEMPLATE_PATH)/Makefile.common

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

.PHONY: flash flash_mbr erase

# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa_mbr.hex
	@echo Flashing: $<
	nrfjprog -f nrf52 --program $< --sectoranduicrerase
	nrfjprog -f nrf52 --reset

# Flash softdevice
flash_mbr:
	@echo Flashing: mbr_nrf52_2.4.1_mbr.hex
	nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/mbr/nrf52840/hex/mbr_nrf52_2.4.1_mbr.hex --sectorerase
	nrfjprog -f nrf52 --reset

erase:
	nrfjprog -f nrf52 --eraseall

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

hex:
	mergehex -m $(SOFT_DEVICE) $(OUTPUT_DIRECTORY)/nrf52840_xxaa_mbr.hex -o $(OUTPUT_DIRECTORY)/bootloader_softdevice.hex

flash_hex:
	@echo Flashing: $(OUTPUT_DIRECTORY)/bootloader_softdevice.hex
	nrfjprog -f nrf52 --eraseall
	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/bootloader_softdevice.hex --sectoranduicrerase
	nrfjprog -f nrf52 --reset
 

Related