Closed areitsma closed 9 years ago
I changed the TARGETS_FOR_DEVICE a bit and it worked on my machine:
TARGETS_FOR_DEVICE := TARGET_NRF51822 TARGET_M0 TARGET_NORDIC TARGET_NRF51_DK TARGET_MCU_NRF51822
TARGETS_FOR_DEVICE += TARGET_MCU_NORDIC_32K TARGET_CORTEX_M
I hope that helps.
Thanks for the reply But after I've tried this it still says that its missing the device.h
Did you copy and paste from my updates or did you just try to edit your pre-existing version to more closely match my updated version? The reason that I ask is that I fixed a typo or two in your original that you might miss if you don't just copy and paste my fixed version.
I did copy those two lines and paste it, so i did not edit it. This is what my NRF51_DK-device.mk now looks like.
# Vendor/device for which the library should be built.
MBED_DEVICE := NRF51_DK
MBED_TARGET := NORDIC_NRF51_DK
MBED_CLEAN := $(MBED_DEVICE)-MBED-clean
# Compiler flags which are specifc to this device.
TARGETS_FOR_DEVICE := TARGET_NRF51822 TARGET_M0 TARGET_NORDIC TARGET_NRF51_DK TARGET_MCU_NRF51822
TARGETS_FOR_DEVICE += TARGET_MCU_NORDIC_32K TARGET_CORTEX_M
GCC_DEFINES := $(patsubst %,-D%,$(TARGETS_FOR_DEVICE))
GCC_DEFINES += -D__CORTEX_M0 -DARM_MATH_CM0 -DNRF51
C_FLAGS := -mcpu=cortex-m0 -mthumb -mthumb-interwork
ASM_FLAGS := -mcpu=cortex-m0 -mthumb
LD_FLAGS := -mcpu=cortex-m0 -mthumb
# Extra platform specific object files to link into file binary.
# For NRF51 parts, we add in the softdevice.
DEVICE_OBJECTS := $(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.o
# Version of MRI library to use for this device.
DEVICE_MRI_LIB :=
# Linker script to be used. Indicates what code should be placed where in memory.
LSCRIPT=$(GCC4MBED_DIR)/build/NRF51_DK.ld
include $(GCC4MBED_DIR)/build/device-common.mk
# Rules to build the SoftDevice object file.
$(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.bin : $(MBED_SRC_ROOT)/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s130_nrf51822_1_0_0/s130_nrf51_1.0.0_softdevice.hex
$(Q) $(OBJCOPY) -I ihex -O binary --gap-fill 0xFF $< $@
$(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.o : $(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.bin
$(Q) $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.SoftDevice $< $@
Ok. I don't know what is causing the problems on your machine then. The key thing I had to update was changing your TARGET_MCU_NRF51882 to the correct TARGET_MCU_NRF51822 and then it found device.h The other changes I made to just get it closer to what I saw from your Python build run.
Could you sent me you're complete NRF51_DK-device.mk, maybe there are some other things that i missed.
# Vendor/device for which the library should be built.
MBED_DEVICE := NRF51_DK
MBED_TARGET := NORDIC_NRF51_DK
MBED_CLEAN := $(MBED_DEVICE)-MBED-clean
# Compiler flags which are specifc to this device.
TARGETS_FOR_DEVICE := TARGET_NRF51822 TARGET_M0 TARGET_NORDIC TARGET_NRF51_DK TARGET_MCU_NRF51822
TARGETS_FOR_DEVICE += TARGET_MCU_NORDIC_32K TARGET_CORTEX_M
GCC_DEFINES := $(patsubst %,-D%,$(TARGETS_FOR_DEVICE))
GCC_DEFINES += -D__CORTEX_M0 -DARM_MATH_CM0 -DNRF51
C_FLAGS := -mcpu=cortex-m0 -mthumb -mthumb-interwork
ASM_FLAGS := -mcpu=cortex-m0 -mthumb
LD_FLAGS := -mcpu=cortex-m0 -mthumb
# Extra platform specific object files to link into file binary.
# For NRF51 parts, we add in the softdevice.
DEVICE_OBJECTS := $(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.o
# Version of MRI library to use for this device.
DEVICE_MRI_LIB :=
# Linker script to be used. Indicates what code should be placed where in memory.
LSCRIPT=$(GCC4MBED_DIR)/build/NRF51822.ld
include $(GCC4MBED_DIR)/build/device-common.mk
# Rules to build the SoftDevice object file.
$(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.bin : $(MBED_SRC_ROOT)/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s130_nrf51822_1_0_0/s130_nrf51_1.0.0_softdevice.hex
$(Q) $(OBJCOPY) -I ihex -O binary --gap-fill 0xFF $< $@
$(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.o : $(MBED_DEVICE)/s130_nrf51_1.0.0_softdevice.bin
$(Q) $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.SoftDevice $< $@
Note: I didn't have your updated .ld file so I just pointed it back to the one I already had so that I could reproduce your compiler error. Also you might have to re-indent the make rules towards the end of the file to get them to be tabs instead of spaces since github appears to convert the tabs to spaces.
Okay nvm i found the bug, it was a really stupid one. Ty for the help.
One more question, can i configure it that after i build it in eclipse it automatically get send to the NRF51_DK device (the hex file)?
It depends on how you manually deploy it. I have to use GDB for my Nordic board but if you are able to deploy successfully by copying the resulting .hex file to the USB mass storage file then you could look at this documentation to see how the makefile can automatically issue the copy if you specify the NRF51_DK-deploy rule to GNU make.
Hello, I'm trying to build a NRF51_DK program on eclipse. I have followed this guide: https://github.com/adamgreen/gcc4mbed/blob/master/notes/new_devices.creole#adding-new-devices-to-gcc4mbed and used NRF51822 as base device, but i had no succes. If i try to build HelloWorld sample for NRF51_DK I get this error:
I'm pretty sure it has something to do with my target devices, but I feel like i did it right. My NRF5_dk-device.mk
Some more information when running: workspace_tools/build.py -m NRF51_DK -t GCC_ARM -v
I hope you guys can help me.