|
| 1 | +PROJECT_NAME := ble_app_beacon_pca10040e_s112 |
| 2 | +TARGETS := nrf52810_xxaa |
| 3 | +OUTPUT_DIRECTORY := _build |
| 4 | + |
| 5 | +GNU_INSTALL_ROOT := $(shell dirname $(shell which arm-none-eabi-gcc))/ |
| 6 | +SDK_ROOT := ../../../nRF5_SDK_17.0.2_d674dde |
| 7 | +PROJ_DIR := ../src |
| 8 | + |
| 9 | +$(OUTPUT_DIRECTORY)/nrf52810_xxaa.out: \ |
| 10 | + LINKER_SCRIPT := moko.ld |
| 11 | + |
| 12 | +# Source files common to all targets |
| 13 | +SRC_FILES += \ |
| 14 | + $(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52810.S \ |
| 15 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c \ |
| 16 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \ |
| 17 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_uart.c \ |
| 18 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c \ |
| 19 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \ |
| 20 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \ |
| 21 | + $(SDK_ROOT)/components/libraries/button/app_button.c \ |
| 22 | + $(SDK_ROOT)/components/libraries/util/app_error.c \ |
| 23 | + $(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \ |
| 24 | + $(SDK_ROOT)/components/libraries/util/app_error_weak.c \ |
| 25 | + $(SDK_ROOT)/components/libraries/scheduler/app_scheduler.c \ |
| 26 | + $(SDK_ROOT)/components/libraries/timer/app_timer2.c \ |
| 27 | + $(SDK_ROOT)/components/libraries/util/app_util_platform.c \ |
| 28 | + $(SDK_ROOT)/components/libraries/timer/drv_rtc.c \ |
| 29 | + $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \ |
| 30 | + $(SDK_ROOT)/components/libraries/util/nrf_assert.c \ |
| 31 | + $(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \ |
| 32 | + $(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \ |
| 33 | + $(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \ |
| 34 | + $(SDK_ROOT)/external/fprintf/nrf_fprintf.c \ |
| 35 | + $(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \ |
| 36 | + $(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \ |
| 37 | + $(SDK_ROOT)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \ |
| 38 | + $(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c \ |
| 39 | + $(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c \ |
| 40 | + $(SDK_ROOT)/components/libraries/sortlist/nrf_sortlist.c \ |
| 41 | + $(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \ |
| 42 | + $(SDK_ROOT)/modules/nrfx/mdk/system_nrf52810.c \ |
| 43 | + $(SDK_ROOT)/components/boards/boards.c \ |
| 44 | + $(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \ |
| 45 | + $(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \ |
| 46 | + $(SDK_ROOT)/modules/nrfx/soc/nrfx_atomic.c \ |
| 47 | + $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \ |
| 48 | + $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \ |
| 49 | + $(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \ |
| 50 | + $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \ |
| 51 | + $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \ |
| 52 | + $(SDK_ROOT)/components/libraries/bsp/bsp.c \ |
| 53 | + $(PROJ_DIR)/ble_stack.c \ |
| 54 | + $(PROJ_DIR)/openhaystack.c \ |
| 55 | + $(PROJ_DIR)/main.c \ |
| 56 | + $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \ |
| 57 | + $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \ |
| 58 | + $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \ |
| 59 | + $(SDK_ROOT)/components/ble/common/ble_advdata.c \ |
| 60 | + $(SDK_ROOT)/components/ble/common/ble_srv_common.c \ |
| 61 | + $(SDK_ROOT)/external/utf_converter/utf.c \ |
| 62 | + $(SDK_ROOT)/components/softdevice/common/nrf_sdh.c \ |
| 63 | + $(SDK_ROOT)/components/softdevice/common/nrf_sdh_ble.c \ |
| 64 | + $(SDK_ROOT)/components/softdevice/common/nrf_sdh_soc.c \ |
| 65 | + |
| 66 | +# Include folders common to all targets |
| 67 | +INC_FOLDERS += \ |
| 68 | + $(SDK_ROOT)/components/ble/ble_services/ble_ancs_c \ |
| 69 | + $(SDK_ROOT)/components/ble/ble_services/ble_ias_c \ |
| 70 | + $(SDK_ROOT)/components/libraries/pwm \ |
| 71 | + $(SDK_ROOT)/components/softdevice/s112/headers/nrf52 \ |
| 72 | + $(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \ |
| 73 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/generic \ |
| 74 | + $(SDK_ROOT)/components/libraries/usbd/class/msc \ |
| 75 | + $(SDK_ROOT)/components/libraries/usbd/class/hid \ |
| 76 | + $(SDK_ROOT)/modules/nrfx/hal \ |
| 77 | + $(SDK_ROOT)/components/libraries/log \ |
| 78 | + $(SDK_ROOT)/components/ble/ble_services/ble_gls \ |
| 79 | + $(SDK_ROOT)/components/libraries/fstorage \ |
| 80 | + $(SDK_ROOT)/components/libraries/mutex \ |
| 81 | + $(SDK_ROOT)/components/libraries/gpiote \ |
| 82 | + $(SDK_ROOT)/components/libraries/bootloader/ble_dfu \ |
| 83 | + $(SDK_ROOT)/components/boards \ |
| 84 | + $(SDK_ROOT)/components/ble/ble_advertising \ |
| 85 | + $(SDK_ROOT)/external/utf_converter \ |
| 86 | + $(SDK_ROOT)/components/ble/ble_services/ble_bas_c \ |
| 87 | + $(SDK_ROOT)/modules/nrfx/drivers/include \ |
| 88 | + $(SDK_ROOT)/components/libraries/experimental_task_manager \ |
| 89 | + $(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \ |
| 90 | + $(SDK_ROOT)/components/libraries/queue \ |
| 91 | + $(SDK_ROOT)/components/libraries/pwr_mgmt \ |
| 92 | + $(SDK_ROOT)/components/ble/ble_dtm \ |
| 93 | + $(SDK_ROOT)/components/toolchain/cmsis/include \ |
| 94 | + $(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \ |
| 95 | + $(SDK_ROOT)/components/ble/common \ |
| 96 | + $(SDK_ROOT)/components/ble/ble_services/ble_lls \ |
| 97 | + $(SDK_ROOT)/components/libraries/bsp \ |
| 98 | + $(SDK_ROOT)/components/ble/ble_services/ble_bas \ |
| 99 | + $(SDK_ROOT)/components/libraries/mpu \ |
| 100 | + $(SDK_ROOT)/components/libraries/experimental_section_vars \ |
| 101 | + $(SDK_ROOT)/components/ble/ble_services/ble_ans_c \ |
| 102 | + $(SDK_ROOT)/components/libraries/slip \ |
| 103 | + $(SDK_ROOT)/components/libraries/delay \ |
| 104 | + $(SDK_ROOT)/components/libraries/csense_drv \ |
| 105 | + $(SDK_ROOT)/components/libraries/memobj \ |
| 106 | + $(SDK_ROOT)/components/ble/ble_services/ble_nus_c \ |
| 107 | + $(SDK_ROOT)/components/softdevice/common \ |
| 108 | + $(SDK_ROOT)/components/ble/ble_services/ble_ias \ |
| 109 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \ |
| 110 | + $(SDK_ROOT)/components/libraries/low_power_pwm \ |
| 111 | + $(SDK_ROOT)/components/ble/ble_services/ble_dfu \ |
| 112 | + $(SDK_ROOT)/external/fprintf \ |
| 113 | + $(SDK_ROOT)/components/libraries/svc \ |
| 114 | + $(SDK_ROOT)/components/libraries/atomic \ |
| 115 | + $(SDK_ROOT)/components \ |
| 116 | + $(SDK_ROOT)/components/libraries/scheduler \ |
| 117 | + $(SDK_ROOT)/components/libraries/cli \ |
| 118 | + $(SDK_ROOT)/components/ble/ble_services/ble_lbs \ |
| 119 | + $(SDK_ROOT)/components/ble/ble_services/ble_hts \ |
| 120 | + $(SDK_ROOT)/components/libraries/crc16 \ |
| 121 | + $(SDK_ROOT)/components/libraries/util \ |
| 122 | + ../config \ |
| 123 | + $(SDK_ROOT)/components/libraries/usbd/class/cdc \ |
| 124 | + $(SDK_ROOT)/components/libraries/csense \ |
| 125 | + $(SDK_ROOT)/components/libraries/balloc \ |
| 126 | + $(SDK_ROOT)/components/libraries/ecc \ |
| 127 | + $(SDK_ROOT)/components/libraries/hardfault \ |
| 128 | + $(SDK_ROOT)/components/ble/ble_services/ble_cscs \ |
| 129 | + $(SDK_ROOT)/components/libraries/hci \ |
| 130 | + $(SDK_ROOT)/components/libraries/timer \ |
| 131 | + $(SDK_ROOT)/integration/nrfx \ |
| 132 | + $(SDK_ROOT)/components/libraries/sortlist \ |
| 133 | + $(SDK_ROOT)/components/libraries/spi_mngr \ |
| 134 | + $(SDK_ROOT)/components/softdevice/s112/headers \ |
| 135 | + $(SDK_ROOT)/components/libraries/led_softblink \ |
| 136 | + $(SDK_ROOT)/components/libraries/sdcard \ |
| 137 | + $(SDK_ROOT)/modules/nrfx/mdk \ |
| 138 | + $(SDK_ROOT)/components/ble/ble_services/ble_cts_c \ |
| 139 | + $(SDK_ROOT)/components/ble/ble_services/ble_nus \ |
| 140 | + $(SDK_ROOT)/components/libraries/twi_mngr \ |
| 141 | + $(SDK_ROOT)/components/ble/ble_services/ble_hids \ |
| 142 | + $(SDK_ROOT)/components/libraries/strerror \ |
| 143 | + $(SDK_ROOT)/components/libraries/crc32 \ |
| 144 | + $(SDK_ROOT)/components/libraries/usbd/class/audio \ |
| 145 | + $(SDK_ROOT)/components/ble/peer_manager \ |
| 146 | + $(SDK_ROOT)/components/libraries/mem_manager \ |
| 147 | + $(SDK_ROOT)/components/libraries/ringbuf \ |
| 148 | + $(SDK_ROOT)/components/ble/ble_services/ble_tps \ |
| 149 | + $(SDK_ROOT)/components/ble/ble_services/ble_dis \ |
| 150 | + $(SDK_ROOT)/components/ble/nrf_ble_qwr \ |
| 151 | + $(SDK_ROOT)/components/libraries/gfx \ |
| 152 | + $(SDK_ROOT)/components/libraries/button \ |
| 153 | + $(SDK_ROOT)/modules/nrfx \ |
| 154 | + $(SDK_ROOT)/components/libraries/twi_sensor \ |
| 155 | + $(SDK_ROOT)/integration/nrfx/legacy \ |
| 156 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \ |
| 157 | + $(SDK_ROOT)/external/segger_rtt \ |
| 158 | + $(SDK_ROOT)/components/libraries/atomic_fifo \ |
| 159 | + $(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \ |
| 160 | + $(SDK_ROOT)/components/libraries/crypto \ |
| 161 | + $(SDK_ROOT)/components/ble/ble_racp \ |
| 162 | + $(SDK_ROOT)/components/libraries/fds \ |
| 163 | + $(SDK_ROOT)/components/ble/ble_services/ble_hrs \ |
| 164 | + $(SDK_ROOT)/components/ble/ble_services/ble_rscs \ |
| 165 | + $(SDK_ROOT)/components/libraries/usbd \ |
| 166 | + $(SDK_ROOT)/components/libraries/stack_guard \ |
| 167 | + $(SDK_ROOT)/components/libraries/log/src \ |
| 168 | + |
| 169 | +# Libraries common to all targets |
| 170 | +LIB_FILES += \ |
| 171 | + |
| 172 | +# Optimization flags |
| 173 | +OPT = -Os -g3 |
| 174 | +# Uncomment the line below to enable link time optimization |
| 175 | +#OPT += -flto |
| 176 | + |
| 177 | +# C flags common to all targets |
| 178 | +CFLAGS += $(OPT) |
| 179 | +CFLAGS += -DAPP_TIMER_V2 |
| 180 | +CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED |
| 181 | +CFLAGS += -DBOARD_PCA10040 |
| 182 | +CFLAGS += -DCONFIG_GPIO_AS_PINRESET |
| 183 | +CFLAGS += -DDEVELOP_IN_NRF52832 |
| 184 | +CFLAGS += -DFLOAT_ABI_SOFT |
| 185 | +CFLAGS += -DNRF52810_XXAA |
| 186 | +CFLAGS += -DNRF52_PAN_74 |
| 187 | +CFLAGS += -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 |
| 188 | +CFLAGS += -DNRF_SD_BLE_API_VERSION=7 |
| 189 | +CFLAGS += -DS112 |
| 190 | +CFLAGS += -DSOFTDEVICE_PRESENT |
| 191 | +CFLAGS += -mcpu=cortex-m4 |
| 192 | +CFLAGS += -mthumb -mabi=aapcs |
| 193 | +CFLAGS += -Wall -Werror |
| 194 | +CFLAGS += -mfloat-abi=soft |
| 195 | +# keep every function in a separate section, this allows linker to discard unused ones |
| 196 | +CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing |
| 197 | +CFLAGS += -fno-builtin -fshort-enums |
| 198 | + |
| 199 | +# C++ flags common to all targets |
| 200 | +CXXFLAGS += $(OPT) |
| 201 | +# Assembler flags common to all targets |
| 202 | +ASMFLAGS += -g3 |
| 203 | +ASMFLAGS += -mcpu=cortex-m4 |
| 204 | +ASMFLAGS += -mthumb -mabi=aapcs |
| 205 | +ASMFLAGS += -mfloat-abi=soft |
| 206 | +ASMFLAGS += -DAPP_TIMER_V2 |
| 207 | +ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED |
| 208 | +ASMFLAGS += -DBOARD_PCA10040 |
| 209 | +ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET |
| 210 | +ASMFLAGS += -DDEVELOP_IN_NRF52832 |
| 211 | +ASMFLAGS += -DFLOAT_ABI_SOFT |
| 212 | +ASMFLAGS += -DNRF52810_XXAA |
| 213 | +ASMFLAGS += -DNRF52_PAN_74 |
| 214 | +ASMFLAGS += -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 |
| 215 | +ASMFLAGS += -DNRF_SD_BLE_API_VERSION=7 |
| 216 | +ASMFLAGS += -DS112 |
| 217 | +ASMFLAGS += -DSOFTDEVICE_PRESENT |
| 218 | + |
| 219 | +# Linker flags |
| 220 | +LDFLAGS += $(OPT) |
| 221 | +LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT) |
| 222 | +LDFLAGS += -mcpu=cortex-m4 |
| 223 | +# let linker dump unused sections |
| 224 | +LDFLAGS += -Wl,--gc-sections |
| 225 | +# use newlib in nano version |
| 226 | +LDFLAGS += --specs=nano.specs |
| 227 | + |
| 228 | +nrf52810_xxaa: CFLAGS += -D__HEAP_SIZE=2048 |
| 229 | +nrf52810_xxaa: CFLAGS += -D__STACK_SIZE=2048 |
| 230 | +nrf52810_xxaa: ASMFLAGS += -D__HEAP_SIZE=2048 |
| 231 | +nrf52810_xxaa: ASMFLAGS += -D__STACK_SIZE=2048 |
| 232 | + |
| 233 | +# Add standard libraries at the very end of the linker input, after all objects |
| 234 | +# that may need symbols provided by these libraries. |
| 235 | +LIB_FILES += -lc -lnosys -lm |
| 236 | + |
| 237 | + |
| 238 | +.PHONY: default help |
| 239 | + |
| 240 | +# Default target - first one defined |
| 241 | +default: nrf52810_xxaa |
| 242 | + |
| 243 | +# Print all targets that can be built |
| 244 | +help: |
| 245 | + @echo following targets are available: |
| 246 | + @echo nrf52810_xxaa |
| 247 | + @echo install |
| 248 | + @echo flash_softdevice |
| 249 | + @echo sdk_config - starting external tool for editing sdk_config.h |
| 250 | + @echo flash - flashing binary |
| 251 | + |
| 252 | +TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc |
| 253 | + |
| 254 | + |
| 255 | +include $(TEMPLATE_PATH)/Makefile.common |
| 256 | + |
| 257 | +$(foreach target, $(TARGETS), $(call define_target, $(target))) |
| 258 | + |
| 259 | +.PHONY: install flash flash_softdevice erase |
| 260 | + |
| 261 | +# Install program and softdevice |
| 262 | +install: default erase flash flash_softdevice |
| 263 | + |
| 264 | +# Flash the program |
| 265 | +flash: |
| 266 | + @echo Flashing: $(OUTPUT_DIRECTORY)/nrf52810_xxaa.hex |
| 267 | + nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52810_xxaa.hex --sectorerase |
| 268 | + nrfjprog -f nrf52 --reset |
| 269 | + |
| 270 | +# Flash softdevice |
| 271 | +flash_softdevice: |
| 272 | + @echo Flashing: s112_nrf52_7.2.0_softdevice.hex |
| 273 | + nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s112/hex/s112_nrf52_7.2.0_softdevice.hex --sectorerase |
| 274 | + nrfjprog -f nrf52 --reset |
| 275 | + |
| 276 | +erase: |
| 277 | + nrfjprog -f nrf52 --eraseall |
| 278 | + |
| 279 | +SDK_CONFIG_FILE := ../config/sdk_config.h |
| 280 | +CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar |
| 281 | +sdk_config: |
| 282 | + java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE) |
0 commit comments