Skip to content

Commit 22a4297

Browse files
acalatravabrghena
authored andcommitted
compiling support for nrf52832
1 parent 0a1f171 commit 22a4297

6 files changed

+978
-3
lines changed

make/Makefile

+12-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ BOOTLOADER_REGION_START = $(addprefix 0x, $(shell echo "obase=16; (${FLASH_KB}-1
231231
BOOTLOADER_SETTINGS_ADDRESS = $(addprefix 0x, $(shell echo "obase=16; (${FLASH_KB}-2)*1024" | bc))
232232

233233
# Need some common options for interacting with the chip over JTAG
234+
ifeq ($(NRF_IC), nrf52832)
235+
JLINK_OPTIONS = -device nrf52 -if swd -speed 1000
236+
else
234237
JLINK_OPTIONS = -device $(NRF_IC) -if swd -speed 1000
238+
endif
235239

236240
# If not set in app makefile, lets optimize for size
237241
CFLAGS += -Os
@@ -262,7 +266,7 @@ SOURCE_PATHS += $(BASE_DIR)/services/
262266
SOURCE_PATHS += $(BASE_DIR)/startup/
263267

264268
# Add paths for each SDK version
265-
ifeq ($(NRF_MODEL), nrf51)
269+
ifeq ($(NRF_MODEL), $(filter $(NRF_MODEL),nrf51 nrf52))
266270
ifeq ($(SDK_VERSION), 12)
267271

268272
# Set the path
@@ -801,7 +805,13 @@ VPATH = $(SOURCE_PATHS)
801805

802806
OUTPUT_PATH ?= _build/
803807

804-
CPUFLAGS = -mthumb -mcpu=cortex-m0 -march=armv6-m
808+
ifneq (,$(filter $(NRF_IC),nrf52832 nrf52833 nrf52840))
809+
#CPUFLAGS = -mthumb -mabi=aapcs -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=soft -mfpu=fpv4-sp-d16
810+
CPUFLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m
811+
else
812+
CPUFLAGS = -mthumb -mcpu=cortex-m0 -march=armv6-m
813+
endif
814+
805815
CFLAGS += -std=gnu99 -c $(CPUFLAGS) -Wall -Wextra -Wno-unused-parameter -Werror=return-type -D$(DEVICE) -D$(BOARD) -D$(NRF_IC_UPPER) -DSDK_VERSION_$(SDK_VERSION) -DSOFTDEVICE_$(SOFTDEVICE_MODEL)
806816
CFLAGS += -s -ffunction-sections -fdata-sections
807817
CFLAGS += -D$(shell echo $(SOFTDEVICE_MODEL) | tr a-z A-Z)

make/Makefile.posix

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ifneq ($(SOFTDEVICE_MODEL),blank)
7575
@$(OBJCOPY) -Iihex -Obinary $(SOFTDEVICE) $(SOFTDEVICE_OUTPUT:.hex=.bin)
7676
@$(JLINK) $(OUTPUT_PATH)test-softdevice.jlink
7777
@dd skip=$(shell printf "%d" $(SOFTDEVICE_TEST_ADDR)) count=$(shell printf "%d" $(SOFTDEVICE_TEST_LEN)) if=$(SOFTDEVICE_OUTPUT:.hex=.bin) of=$(SOFTDEVICE_TEST_BIN) bs=1
78-
@diff -q $(SOFTDEVICE_TEST_FLASH) $(SOFTDEVICE_TEST_BIN) || $(MAKE) flash-softdevice
78+
@diff -q $(SOFTDEVICE_TEST_FLASH) $(SOFTDEVICE_TEST_BIN) || $(MAKE) $(subst flash,,$(MAKECMDGOALS)) flash-softdevice
7979
endif
8080

8181
# address and length determined experimentally. Works for s110_7, s110_8, s120_2, and s130_1
+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/* Linker script to configure memory regions. */
2+
3+
SEARCH_DIR(.)
4+
GROUP(-lgcc -lc -lnosys)
5+
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x0 + 152K, LENGTH = 512K - 152K - 4K /* 152 kB is taken by s132, 4 kB is taken by bootloader settings */
9+
RAM (rwx) : ORIGIN = 0x200098a8, LENGTH = 0x6758 /* worst case taken from example apps. this can be significantly reduced if needed */
10+
bootloader_settings_page (r) : ORIGIN = 0x0 + 512K - 4K LENGTH = 4K
11+
uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
12+
}
13+
14+
SECTIONS
15+
{
16+
.bootloader_settings_page(NOLOAD) :
17+
{
18+
PROVIDE(__start_bootloader_settings_page = .);
19+
KEEP(*(SORT(.bootloader_settings_page*)))
20+
PROVIDE(__stop_bootloader_settings_page = .);
21+
} > bootloader_settings_page
22+
.uicr_bootloader_start_address :
23+
{
24+
PROVIDE(__start_uicr_bootloader_start_address = .);
25+
KEEP(*(SORT(.uicr_bootloader_start_address*)))
26+
PROVIDE(__stop_uicr_bootloader_start_address = .);
27+
} > uicr_bootloader_start_address
28+
}
29+
30+
SECTIONS
31+
{
32+
. = ALIGN(4);
33+
.mem_section_dummy_ram :
34+
{
35+
}
36+
.log_dynamic_data :
37+
{
38+
PROVIDE(__start_log_dynamic_data = .);
39+
KEEP(*(SORT(.log_dynamic_data*)))
40+
PROVIDE(__stop_log_dynamic_data = .);
41+
} > RAM
42+
.cli_sorted_cmd_ptrs :
43+
{
44+
PROVIDE(__start_cli_sorted_cmd_ptrs = .);
45+
KEEP(*(.cli_sorted_cmd_ptrs))
46+
PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
47+
} > RAM
48+
.fs_data :
49+
{
50+
PROVIDE(__start_fs_data = .);
51+
KEEP(*(.fs_data))
52+
PROVIDE(__stop_fs_data = .);
53+
} > RAM
54+
55+
} INSERT AFTER .data;
56+
57+
SECTIONS
58+
{
59+
.mem_section_dummy_rom :
60+
{
61+
}
62+
.sdh_soc_observers :
63+
{
64+
PROVIDE(__start_sdh_soc_observers = .);
65+
KEEP(*(SORT(.sdh_soc_observers*)))
66+
PROVIDE(__stop_sdh_soc_observers = .);
67+
} > FLASH
68+
.crypto_data :
69+
{
70+
PROVIDE(__start_crypto_data = .);
71+
KEEP(*(SORT(.crypto_data*)))
72+
PROVIDE(__stop_crypto_data = .);
73+
} > FLASH
74+
.log_const_data :
75+
{
76+
PROVIDE(__start_log_const_data = .);
77+
KEEP(*(SORT(.log_const_data*)))
78+
PROVIDE(__stop_log_const_data = .);
79+
} > FLASH
80+
.nrf_balloc :
81+
{
82+
PROVIDE(__start_nrf_balloc = .);
83+
KEEP(*(.nrf_balloc))
84+
PROVIDE(__stop_nrf_balloc = .);
85+
} > FLASH
86+
.nrf_queue :
87+
{
88+
PROVIDE(__start_nrf_queue = .);
89+
KEEP(*(.nrf_queue))
90+
PROVIDE(__stop_nrf_queue = .);
91+
} > FLASH
92+
.sdh_state_observers :
93+
{
94+
PROVIDE(__start_sdh_state_observers = .);
95+
KEEP(*(SORT(.sdh_state_observers*)))
96+
PROVIDE(__stop_sdh_state_observers = .);
97+
} > FLASH
98+
.sdh_stack_observers :
99+
{
100+
PROVIDE(__start_sdh_stack_observers = .);
101+
KEEP(*(SORT(.sdh_stack_observers*)))
102+
PROVIDE(__stop_sdh_stack_observers = .);
103+
} > FLASH
104+
.sdh_req_observers :
105+
{
106+
PROVIDE(__start_sdh_req_observers = .);
107+
KEEP(*(SORT(.sdh_req_observers*)))
108+
PROVIDE(__stop_sdh_req_observers = .);
109+
} > FLASH
110+
.cli_command :
111+
{
112+
PROVIDE(__start_cli_command = .);
113+
KEEP(*(.cli_command))
114+
PROVIDE(__stop_cli_command = .);
115+
} > FLASH
116+
.pwr_mgmt_data :
117+
{
118+
PROVIDE(__start_pwr_mgmt_data = .);
119+
KEEP(*(SORT(.pwr_mgmt_data*)))
120+
PROVIDE(__stop_pwr_mgmt_data = .);
121+
} > FLASH
122+
.sdh_ble_observers :
123+
{
124+
PROVIDE(__start_sdh_ble_observers = .);
125+
KEEP(*(SORT(.sdh_ble_observers*)))
126+
PROVIDE(__stop_sdh_ble_observers = .);
127+
} > FLASH
128+
.dfu_trans :
129+
{
130+
PROVIDE(__start_dfu_trans = .);
131+
KEEP(*(SORT(.dfu_trans*)))
132+
PROVIDE(__stop_dfu_trans = .);
133+
} > FLASH
134+
135+
} INSERT AFTER .text
136+
137+
INCLUDE "nrf_common.ld"
+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/* Linker script to configure memory regions. */
2+
3+
SEARCH_DIR(.)
4+
GROUP(-lgcc -lc -lnosys)
5+
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x0 + 112K, LENGTH = 512K - 112K - 4K /* 112K kB is taken by s132, 4 kB is taken by bootloader settings */
9+
RAM (rwx) : ORIGIN = 0x200098a8, LENGTH = 0x6758 /* worst case taken from example apps. this can be significantly reduced if needed */
10+
bootloader_settings_page (r) : ORIGIN = 0x0 + 512K - 4K LENGTH = 4K
11+
uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
12+
}
13+
14+
SECTIONS
15+
{
16+
.bootloader_settings_page(NOLOAD) :
17+
{
18+
PROVIDE(__start_bootloader_settings_page = .);
19+
KEEP(*(SORT(.bootloader_settings_page*)))
20+
PROVIDE(__stop_bootloader_settings_page = .);
21+
} > bootloader_settings_page
22+
.uicr_bootloader_start_address :
23+
{
24+
PROVIDE(__start_uicr_bootloader_start_address = .);
25+
KEEP(*(SORT(.uicr_bootloader_start_address*)))
26+
PROVIDE(__stop_uicr_bootloader_start_address = .);
27+
} > uicr_bootloader_start_address
28+
}
29+
30+
SECTIONS
31+
{
32+
. = ALIGN(4);
33+
.mem_section_dummy_ram :
34+
{
35+
}
36+
.log_dynamic_data :
37+
{
38+
PROVIDE(__start_log_dynamic_data = .);
39+
KEEP(*(SORT(.log_dynamic_data*)))
40+
PROVIDE(__stop_log_dynamic_data = .);
41+
} > RAM
42+
.cli_sorted_cmd_ptrs :
43+
{
44+
PROVIDE(__start_cli_sorted_cmd_ptrs = .);
45+
KEEP(*(.cli_sorted_cmd_ptrs))
46+
PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
47+
} > RAM
48+
.fs_data :
49+
{
50+
PROVIDE(__start_fs_data = .);
51+
KEEP(*(.fs_data))
52+
PROVIDE(__stop_fs_data = .);
53+
} > RAM
54+
55+
} INSERT AFTER .data;
56+
57+
SECTIONS
58+
{
59+
.mem_section_dummy_rom :
60+
{
61+
}
62+
.sdh_soc_observers :
63+
{
64+
PROVIDE(__start_sdh_soc_observers = .);
65+
KEEP(*(SORT(.sdh_soc_observers*)))
66+
PROVIDE(__stop_sdh_soc_observers = .);
67+
} > FLASH
68+
.crypto_data :
69+
{
70+
PROVIDE(__start_crypto_data = .);
71+
KEEP(*(SORT(.crypto_data*)))
72+
PROVIDE(__stop_crypto_data = .);
73+
} > FLASH
74+
.log_const_data :
75+
{
76+
PROVIDE(__start_log_const_data = .);
77+
KEEP(*(SORT(.log_const_data*)))
78+
PROVIDE(__stop_log_const_data = .);
79+
} > FLASH
80+
.nrf_balloc :
81+
{
82+
PROVIDE(__start_nrf_balloc = .);
83+
KEEP(*(.nrf_balloc))
84+
PROVIDE(__stop_nrf_balloc = .);
85+
} > FLASH
86+
.nrf_queue :
87+
{
88+
PROVIDE(__start_nrf_queue = .);
89+
KEEP(*(.nrf_queue))
90+
PROVIDE(__stop_nrf_queue = .);
91+
} > FLASH
92+
.sdh_state_observers :
93+
{
94+
PROVIDE(__start_sdh_state_observers = .);
95+
KEEP(*(SORT(.sdh_state_observers*)))
96+
PROVIDE(__stop_sdh_state_observers = .);
97+
} > FLASH
98+
.sdh_stack_observers :
99+
{
100+
PROVIDE(__start_sdh_stack_observers = .);
101+
KEEP(*(SORT(.sdh_stack_observers*)))
102+
PROVIDE(__stop_sdh_stack_observers = .);
103+
} > FLASH
104+
.sdh_req_observers :
105+
{
106+
PROVIDE(__start_sdh_req_observers = .);
107+
KEEP(*(SORT(.sdh_req_observers*)))
108+
PROVIDE(__stop_sdh_req_observers = .);
109+
} > FLASH
110+
.cli_command :
111+
{
112+
PROVIDE(__start_cli_command = .);
113+
KEEP(*(.cli_command))
114+
PROVIDE(__stop_cli_command = .);
115+
} > FLASH
116+
.pwr_mgmt_data :
117+
{
118+
PROVIDE(__start_pwr_mgmt_data = .);
119+
KEEP(*(SORT(.pwr_mgmt_data*)))
120+
PROVIDE(__stop_pwr_mgmt_data = .);
121+
} > FLASH
122+
.sdh_ble_observers :
123+
{
124+
PROVIDE(__start_sdh_ble_observers = .);
125+
KEEP(*(SORT(.sdh_ble_observers*)))
126+
PROVIDE(__stop_sdh_ble_observers = .);
127+
} > FLASH
128+
.dfu_trans :
129+
{
130+
PROVIDE(__start_dfu_trans = .);
131+
KEEP(*(SORT(.dfu_trans*)))
132+
PROVIDE(__stop_dfu_trans = .);
133+
} > FLASH
134+
135+
} INSERT AFTER .text
136+
137+
INCLUDE "nrf_common.ld"

0 commit comments

Comments
 (0)