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

nRF51822 Makefile on windows (BLE nano)

Hi everybody,

I have a mistake with my makefile on windows 7 platform and Eclipse C edition. The error is quite rapid =>

20:42:38 **** Build of configuration Default for project nrf51Demo ****
make all 
rm -rf _build
process_begin: CreateProcess(NULL, rm -rf _build, ...) failed.
make (e=2): Le fichier spécifié est introuvable.

make: *** [clean] Erreur 2

20:42:39 Build Finished (took 897ms)

I used this tuto : devzone.nordicsemi.com/.../

Thanks for your help guys,

This is my makefile :

DEVICE := NRF51
DEVICESERIES := nrf51
#SDK_INCLUDE_PATH = C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/
SDK_SOURCE_PATH = C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/
TEMPLATE_PATH = C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/
OUTPUT_BINARY_DIRECTORY := _build
### General Variables
OUTPUT_FILENAME		= main
OUTPUT_DIR		= build
BIN_DIR			= bin
OBJ_DIR			= obj
SRC_DIR			= src
LINK_DIR		= link
ifeq ($(findstring 86, $(ProgramFiles)), )
	PROGFILES := C:/Program Files
else
	PROGFILES := C:/Program Files (x86)
endif
GNU_INSTALL_ROOT := C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32
GNU_VERSION := 4.9.3
GNU_PREFIX := arm-none-eabi
ifeq ($(LINKER_SCRIPT),)
	ifeq ($(USE_SOFTDEVICE), S110)
		LINKER_SCRIPT = gcc_$(DEVICESERIES)_s110_$(DEVICE_VARIANT).ld
		OUTPUT_FILENAME := $(OUTPUT_FILENAME)_s110_$(DEVICE_VARIANT)
	else
		ifeq ($(USE_SOFTDEVICE), S210)
			LINKER_SCRIPT = gcc_$(DEVICESERIES)_s210_$(DEVICE_VARIANT).ld
			OUTPUT_FILENAME := $(OUTPUT_FILENAME)_s210_$(DEVICE_VARIANT)
		else
			LINKER_SCRIPT = gcc_$(DEVICESERIES)_blank_$(DEVICE_VARIANT).ld
			OUTPUT_FILENAME := $(OUTPUT_FILENAME)_$(DEVICE_VARIANT)
		endif
	endif
else
# Use externally defined settings
endif
CPU := cortex-m0
# Toolchain commands
CC       		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc"
AS       		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as"
AR       		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar" -r
LD       		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld"
NM       		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm"
OBJDUMP  		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump"
OBJCOPY  		:= "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy"
MK 				:= mkdir
RM 				:= rm -rf
OBJECT_DIRECTORY := _build
LISTING_DIRECTORY := _build
C_SOURCE_FILES += system_$(DEVICESERIES).c
ASSEMBLER_SOURCE_FILES += gcc_startup_$(DEVICESERIES).s
# Linker flags
#LDFLAGS += -L"$(GNU_INSTALL_ROOT)/arm-none-eabi/lib/armv6-m"
#LDFLAGS += -L"$(GNU_INSTALL_ROOT)/lib/gcc/arm-none-eabi/$(GNU_VERSION)/armv6-m"
LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map
LDFLAGS += -mcpu=$(CPU) -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) 
# Compiler flags
CFLAGS += -mcpu=$(CPU) -mthumb -mabi=aapcs -D$(DEVICE) -D$(BOARD) -D$(TARGET_CHIP) --std=gnu99
CFLAGS += -Wall -Werror
CFLAGS += -mfloat-abi=soft
# Assembler flags
ASMFLAGS += -x assembler-with-cpp
 
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries"
INCLUDEPATHS += -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf"
# Sorting removes duplicates
BUILD_DIRECTORIES := $(sort $(OBJECT_DIRECTORY) $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY) )
####################################################################
# Rules                                                            #
####################################################################
C_SOURCE_FILENAMES = $(notdir $(C_SOURCE_FILES) )
ASSEMBLER_SOURCE_FILENAMES = $(notdir $(ASSEMBLER_SOURCE_FILES) )
# Make a list of source paths
C_SOURCE_PATHS += ../ $(SDK_SOURCE_PATH) $(TEMPLATE_PATH) $(wildcard $(SDK_SOURCE_PATH)*/) $(wildcard $(SDK_SOURCE_PATH)libraries/*/) $(wildcard $(SDK_SOURCE_PATH)drivers_nrf/*/) $(wildcard $(SDK_SOURCE_PATH)drivers_ext/*/) $(wildcard $(SDK_SOURCE_PATH)device/*/) $(wildcard $(SDK_SOURCE_PATH)ble/*/)
ASSEMBLER_SOURCE_PATHS = ../ $(SDK_SOURCE_PATH) $(TEMPLATE_PATH) $(wildcard $(SDK_SOURCE_PATH)*/)
C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILENAMES:.c=.o) )
ASSEMBLER_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASSEMBLER_SOURCE_FILENAMES:.s=.o) )
# Set source lookup paths
vpath %.c $(C_SOURCE_PATHS)
vpath %.s $(ASSEMBLER_SOURCE_PATHS)
# Include automatically previously generated dependencies
-include $(addprefix $(OBJECT_DIRECTORY)/, $(COBJS:.o=.d))
### Targets
debug:    CFLAGS += -DDEBUG -g3 -O0
debug:    ASMFLAGS += -DDEBUG -g3 -O0
debug:    $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
.PHONY: release
release: clean
release:  CFLAGS += -DNDEBUG -O3
release:  ASMFLAGS += -DNDEBUG -O3
release:  $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
echostuff:
	@echo C_OBJECTS: [$(C_OBJECTS)]
	@echo C_SOURCE_FILES: [$(C_SOURCE_FILES)]
	@echo C_SOURCE_PATHS: [$(C_SOURCE_PATHS)]
## Create build directories
$(BUILD_DIRECTORIES):
	$(MK) $@
## Create objects from C source files
$(OBJECT_DIRECTORY)/%.o: %.c
# Build header dependencies
	$(CC) $(CFLAGS) $(INCLUDEPATHS) -M $< -MF "$(@:.o=.d)" -MT $@
# Do the actual compilation
	$(CC) $(CFLAGS) $(INCLUDEPATHS) -c -o $@ $<
## Assemble .s files
$(OBJECT_DIRECTORY)/%.o: %.s
	$(CC) $(ASMFLAGS) $(INCLUDEPATHS) -c -o $@ $<
## Link C and assembler objects to an .out file
$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out: $(BUILD_DIRECTORIES) $(C_OBJECTS) $(ASSEMBLER_OBJECTS) $(LIBRARIES)
	$(CC) $(LDFLAGS) $(C_OBJECTS) $(ASSEMBLER_OBJECTS) $(LIBRARIES) -o $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
## Create binary .bin file from the .out file
$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
	$(OBJCOPY) -O binary $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin
## Create binary .hex file from the .out file
$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
	$(OBJCOPY) -O ihex $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
## Default build target
.PHONY: all
all: clean release
clean:
	$(RM) $(OUTPUT_BINARY_DIRECTORY)
## Program device
.PHONY: flash
flash: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
	nrfjprog --reset --program $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
.PHONY: reset
reset:
	nrfjprog --reset
.PHONY: erase
erase:
	nrfjprog --erase
Parents
  • Thanks for your answer. I don't speak windows too, and i try to speak makefile =) Bien que je parle français couramment.

    I modified the cmd command (view joined pieces) and i still have an error, it's an other this time :

    08:01:44 **** Incremental Build of configuration Default for project nrf51Demo ****
    make all 
    rd /s /q _build
    md  _build
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -mcpu=cortex-m0 -mthumb -mabi=aapcs -DNRF51  --std=gnu99   -Wall -Werror -mfloat-abi=soft -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -M C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/system_nrf51.c -MF "_build/system_nrf51.d" -MT _build/system_nrf51.o
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -mcpu=cortex-m0 -mthumb -mabi=aapcs -DNRF51  --std=gnu99   -Wall -Werror -mfloat-abi=soft -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -c -o _build/system_nrf51.o C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/system_nrf51.c
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -x assembler-with-cpp -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -c -o _build/gcc_startup_nrf51.o C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/gcc_startup_nrf51.s
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -Xlinker -Map=_build/main_s110_.map -mcpu=cortex-m0 -mthumb -mabi=aapcs -L C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/ -Tnrf51_xxaa.ld   _build/system_nrf51.o _build/gcc_startup_nrf51.o  -o _build/main_s110_.out
    c:/ble_nano/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv6-m/crt0.o: In function `_start':
    (.text+0x4e): undefined reference to `main'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/main_s110_.out] Erreur 1
    
    08:01:57 Build Finished (took 12s.258ms)
    

    projet_eclipse.zip

    Maybe an error on my or Makefile ? project ?

Reply
  • Thanks for your answer. I don't speak windows too, and i try to speak makefile =) Bien que je parle français couramment.

    I modified the cmd command (view joined pieces) and i still have an error, it's an other this time :

    08:01:44 **** Incremental Build of configuration Default for project nrf51Demo ****
    make all 
    rd /s /q _build
    md  _build
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -mcpu=cortex-m0 -mthumb -mabi=aapcs -DNRF51  --std=gnu99   -Wall -Werror -mfloat-abi=soft -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -M C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/system_nrf51.c -MF "_build/system_nrf51.d" -MT _build/system_nrf51.o
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -mcpu=cortex-m0 -mthumb -mabi=aapcs -DNRF51  --std=gnu99   -Wall -Werror -mfloat-abi=soft -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -c -o _build/system_nrf51.o C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/system_nrf51.c
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -x assembler-with-cpp -DNDEBUG -O3 -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/link" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/include/gcc" -I"C:/Users/joke/Downloads/nrf51Demo-master/nrf51Demo-master/src" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_ext" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/ble" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/device" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/libraries" -I"C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf" -c -o _build/gcc_startup_nrf51.o C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/gcc_startup_nrf51.s
    "C:/BLE_NANO/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/arm-none-eabi-gcc" -Xlinker -Map=_build/main_s110_.map -mcpu=cortex-m0 -mthumb -mabi=aapcs -L C:/BLE_NANO/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/ -Tnrf51_xxaa.ld   _build/system_nrf51.o _build/gcc_startup_nrf51.o  -o _build/main_s110_.out
    c:/ble_nano/gcc-arm-none-eabi-4_9-2015q1-20150306-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv6-m/crt0.o: In function `_start':
    (.text+0x4e): undefined reference to `main'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/main_s110_.out] Erreur 1
    
    08:01:57 Build Finished (took 12s.258ms)
    

    projet_eclipse.zip

    Maybe an error on my or Makefile ? project ?

Children
Related