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
  • rm -rf _build
    

    is that a windows command? I don't speak windows and I don't speak French but it looks to me like that error message is telling you it can't run the 'rm' command because it doesn't exist.

    You probably need to install a package of tools to install an 'rm' on your system. And looking at the tutorial link you pointed to, indeed that says you need to install GNU Make and RM command-line tools. I suspect either you haven't done it or you haven't done in properly such that rm isn't in the path. I'd go check that piece of the tutorial again, until you can type 'rm' at the command line and get something other than a failure to find it, make's not going to work.

Reply
  • rm -rf _build
    

    is that a windows command? I don't speak windows and I don't speak French but it looks to me like that error message is telling you it can't run the 'rm' command because it doesn't exist.

    You probably need to install a package of tools to install an 'rm' on your system. And looking at the tutorial link you pointed to, indeed that says you need to install GNU Make and RM command-line tools. I suspect either you haven't done it or you haven't done in properly such that rm isn't in the path. I'd go check that piece of the tutorial again, until you can type 'rm' at the command line and get something other than a failure to find it, make's not going to work.

Children
No Data
Related