Permalink
Browse files

Merge 61b6fae into c59fc14

  • Loading branch information...
tralamazza committed Oct 12, 2017
2 parents c59fc14 + 61b6fae commit 1988c2380846060df7077372b2fd52e836b851e2
Showing with 59,703 additions and 0 deletions.
  1. +1 −0 lib/utils/pyexec.h
  2. +8 −0 ports/nrf/.gitignore
  3. +294 −0 ports/nrf/Makefile
  4. +144 −0 ports/nrf/README.md
  5. +37 −0 ports/nrf/bluetooth_conf.h
  6. +79 −0 ports/nrf/boards/arduino_primo/mpconfigboard.h
  7. +7 −0 ports/nrf/boards/arduino_primo/mpconfigboard.mk
  8. +9 −0 ports/nrf/boards/arduino_primo/mpconfigboard_s132.mk
  9. +17 −0 ports/nrf/boards/arduino_primo/nrf52_hal_conf.h
  10. +30 −0 ports/nrf/boards/arduino_primo/pins.csv
  11. +103 −0 ports/nrf/boards/common.ld
  12. +78 −0 ports/nrf/boards/dvk_bl652/mpconfigboard.h
  13. +6 −0 ports/nrf/boards/dvk_bl652/mpconfigboard.mk
  14. +10 −0 ports/nrf/boards/dvk_bl652/mpconfigboard_s132.mk
  15. +18 −0 ports/nrf/boards/dvk_bl652/nrf52_hal_conf.h
  16. +31 −0 ports/nrf/boards/dvk_bl652/pins.csv
  17. +27 −0 ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld
  18. +76 −0 ports/nrf/boards/feather52/mpconfigboard.h
  19. +25 −0 ports/nrf/boards/feather52/mpconfigboard.mk
  20. +25 −0 ports/nrf/boards/feather52/mpconfigboard_s132.mk
  21. +18 −0 ports/nrf/boards/feather52/nrf52_hal_conf.h
  22. +25 −0 ports/nrf/boards/feather52/pins.csv
  23. +399 −0 ports/nrf/boards/make-pins.py
  24. +68 −0 ports/nrf/boards/microbit/mpconfigboard.h
  25. +5 −0 ports/nrf/boards/microbit/mpconfigboard.mk
  26. +8 −0 ports/nrf/boards/microbit/mpconfigboard_s110.mk
  27. +14 −0 ports/nrf/boards/microbit/nrf51_hal_conf.h
  28. +32 −0 ports/nrf/boards/microbit/pins.csv
  29. +31 −0 ports/nrf/boards/nrf51_prefix.c
  30. +28 −0 ports/nrf/boards/nrf51x22_256k_16k.ld
  31. +28 −0 ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld
  32. +28 −0 ports/nrf/boards/nrf51x22_256k_32k.ld
  33. +28 −0 ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld
  34. +28 −0 ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld
  35. +28 −0 ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld
  36. +27 −0 ports/nrf/boards/nrf52832_512k_64k.ld
  37. +27 −0 ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld
  38. +27 −0 ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld
  39. +27 −0 ports/nrf/boards/nrf52840_1M_256k.ld
  40. +31 −0 ports/nrf/boards/nrf52_prefix.c
  41. +66 −0 ports/nrf/boards/pca10000/mpconfigboard.h
  42. +4 −0 ports/nrf/boards/pca10000/mpconfigboard.mk
  43. +5 −0 ports/nrf/boards/pca10000/mpconfigboard_s110.mk
  44. +11 −0 ports/nrf/boards/pca10000/nrf51_hal_conf.h
  45. +7 −0 ports/nrf/boards/pca10000/pins.csv
  46. +68 −0 ports/nrf/boards/pca10001/mpconfigboard.h
  47. +4 −0 ports/nrf/boards/pca10001/mpconfigboard.mk
  48. +5 −0 ports/nrf/boards/pca10001/mpconfigboard_s110.mk
  49. +14 −0 ports/nrf/boards/pca10001/nrf51_hal_conf.h
  50. +32 −0 ports/nrf/boards/pca10001/pins.csv
  51. +75 −0 ports/nrf/boards/pca10028/mpconfigboard.h
  52. +4 −0 ports/nrf/boards/pca10028/mpconfigboard.mk
  53. +5 −0 ports/nrf/boards/pca10028/mpconfigboard_s110.mk
  54. +5 −0 ports/nrf/boards/pca10028/mpconfigboard_s120.mk
  55. +5 −0 ports/nrf/boards/pca10028/mpconfigboard_s130.mk
  56. +14 −0 ports/nrf/boards/pca10028/nrf51_hal_conf.h
  57. +32 −0 ports/nrf/boards/pca10028/pins.csv
  58. +74 −0 ports/nrf/boards/pca10031/mpconfigboard.h
  59. +4 −0 ports/nrf/boards/pca10031/mpconfigboard.mk
  60. +5 −0 ports/nrf/boards/pca10031/mpconfigboard_s110.mk
  61. +5 −0 ports/nrf/boards/pca10031/mpconfigboard_s120.mk
  62. +5 −0 ports/nrf/boards/pca10031/mpconfigboard_s130.mk
  63. +14 −0 ports/nrf/boards/pca10031/nrf51_hal_conf.h
  64. +13 −0 ports/nrf/boards/pca10031/pins.csv
  65. +80 −0 ports/nrf/boards/pca10040/mpconfigboard.h
  66. +6 −0 ports/nrf/boards/pca10040/mpconfigboard.mk
  67. +8 −0 ports/nrf/boards/pca10040/mpconfigboard_s132.mk
  68. +18 −0 ports/nrf/boards/pca10040/nrf52_hal_conf.h
  69. +30 −0 ports/nrf/boards/pca10040/pins.csv
  70. +84 −0 ports/nrf/boards/pca10056/mpconfigboard.h
  71. +6 −0 ports/nrf/boards/pca10056/mpconfigboard.mk
  72. +18 −0 ports/nrf/boards/pca10056/nrf52_hal_conf.h
  73. +48 −0 ports/nrf/boards/pca10056/pins.csv
  74. +65 −0 ports/nrf/boards/wt51822_s4at/mpconfigboard.h
  75. +4 −0 ports/nrf/boards/wt51822_s4at/mpconfigboard.mk
  76. +7 −0 ports/nrf/boards/wt51822_s4at/mpconfigboard_s110.mk
  77. +14 −0 ports/nrf/boards/wt51822_s4at/nrf51_hal_conf.h
  78. +7 −0 ports/nrf/boards/wt51822_s4at/pins.csv
  79. +30 −0 ports/nrf/builtin_open.c
  80. +144 −0 ports/nrf/device/compiler_abstraction.h
  81. +77 −0 ports/nrf/device/nrf.h
  82. +1,193 −0 ports/nrf/device/nrf51/nrf51.h
  83. +6,129 −0 ports/nrf/device/nrf51/nrf51_bitfields.h
  84. +440 −0 ports/nrf/device/nrf51/nrf51_deprecated.h
  85. +151 −0 ports/nrf/device/nrf51/startup_nrf51822.c
  86. +69 −0 ports/nrf/device/nrf51/system_nrf51.h
  87. +151 −0 ports/nrf/device/nrf51/system_nrf51822.c
  88. +952 −0 ports/nrf/device/nrf52/nrf51_to_nrf52.h
  89. +567 −0 ports/nrf/device/nrf52/nrf51_to_nrf52840.h
  90. +2,091 −0 ports/nrf/device/nrf52/nrf52.h
  91. +2,417 −0 ports/nrf/device/nrf52/nrf52840.h
  92. +14,633 −0 ports/nrf/device/nrf52/nrf52840_bitfields.h
  93. +12,642 −0 ports/nrf/device/nrf52/nrf52_bitfields.h
  94. +70 −0 ports/nrf/device/nrf52/nrf52_name_change.h
  95. +88 −0 ports/nrf/device/nrf52/nrf52_to_nrf52840.h
  96. +167 −0 ports/nrf/device/nrf52/startup_nrf52832.c
  97. +182 −0 ports/nrf/device/nrf52/startup_nrf52840.c
  98. +69 −0 ports/nrf/device/nrf52/system_nrf52.h
  99. +308 −0 ports/nrf/device/nrf52/system_nrf52832.c
  100. +209 −0 ports/nrf/device/nrf52/system_nrf52840.c
  101. +69 −0 ports/nrf/device/nrf52/system_nrf52840.h
  102. +1,065 −0 ports/nrf/drivers/bluetooth/ble_drv.c
  103. +129 −0 ports/nrf/drivers/bluetooth/ble_drv.h
  104. +266 −0 ports/nrf/drivers/bluetooth/ble_uart.c
  105. +42 −0 ports/nrf/drivers/bluetooth/ble_uart.h
  106. +55 −0 ports/nrf/drivers/bluetooth/bluetooth_common.mk
  107. +74 −0 ports/nrf/drivers/bluetooth/download_ble_stack.sh
  108. +99 −0 ports/nrf/drivers/bluetooth/ringbuffer.h
  109. +257 −0 ports/nrf/drivers/softpwm.c
  110. +13 −0 ports/nrf/drivers/softpwm.h
  111. +162 −0 ports/nrf/drivers/ticker.c
  112. +30 −0 ports/nrf/drivers/ticker.h
  113. +35 −0 ports/nrf/examples/mountsd.py
  114. +13 −0 ports/nrf/examples/musictest.py
  115. +15 −0 ports/nrf/examples/nrf52_pwm.py
  116. +50 −0 ports/nrf/examples/nrf52_servo.py
  117. +213 −0 ports/nrf/examples/powerup.py
  118. +210 −0 ports/nrf/examples/seeed_tft.py
  119. +27 −0 ports/nrf/examples/ssd1306_mod.py
  120. +58 −0 ports/nrf/examples/ubluepy_eddystone.py
  121. +38 −0 ports/nrf/examples/ubluepy_scan.py
  122. +92 −0 ports/nrf/examples/ubluepy_temp.py
  123. +33 −0 ports/nrf/fatfs_port.c
  124. +4 −0 ports/nrf/freeze/test.py
  125. +52 −0 ports/nrf/gccollect.c
  126. +45 −0 ports/nrf/gccollect.h
  127. +129 −0 ports/nrf/hal/hal_adc.c
  128. +75 −0 ports/nrf/hal/hal_adc.h
  129. +118 −0 ports/nrf/hal/hal_adce.c
  130. +117 −0 ports/nrf/hal/hal_gpio.c
  131. +128 −0 ports/nrf/hal/hal_gpio.h
  132. +119 −0 ports/nrf/hal/hal_irq.h
  133. +118 −0 ports/nrf/hal/hal_pwm.c
  134. +108 −0 ports/nrf/hal/hal_pwm.h
  135. +122 −0 ports/nrf/hal/hal_qspie.c
  136. +110 −0 ports/nrf/hal/hal_qspie.h
  137. +76 −0 ports/nrf/hal/hal_rng.c
  138. +34 −0 ports/nrf/hal/hal_rng.h
  139. +123 −0 ports/nrf/hal/hal_rtc.c
  140. +70 −0 ports/nrf/hal/hal_rtc.h
  141. +127 −0 ports/nrf/hal/hal_spi.c
  142. +127 −0 ports/nrf/hal/hal_spi.h
  143. +123 −0 ports/nrf/hal/hal_spie.c
  144. +76 −0 ports/nrf/hal/hal_temp.c
  145. +39 −0 ports/nrf/hal/hal_temp.h
  146. +116 −0 ports/nrf/hal/hal_time.c
  147. +34 −0 ports/nrf/hal/hal_time.h
  148. +103 −0 ports/nrf/hal/hal_timer.c
  149. +76 −0 ports/nrf/hal/hal_timer.h
  150. +133 −0 ports/nrf/hal/hal_twi.c
  151. +118 −0 ports/nrf/hal/hal_twi.h
  152. +115 −0 ports/nrf/hal/hal_twie.c
  153. +146 −0 ports/nrf/hal/hal_uart.c
  154. +125 −0 ports/nrf/hal/hal_uart.h
  155. +180 −0 ports/nrf/hal/hal_uarte.c
  156. +30 −0 ports/nrf/hal/nrf51_hal.h
  157. +30 −0 ports/nrf/hal/nrf52_hal.h
  158. +54 −0 ports/nrf/help.c
  159. +249 −0 ports/nrf/main.c
  160. +47 −0 ports/nrf/modules/ble/help_sd.h
  161. +105 −0 ports/nrf/modules/ble/modble.c
  162. +144 −0 ports/nrf/modules/machine/adc.c
  163. +34 −0 ports/nrf/modules/machine/adc.h
  164. +163 −0 ports/nrf/modules/machine/i2c.c
  165. +36 −0 ports/nrf/modules/machine/i2c.h
  166. +159 −0 ports/nrf/modules/machine/led.c
  167. +53 −0 ports/nrf/modules/machine/led.h
  168. +244 −0 ports/nrf/modules/machine/modmachine.c
  169. +42 −0 ports/nrf/modules/machine/modmachine.h
  170. +695 −0 ports/nrf/modules/machine/pin.c
  171. +102 −0 ports/nrf/modules/machine/pin.h
  172. +332 −0 ports/nrf/modules/machine/pwm.c
  173. +41 −0 ports/nrf/modules/machine/pwm.h
  174. +178 −0 ports/nrf/modules/machine/rtc.c
  175. +36 −0 ports/nrf/modules/machine/rtc.h
  176. +377 −0 ports/nrf/modules/machine/spi.c
  177. +38 −0 ports/nrf/modules/machine/spi.h
  178. +96 −0 ports/nrf/modules/machine/temp.c
  179. +34 −0 ports/nrf/modules/machine/temp.h
  180. +194 −0 ports/nrf/modules/machine/timer.c
  181. +36 −0 ports/nrf/modules/machine/timer.h
  182. +382 −0 ports/nrf/modules/machine/uart.c
  183. +48 −0 ports/nrf/modules/machine/uart.h
  184. +517 −0 ports/nrf/modules/music/modmusic.c
  185. +7 −0 ports/nrf/modules/music/modmusic.h
  186. +164 −0 ports/nrf/modules/music/musictunes.c
  187. +52 −0 ports/nrf/modules/music/musictunes.h
  188. +55 −0 ports/nrf/modules/pyb/modpyb.c
  189. +177 −0 ports/nrf/modules/random/modrandom.c
  190. +70 −0 ports/nrf/modules/ubluepy/modubluepy.c
  191. +200 −0 ports/nrf/modules/ubluepy/modubluepy.h
  192. +222 −0 ports/nrf/modules/ubluepy/ubluepy_characteristic.c
  193. +99 −0 ports/nrf/modules/ubluepy/ubluepy_constants.c
  194. +89 −0 ports/nrf/modules/ubluepy/ubluepy_delegate.c
  195. +82 −0 ports/nrf/modules/ubluepy/ubluepy_descriptor.c
  196. +498 −0 ports/nrf/modules/ubluepy/ubluepy_peripheral.c
  197. +146 −0 ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
  198. +124 −0 ports/nrf/modules/ubluepy/ubluepy_scanner.c
  199. +186 −0 ports/nrf/modules/ubluepy/ubluepy_service.c
  200. +173 −0 ports/nrf/modules/ubluepy/ubluepy_uuid.c
  201. +168 −0 ports/nrf/modules/uos/moduos.c
  202. +53 −0 ports/nrf/modules/utime/modutime.c
  203. +308 −0 ports/nrf/mpconfigport.h
  204. +77 −0 ports/nrf/mphalport.c
  205. +74 −0 ports/nrf/mphalport.h
  206. +32 −0 ports/nrf/nrf51_af.csv
  207. +48 −0 ports/nrf/nrf52_af.csv
  208. +59 −0 ports/nrf/pin_defs_nrf5.h
  209. +92 −0 ports/nrf/pin_named_pins.c
  210. +139 −0 ports/nrf/qstrdefsport.h
View
@@ -48,6 +48,7 @@ int pyexec_frozen_module(const char *name);
void pyexec_event_repl_init(void);
int pyexec_event_repl_process_char(int c);
extern uint8_t pyexec_repl_active;
mp_obj_t pyb_set_repl_info(mp_obj_t o_value);
MP_DECLARE_CONST_FUN_OBJ_1(pyb_set_repl_info_obj);
View
@@ -0,0 +1,8 @@
# Nordic files
#####################
drivers/bluetooth/s1*/
# Build files
#####################
build-*/
View
@@ -0,0 +1,294 @@
# Select the board to build for: if not given on the command line,
# then default to pca10040.
BOARD ?= pca10040
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
# If SoftDevice is selected, try to use that one.
SD ?=
SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
# TODO: Verify that it is a valid target.
ifeq ($(SD), )
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
include boards/$(BOARD)/mpconfigboard.mk
else
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)-$(SD_LOWER)
include ../../py/mkenv.mk
include boards/$(BOARD)/mpconfigboard_$(SD_LOWER).mk
include drivers/bluetooth/bluetooth_common.mk
endif
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
FROZEN_MPY_DIR = freeze
# include py core make definitions
include ../../py/py.mk
FATFS_DIR = lib/oofatfs
MPY_CROSS = ../../mpy-cross/mpy-cross
MPY_TOOL = ../../tools/mpy-tool.py
CROSS_COMPILE = arm-none-eabi-
MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]')
INC += -I.
INC += -I../..
INC += -I$(BUILD)
INC += -I./../../lib/cmsis/inc
INC += -I./device
INC += -I./device/$(MCU_VARIANT)
INC += -I./hal
INC += -I./hal/$(MCU_VARIANT)
INC += -I./modules/machine
INC += -I./modules/ubluepy
INC += -I./modules/music
INC += -I./modules/random
INC += -I./modules/ble
INC += -I../../lib/mp-readline
INC += -I./drivers/bluetooth
INC += -I./drivers
NRF_DEFINES += -D$(MCU_VARIANT_UPPER)
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
CFLAGS_CORTEX_M = -mthumb -mabi=aapcs -fsingle-precision-constant -Wdouble-promotion
CFLAGS_MCU_m4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M) --short-enums -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=soft -fno-builtin
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
CFLAGS += $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD)
CFLAGS += -fno-strict-aliasing
CFLAGS += -fstack-usage
CFLAGS += -fdata-sections -ffunction-sections
CFLAGS += -Iboards/$(BOARD)
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
LDFLAGS = $(CFLAGS)
LDFLAGS += -Xlinker -Map=$(@:.elf=.map)
LDFLAGS += -mthumb -mabi=aapcs -T $(LD_FILE) -L boards/
LDFLAGS += -Wl,--gc-sections
#Debugging/Optimization
ifeq ($(DEBUG), 1)
#ASMFLAGS += -g -gtabs+
CFLAGS += -O0 -ggdb
LDFLAGS += -O0
else
CFLAGS += -Os -DNDEBUG
LDFLAGS += -Os
endif
LIBS = \
ifeq ($(MCU_VARIANT), nrf52)
LIBM_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libm.a)
LIBC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libc.a)
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
LIBS += -L $(dir $(LIBM_FILE_NAME)) -lm
LIBS += -L $(dir $(LIBC_FILE_NAME)) -lc
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
endif
SRC_LIB = $(addprefix lib/,\
libc/string0.c \
mp-readline/readline.c \
utils/pyexec.c \
timeutils/timeutils.c \
oofatfs/ff.c \
oofatfs/option/unicode.c \
)
SRC_HAL = $(addprefix hal/,\
hal_uart.c \
hal_uarte.c \
hal_spi.c \
hal_spie.c \
hal_time.c \
hal_rtc.c \
hal_timer.c \
hal_twi.c \
hal_adc.c \
hal_adce.c \
hal_temp.c \
hal_gpio.c \
hal_rng.c \
)
ifeq ($(MCU_VARIANT), nrf52)
SRC_HAL += $(addprefix hal/,\
hal_pwm.c \
)
endif
SRC_C += \
main.c \
mphalport.c \
help.c \
gccollect.c \
pin_named_pins.c \
fatfs_port.c \
drivers/softpwm.c \
drivers/ticker.c \
drivers/bluetooth/ble_drv.c \
drivers/bluetooth/ble_uart.c \
DRIVERS_SRC_C += $(addprefix modules/,\
machine/modmachine.c \
machine/uart.c \
machine/spi.c \
machine/i2c.c \
machine/adc.c \
machine/pin.c \
machine/timer.c \
machine/rtc.c \
machine/pwm.c \
machine/led.c \
machine/temp.c \
uos/moduos.c \
utime/modutime.c \
pyb/modpyb.c \
ubluepy/modubluepy.c \
ubluepy/ubluepy_peripheral.c \
ubluepy/ubluepy_service.c \
ubluepy/ubluepy_characteristic.c \
ubluepy/ubluepy_uuid.c \
ubluepy/ubluepy_delegate.c \
ubluepy/ubluepy_constants.c \
ubluepy/ubluepy_descriptor.c \
ubluepy/ubluepy_scanner.c \
ubluepy/ubluepy_scan_entry.c \
music/modmusic.c \
music/musictunes.c \
ble/modble.c \
random/modrandom.c \
)
SRC_C += \
device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
OBJ += $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
OBJ += $(BUILD)/pins_gen.o
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
.phony: all flash sd binary hex
all: binary hex
OUTPUT_FILENAME = firmware
## Create binary .bin file from the .out file
binary: $(BUILD)/$(OUTPUT_FILENAME).bin
$(BUILD)/$(OUTPUT_FILENAME).bin: $(BUILD)/$(OUTPUT_FILENAME).elf
$(OBJCOPY) -O binary $< $@
## Create binary .hex file from the .out file
hex: $(BUILD)/$(OUTPUT_FILENAME).hex
$(BUILD)/$(OUTPUT_FILENAME).hex: $(BUILD)/$(OUTPUT_FILENAME).elf
$(OBJCOPY) -O ihex $< $@
FLASHER ?=
ifeq ($(FLASHER),)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
nrfjprog --reset -f $(MCU_VARIANT)
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
nrfjprog --eraseall -f $(MCU_VARIANT)
nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT)
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
nrfjprog --reset -f $(MCU_VARIANT)
else ifeq ($(FLASHER), pyocd)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
pyocd-flashtool -t $(MCU_VARIANT) $<
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
pyocd-flashtool -t $(MCU_VARIANT) $<
endif
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
$(ECHO) "LINK $@"
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(Q)$(SIZE) $@
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_MOD) $(SRC_LIB) $(DRIVERS_SRC_C)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=
# Making OBJ use an order-only depenedency on the generated pins.h file
# has the side effect of making the pins.h file before we actually compile
# any of the objects. The normal dependency generation will deal with the
# case when pins.h is modified. But when it doesn't exist, we don't know
# which source files might need it.
$(OBJ): | $(HEADER_BUILD)/pins.h
# Use a pattern rule here so that make will only call make-pins.py once to make
# both pins_$(BOARD).c and pins.h
$(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)
$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
$(call compile_c)
MAKE_PINS = boards/make-pins.py
BOARD_PINS = boards/$(BOARD)/pins.csv
AF_FILE = $(MCU_VARIANT)_af.csv
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
GEN_PINS_SRC = $(BUILD)/pins_gen.c
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
ifneq ($(FROZEN_DIR),)
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
endif
ifneq ($(FROZEN_MPY_DIR),)
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
endif
include ../../py/mkrules.mk
Oops, something went wrong.

0 comments on commit 1988c23

Please sign in to comment.