浏览代码

add uf2 target for uf2 bootloader board: metro m0/m4 feather nrf52840

hathach 6 年之前
父节点
当前提交
6861b670fc
共有 6 个文件被更改,包括 54 次插入1 次删除
  1. 3 0
      .gitmodules
  2. 1 0
      examples/make.mk
  3. 7 0
      examples/rules.mk
  4. 4 1
      hw/bsp/feather_nrf52840_express/board.mk
  5. 38 0
      hw/bsp/feather_nrf52840_express/nrf52840_s140_v6.ld
  6. 1 0
      tools/uf2

+ 3 - 0
.gitmodules

@@ -13,3 +13,6 @@
 [submodule "hw/mcu/nxp/lpcopen"]
 	path = hw/mcu/nxp/lpcopen
 	url = https://github.com/hathach/lpcopen.git
+[submodule "tools/uf2"]
+	path = tools/uf2
+	url = https://github.com/microsoft/uf2.git

+ 1 - 0
examples/make.mk

@@ -12,6 +12,7 @@ MKDIR = mkdir
 SED = sed
 CP = cp
 RM = rm
+PYTHON ?= python
 
 # Select the board to build for.
 ifeq ($(BOARD),)

+ 7 - 0
examples/rules.mk

@@ -43,6 +43,8 @@ endif
 .DEFAULT_GOAL := all
 all: $(BUILD)/$(BOARD)-firmware.bin size
 
+uf2: $(BUILD)/$(BOARD)-firmware.uf2
+
 OBJ_DIRS = $(sort $(dir $(OBJ)))
 $(OBJ): | $(OBJ_DIRS)
 $(OBJ_DIRS):
@@ -60,6 +62,11 @@ $(BUILD)/$(BOARD)-firmware.hex: $(BUILD)/$(BOARD)-firmware.elf
 	@echo CREATE $@
 	@$(OBJCOPY) -O ihex $^ $@
 
+UF2_FAMILY ?= 0x00
+$(BUILD)/$(BOARD)-firmware.uf2: $(BUILD)/$(BOARD)-firmware.hex
+	@echo CREATE $@
+	$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY) -c -o $@ $^
+
 # We set vpath to point to the top of the tree so that the source files
 # can be located. By following this scheme, it allows a single build rule
 # to be used to compile all .c files.

+ 4 - 1
hw/bsp/feather_nrf52840_express/board.mk

@@ -12,7 +12,7 @@ CFLAGS += \
 CFLAGS += -Wno-error=undef 
 
 # All source paths should be relative to the top level.
-LD_FILE = hw/mcu/nordic/nrfx/mdk/nrf52840_xxaa.ld
+LD_FILE = hw/bsp/feather_nrf52840_express/nrf52840_s140_v6.ld
 
 LDFLAGS += -L$(TOP)/hw/mcu/nordic/nrfx/mdk
 
@@ -47,5 +47,8 @@ FREERTOS_PORT = ARM_CM4F
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_IF = swd
 
+# For uf2 conversion
+UF2_FAMILY = 0xADA52840
+
 # flash using jlink
 flash: flash-jlink

+ 38 - 0
hw/bsp/feather_nrf52840_express/nrf52840_s140_v6.ld

@@ -0,0 +1,38 @@
+/* Linker script to configure memory regions. */
+
+SEARCH_DIR(.)
+GROUP(-lgcc -lc -lnosys)
+
+MEMORY
+{
+  FLASH (rx)     : ORIGIN = 0x26000, LENGTH = 0xED000 - 0x26000
+
+  /* SRAM required by S132 depend on
+   * - Attribute Table Size
+   * - Vendor UUID count
+   * - Max ATT MTU
+   * - Concurrent connection peripheral + central + secure links
+   * - Event Len, HVN queue, Write CMD queue
+   */ 
+  RAM (rwx) :  ORIGIN = 0x20003400, LENGTH = 0x20040000 - 0x20003400
+}
+
+SECTIONS
+{
+  . = ALIGN(4);
+  .svc_data :
+  {
+    PROVIDE(__start_svc_data = .);
+    KEEP(*(.svc_data))
+    PROVIDE(__stop_svc_data = .);
+  } > RAM
+  
+  .fs_data :
+  {
+    PROVIDE(__start_fs_data = .);
+    KEEP(*(.fs_data))
+    PROVIDE(__stop_fs_data = .);
+  } > RAM
+} INSERT AFTER .data;
+
+INCLUDE "nrf52_common.ld"

+ 1 - 0
tools/uf2

@@ -0,0 +1 @@
+Subproject commit 19615407727073e36d81bf239c52108ba92e7660