Skip to content

Commit 62b139c

Browse files
committed
initial check-in
0 parents  commit 62b139c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+14093
-0
lines changed

LICENSE

+674
Large diffs are not rendered by default.

firmware/nRF51/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.o
2+
*.bin
3+
*.map
4+
*.elf
5+
*.asm
6+
*.log

firmware/nRF51/core/Makefile.rules

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
CROSS=arm-none-eabi-
2+
CC=$(CROSS)gcc
3+
LD=$(CROSS)ld
4+
OBJCOPY=$(CROSS)objcopy
5+
OBJDUMP=$(CROSS)objdump
6+
AR=$(CROSS)ar
7+
LDSCRIPT=$(CORE)linker/$(CPU).ld
8+
SEGGER=/opt/SEGGER
9+
JLINK=$(SEGGER)/JLink/JLinkExe
10+
11+
# determine program version
12+
PROGRAM_VERSION:=$(shell git describe --tags --abbrev=4 --dirty 2>/dev/null | sed s/^v//)
13+
ifeq ("$(PROGRAM_VERSION)","")
14+
PROGRAM_VERSION:='unknown'
15+
endif
16+
17+
CORE=../core/
18+
19+
#
20+
# CFLAGS common to both the THUMB and ARM mode builds
21+
#
22+
CFLAGS= \
23+
-D __$(CPU)__ \
24+
-D __$(ARCH)__ \
25+
-D PROGRAM_VERSION=\"$(PROGRAM_VERSION)\" \
26+
-D PROGRAM_NAME=\"$(TARGET)\" \
27+
-I$(CORE)cmsis \
28+
-I$(CORE)nrf/inc \
29+
-I$(CORE)openbeacon/inc \
30+
-Wall \
31+
-Werror \
32+
-Wextra \
33+
-Wno-multichar \
34+
-Wstrict-prototypes \
35+
-Wno-strict-aliasing \
36+
-D CORTEXM0_GCC \
37+
-mcpu=cortex-m0 \
38+
-msoft-float \
39+
-mthumb \
40+
-fno-common \
41+
-T$(LDSCRIPT) \
42+
$(DEBUG) \
43+
$(OPTIM) \
44+
-fomit-frame-pointer \
45+
-ffunction-sections \
46+
-fdata-sections \
47+
$(APP_CFLAGS)
48+
49+
LINKER_FLAGS=$(APP_LDFLAGS) -Xlinker --gc-sections -Xlinker -o$(TARGET).elf -Xlinker -M -Xlinker -Map=$(TARGET).map
50+
51+
ARM_SRC= \
52+
$(APP_SRC) \
53+
$(CORE)startup/$(ARCH).c \
54+
$(CORE)nrf/src/system_$(ARCH).c \
55+
$(CORE)openbeacon/src/crc16.c \
56+
$(CORE)openbeacon/src/crc8.c \
57+
$(CORE)openbeacon/src/debug_printf.c \
58+
$(CORE)openbeacon/src/printf.c \
59+
$(CORE)openbeacon/src/uart.c \
60+
$(CORE)openbeacon/src/xxtea.c
61+
62+
#
63+
# JLink flash script
64+
#
65+
define TARGET_FLASH
66+
si 1
67+
device $(CPU)
68+
rx 100
69+
halt
70+
w4 4001e504 1
71+
erase
72+
sleep 1000
73+
loadbin $(TARGET).bin 0
74+
rx 100
75+
g
76+
exit
77+
endef
78+
export TARGET_FLASH
79+
80+
define TARGET_ERASE
81+
r
82+
si 1
83+
device $(CPU)
84+
w4 4001e504 2
85+
w4 4001e50c 1
86+
w4 4001e514 1
87+
r
88+
exit
89+
endef
90+
export TARGET_ERASE
91+
92+
#
93+
# Define all object files.
94+
#
95+
ARM_OBJ = $(ARM_SRC:.c=.o)
96+
APP_ADDITIONAL?=
97+
98+
$(TARGET).bin : $(TARGET).elf
99+
$(OBJCOPY) $(TARGET).elf -O binary $(TARGET).bin
100+
101+
$(TARGET).hex : $(TARGET).elf
102+
$(OBJCOPY) $(TARGET).elf -O ihex $(TARGET).hex
103+
104+
$(TARGET).elf : $(ARM_OBJ) $(CRT0) $(BOOTLOADER) $(APP_ADDITIONAL) Makefile
105+
$(CC) $(CFLAGS) $(ARM_OBJ) $(BOOTLOADER) $(APP_ADDITIONAL) -nostartfiles $(CRT0) $(LINKER_FLAGS)
106+
$(OBJDUMP) -d $(TARGET).elf > $(TARGET).asm
107+
108+
$(ARM_OBJ) : %.o : %.c $(LDSCRIPT) Makefile
109+
$(CC) -c $(CFLAGS) $< -o $@
110+
111+
flash: $(TARGET).bin
112+
@echo "$$TARGET_FLASH" | $(JLINK)
113+
114+
erase:
115+
@echo "$$TARGET_ERASE" | $(JLINK)
116+
117+
version:
118+
@echo "$(TARGET) version $(PROGRAM_VERSION)"
119+
120+
clean : app_clean
121+
find $(CORE) -name '*.o' -exec rm \{\} \;
122+
rm -f $(TARGET).bin $(TARGET).elf $(TARGET).map $(TARGET).asm $(TARGET)-$(CPU).bin JLink.log

0 commit comments

Comments
 (0)