|
| 1 | +PROJECT_NAME := bluey1.2_s132 |
| 2 | +TARGETS := nrf52832_xxaa |
| 3 | +OUTPUT_DIRECTORY := _build |
| 4 | + |
| 5 | +SDK_ROOT := ../../../../../.. |
| 6 | +PROJ_DIR := ../../.. |
| 7 | + |
| 8 | +$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \ |
| 9 | + LINKER_SCRIPT := ble_app_uart_gcc_nrf52.ld |
| 10 | + |
| 11 | +# Source files common to all targets |
| 12 | +SRC_FILES += \ |
| 13 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \ |
| 14 | + $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \ |
| 15 | + $(SDK_ROOT)/components/libraries/button/app_button.c \ |
| 16 | + $(SDK_ROOT)/components/libraries/util/app_error.c \ |
| 17 | + $(SDK_ROOT)/components/libraries/util/app_error_weak.c \ |
| 18 | + $(SDK_ROOT)/components/libraries/fifo/app_fifo.c \ |
| 19 | + $(SDK_ROOT)/components/libraries/pwm/app_pwm.c \ |
| 20 | + $(SDK_ROOT)/components/libraries/timer/app_timer.c \ |
| 21 | + $(SDK_ROOT)/components/libraries/uart/app_uart_fifo.c \ |
| 22 | + $(SDK_ROOT)/components/libraries/util/app_util_platform.c \ |
| 23 | + $(SDK_ROOT)/components/libraries/fstorage/fstorage.c \ |
| 24 | + $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \ |
| 25 | + $(SDK_ROOT)/components/libraries/util/nrf_assert.c \ |
| 26 | + $(SDK_ROOT)/components/libraries/uart/retarget.c \ |
| 27 | + $(SDK_ROOT)/components/libraries/util/sdk_errors.c \ |
| 28 | + $(SDK_ROOT)/components/boards/boards.c \ |
| 29 | + $(SDK_ROOT)/components/drivers_nrf/clock/nrf_drv_clock.c \ |
| 30 | + $(SDK_ROOT)/components/drivers_nrf/common/nrf_drv_common.c \ |
| 31 | + $(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \ |
| 32 | + $(SDK_ROOT)/components/drivers_nrf/ppi/nrf_drv_ppi.c \ |
| 33 | + $(SDK_ROOT)/components/drivers_nrf/timer/nrf_drv_timer.c \ |
| 34 | + $(SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \ |
| 35 | + $(SDK_ROOT)/components/libraries/bsp/bsp.c \ |
| 36 | + $(SDK_ROOT)/components/libraries/bsp/bsp_btn_ble.c \ |
| 37 | + $(SDK_ROOT)/components/libraries/bsp/bsp_nfc.c \ |
| 38 | + $(PROJ_DIR)/main.c \ |
| 39 | + $(SDK_ROOT)/external/segger_rtt/RTT_Syscalls_GCC.c \ |
| 40 | + $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \ |
| 41 | + $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \ |
| 42 | + $(SDK_ROOT)/components/ble/common/ble_advdata.c \ |
| 43 | + $(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \ |
| 44 | + $(SDK_ROOT)/components/ble/common/ble_conn_params.c \ |
| 45 | + $(SDK_ROOT)/components/ble/common/ble_srv_common.c \ |
| 46 | + $(SDK_ROOT)/components/toolchain/gcc/gcc_startup_nrf52.S \ |
| 47 | + $(SDK_ROOT)/components/toolchain/system_nrf52.c \ |
| 48 | + $(SDK_ROOT)/components/ble/ble_services/ble_nus/ble_nus.c \ |
| 49 | + $(SDK_ROOT)/components/softdevice/common/softdevice_handler/softdevice_handler.c \ |
| 50 | + |
| 51 | +# Include folders common to all targets |
| 52 | +INC_FOLDERS += \ |
| 53 | + $(SDK_ROOT)/components/drivers_nrf/comp \ |
| 54 | + $(SDK_ROOT)/components/drivers_nrf/twi_master \ |
| 55 | + $(SDK_ROOT)/components/ble/ble_services/ble_ancs_c \ |
| 56 | + $(SDK_ROOT)/components/ble/ble_services/ble_ias_c \ |
| 57 | + $(SDK_ROOT)/components/libraries/pwm \ |
| 58 | + $(SDK_ROOT)/components/softdevice/s132/headers/nrf52 \ |
| 59 | + $(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \ |
| 60 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/generic \ |
| 61 | + $(SDK_ROOT)/components/libraries/usbd/class/msc \ |
| 62 | + $(SDK_ROOT)/components/libraries/usbd/class/hid \ |
| 63 | + $(SDK_ROOT)/components/libraries/log \ |
| 64 | + $(SDK_ROOT)/components/ble/ble_services/ble_gls \ |
| 65 | + $(SDK_ROOT)/components/libraries/fstorage \ |
| 66 | + $(SDK_ROOT)/components/drivers_nrf/i2s \ |
| 67 | + $(SDK_ROOT)/components/libraries/gpiote \ |
| 68 | + $(SDK_ROOT)/components/drivers_nrf/gpiote \ |
| 69 | + $(SDK_ROOT)/components/libraries/fifo \ |
| 70 | + $(SDK_ROOT)/components/boards \ |
| 71 | + $(SDK_ROOT)/components/drivers_nrf/common \ |
| 72 | + $(SDK_ROOT)/components/ble/ble_advertising \ |
| 73 | + $(SDK_ROOT)/components/drivers_nrf/adc \ |
| 74 | + $(SDK_ROOT)/components/ble/ble_services/ble_bas_c \ |
| 75 | + $(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \ |
| 76 | + $(SDK_ROOT)/components/libraries/queue \ |
| 77 | + $(SDK_ROOT)/components/ble/ble_dtm \ |
| 78 | + $(SDK_ROOT)/components/toolchain/cmsis/include \ |
| 79 | + $(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \ |
| 80 | + $(SDK_ROOT)/components/drivers_nrf/uart \ |
| 81 | + $(SDK_ROOT)/components/ble/common \ |
| 82 | + $(SDK_ROOT)/components/ble/ble_services/ble_lls \ |
| 83 | + $(SDK_ROOT)/components/drivers_nrf/wdt \ |
| 84 | + $(SDK_ROOT)/components/libraries/bsp \ |
| 85 | + $(SDK_ROOT)/components/ble/ble_services/ble_bas \ |
| 86 | + $(SDK_ROOT)/components/libraries/experimental_section_vars \ |
| 87 | + $(SDK_ROOT)/components/softdevice/s132/headers \ |
| 88 | + $(SDK_ROOT)/components/ble/ble_services/ble_ans_c \ |
| 89 | + $(SDK_ROOT)/components/libraries/slip \ |
| 90 | + $(SDK_ROOT)/components/libraries/mem_manager \ |
| 91 | + $(SDK_ROOT)/external/segger_rtt \ |
| 92 | + $(SDK_ROOT)/components/libraries/csense_drv \ |
| 93 | + $(SDK_ROOT)/components/drivers_nrf/hal \ |
| 94 | + $(SDK_ROOT)/components/ble/ble_services/ble_nus_c \ |
| 95 | + $(SDK_ROOT)/components/drivers_nrf/rtc \ |
| 96 | + $(SDK_ROOT)/components/ble/ble_services/ble_ias \ |
| 97 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \ |
| 98 | + $(SDK_ROOT)/components/drivers_nrf/ppi \ |
| 99 | + $(SDK_ROOT)/components/ble/ble_services/ble_dfu \ |
| 100 | + $(SDK_ROOT)/components/drivers_nrf/twis_slave \ |
| 101 | + $(SDK_ROOT)/components \ |
| 102 | + $(SDK_ROOT)/components/libraries/scheduler \ |
| 103 | + $(SDK_ROOT)/components/ble/ble_services/ble_lbs \ |
| 104 | + $(SDK_ROOT)/components/ble/ble_services/ble_hts \ |
| 105 | + $(SDK_ROOT)/components/drivers_nrf/delay \ |
| 106 | + $(SDK_ROOT)/components/libraries/crc16 \ |
| 107 | + $(SDK_ROOT)/components/drivers_nrf/timer \ |
| 108 | + $(SDK_ROOT)/components/libraries/util \ |
| 109 | + $(SDK_ROOT)/components/drivers_nrf/pwm \ |
| 110 | + ../config \ |
| 111 | + $(SDK_ROOT)/components/libraries/usbd/class/cdc \ |
| 112 | + $(SDK_ROOT)/components/libraries/csense \ |
| 113 | + $(SDK_ROOT)/components/drivers_nrf/rng \ |
| 114 | + $(SDK_ROOT)/components/libraries/low_power_pwm \ |
| 115 | + $(SDK_ROOT)/components/libraries/hardfault \ |
| 116 | + $(SDK_ROOT)/components/ble/ble_services/ble_cscs \ |
| 117 | + $(SDK_ROOT)/components/libraries/uart \ |
| 118 | + $(SDK_ROOT)/components/libraries/hci \ |
| 119 | + $(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \ |
| 120 | + $(SDK_ROOT)/components/drivers_nrf/spi_slave \ |
| 121 | + $(SDK_ROOT)/components/drivers_nrf/lpcomp \ |
| 122 | + $(SDK_ROOT)/components/libraries/timer \ |
| 123 | + $(SDK_ROOT)/components/drivers_nrf/power \ |
| 124 | + $(SDK_ROOT)/components/libraries/usbd/config \ |
| 125 | + $(SDK_ROOT)/components/toolchain \ |
| 126 | + $(SDK_ROOT)/components/libraries/led_softblink \ |
| 127 | + $(SDK_ROOT)/components/drivers_nrf/qdec \ |
| 128 | + $(SDK_ROOT)/components/ble/ble_services/ble_cts_c \ |
| 129 | + $(SDK_ROOT)/components/drivers_nrf/spi_master \ |
| 130 | + $(SDK_ROOT)/components/ble/ble_services/ble_nus \ |
| 131 | + $(SDK_ROOT)/components/ble/ble_services/ble_hids \ |
| 132 | + $(SDK_ROOT)/components/drivers_nrf/pdm \ |
| 133 | + $(SDK_ROOT)/components/libraries/crc32 \ |
| 134 | + $(SDK_ROOT)/components/libraries/usbd/class/audio \ |
| 135 | + $(SDK_ROOT)/components/ble/peer_manager \ |
| 136 | + $(SDK_ROOT)/components/drivers_nrf/swi \ |
| 137 | + $(SDK_ROOT)/components/ble/ble_services/ble_tps \ |
| 138 | + $(SDK_ROOT)/components/ble/ble_services/ble_dis \ |
| 139 | + $(SDK_ROOT)/components/device \ |
| 140 | + $(SDK_ROOT)/components/ble/nrf_ble_qwr \ |
| 141 | + $(SDK_ROOT)/components/libraries/button \ |
| 142 | + $(SDK_ROOT)/components/libraries/usbd \ |
| 143 | + $(SDK_ROOT)/components/drivers_nrf/saadc \ |
| 144 | + $(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \ |
| 145 | + $(SDK_ROOT)/components/ble/ble_racp \ |
| 146 | + $(SDK_ROOT)/components/toolchain/gcc \ |
| 147 | + $(SDK_ROOT)/components/libraries/fds \ |
| 148 | + $(SDK_ROOT)/components/libraries/twi \ |
| 149 | + $(SDK_ROOT)/components/drivers_nrf/clock \ |
| 150 | + $(SDK_ROOT)/components/ble/ble_services/ble_rscs \ |
| 151 | + $(SDK_ROOT)/components/drivers_nrf/usbd \ |
| 152 | + $(SDK_ROOT)/components/softdevice/common/softdevice_handler \ |
| 153 | + $(SDK_ROOT)/components/ble/ble_services/ble_hrs \ |
| 154 | + $(SDK_ROOT)/components/libraries/log/src \ |
| 155 | + |
| 156 | +# Libraries common to all targets |
| 157 | +LIB_FILES += \ |
| 158 | + |
| 159 | +# C flags common to all targets |
| 160 | +CFLAGS += -DNRF52 |
| 161 | +CFLAGS += -DNRF52_PAN_64 |
| 162 | +CFLAGS += -DSOFTDEVICE_PRESENT |
| 163 | +CFLAGS += -DBOARD_PCA10040 |
| 164 | +CFLAGS += -DNRF52832 |
| 165 | +CFLAGS += -DNRF52_PAN_12 |
| 166 | +CFLAGS += -DNRF52_PAN_58 |
| 167 | +CFLAGS += -DNRF52_PAN_54 |
| 168 | +CFLAGS += -DNRF52_PAN_31 |
| 169 | +CFLAGS += -DNRF52_PAN_51 |
| 170 | +CFLAGS += -DNRF52_PAN_36 |
| 171 | +CFLAGS += -DCONFIG_GPIO_AS_PINRESET |
| 172 | +CFLAGS += -DBLE_STACK_SUPPORT_REQD |
| 173 | +CFLAGS += -DNRF52_PAN_15 |
| 174 | +CFLAGS += -DNRF_SD_BLE_API_VERSION=3 |
| 175 | +CFLAGS += -DSWI_DISABLE0 |
| 176 | +CFLAGS += -DNRF52_PAN_20 |
| 177 | +CFLAGS += -DNRF52_PAN_55 |
| 178 | +CFLAGS += -DS132 |
| 179 | +CFLAGS += -mcpu=cortex-m4 |
| 180 | +CFLAGS += -mthumb -mabi=aapcs |
| 181 | +CFLAGS += -Wall -Werror -O0 -g3 |
| 182 | +CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 |
| 183 | +# keep every function in separate section, this allows linker to discard unused ones |
| 184 | +CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing |
| 185 | +CFLAGS += -fno-builtin --short-enums |
| 186 | + |
| 187 | +# C++ flags common to all targets |
| 188 | +CXXFLAGS += \ |
| 189 | + |
| 190 | +# Assembler flags common to all targets |
| 191 | +ASMFLAGS += -x assembler-with-cpp |
| 192 | +ASMFLAGS += -DNRF52 |
| 193 | +ASMFLAGS += -DNRF52_PAN_64 |
| 194 | +ASMFLAGS += -DSOFTDEVICE_PRESENT |
| 195 | +ASMFLAGS += -DBOARD_PCA10040 |
| 196 | +ASMFLAGS += -DNRF52832 |
| 197 | +ASMFLAGS += -DNRF52_PAN_12 |
| 198 | +ASMFLAGS += -DNRF52_PAN_58 |
| 199 | +ASMFLAGS += -DNRF52_PAN_54 |
| 200 | +ASMFLAGS += -DNRF52_PAN_31 |
| 201 | +ASMFLAGS += -DNRF52_PAN_51 |
| 202 | +ASMFLAGS += -DNRF52_PAN_36 |
| 203 | +ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET |
| 204 | +ASMFLAGS += -DBLE_STACK_SUPPORT_REQD |
| 205 | +ASMFLAGS += -DNRF52_PAN_15 |
| 206 | +ASMFLAGS += -DNRF_SD_BLE_API_VERSION=3 |
| 207 | +ASMFLAGS += -DSWI_DISABLE0 |
| 208 | +ASMFLAGS += -DNRF52_PAN_20 |
| 209 | +ASMFLAGS += -DNRF52_PAN_55 |
| 210 | +ASMFLAGS += -DS132 |
| 211 | + |
| 212 | +# Linker flags |
| 213 | +LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) |
| 214 | +LDFLAGS += -mcpu=cortex-m4 |
| 215 | +LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 |
| 216 | +# let linker to dump unused sections |
| 217 | +LDFLAGS += -Wl,--gc-sections |
| 218 | +# use newlib in nano version |
| 219 | +LDFLAGS += --specs=nano.specs -lc -lnosys |
| 220 | + |
| 221 | + |
| 222 | +.PHONY: $(TARGETS) default all clean help flash flash_softdevice |
| 223 | + |
| 224 | +# Default target - first one defined |
| 225 | +default: nrf52832_xxaa |
| 226 | + |
| 227 | +# Print all targets that can be built |
| 228 | +help: |
| 229 | + @echo following targets are available: |
| 230 | + @echo nrf52832_xxaa |
| 231 | + |
| 232 | +TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc |
| 233 | + |
| 234 | +include $(TEMPLATE_PATH)/Makefile.common |
| 235 | + |
| 236 | +$(foreach target, $(TARGETS), $(call define_target, $(target))) |
| 237 | + |
| 238 | +# Flash the program |
| 239 | +flash: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex |
| 240 | + @echo Flashing: $< |
| 241 | + nrfjprog --program $< -f nrf52 --sectorerase |
| 242 | + nrfjprog --reset -f nrf52 |
| 243 | + |
| 244 | +# Flash softdevice |
| 245 | +flash_softdevice: |
| 246 | + @echo Flashing: s132_nrf52_3.0.0_softdevice.hex |
| 247 | + nrfjprog --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex -f nrf52 --sectorerase |
| 248 | + nrfjprog --reset -f nrf52 |
| 249 | + |
| 250 | +# make DFU package |
| 251 | +dfupkg: |
| 252 | + @echo Generating DFU package... |
| 253 | + nrfutil pkg generate --hw-version 52 --application-version 1 --application $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex --sd-req 0x8C --key-file ../../../private.key ../../../bluey_MeArm_dfu_package.zip |
| 254 | + |
| 255 | +erase: |
| 256 | + nrfjprog --eraseall -f nrf52 |
0 commit comments