From 7cd90551c9567604805965b9cc027de0e2861a18 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 12 Nov 2019 00:32:47 +0700 Subject: [PATCH] added board.mk for all boards --- Makefile | 59 +++++++----------- src/boards/arduino_nano_33_ble/board.mk | 1 + .../circuitplayground_nrf52840/board.mk | 1 + src/boards/electronut_labs_papyr/board.mk | 1 + src/boards/feather_nrf52832/board.mk | 2 + src/boards/feather_nrf52840_express/board.mk | 1 + .../itsybitsy_nrf52840_express/board.mk | 1 + src/boards/mdk_nrf52840_dongle/board.mk | 1 + src/boards/metro_nrf52840_express/board.mk | 1 + src/boards/particle_argon/board.mk | 1 + src/boards/particle_boron/board.mk | 1 + src/boards/particle_xenon/board.mk | 1 + src/boards/pca10056/board.mk | 1 + src/boards/pca10059/board.mk | 1 + src/boards/pca10100/board.h | 61 +++++++++++++++++++ src/boards/pca10100/board.mk | 1 + 16 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 src/boards/arduino_nano_33_ble/board.mk create mode 100644 src/boards/circuitplayground_nrf52840/board.mk create mode 100644 src/boards/electronut_labs_papyr/board.mk create mode 100644 src/boards/feather_nrf52832/board.mk create mode 100644 src/boards/feather_nrf52840_express/board.mk create mode 100644 src/boards/itsybitsy_nrf52840_express/board.mk create mode 100644 src/boards/mdk_nrf52840_dongle/board.mk create mode 100644 src/boards/metro_nrf52840_express/board.mk create mode 100644 src/boards/particle_argon/board.mk create mode 100644 src/boards/particle_boron/board.mk create mode 100644 src/boards/particle_xenon/board.mk create mode 100644 src/boards/pca10056/board.mk create mode 100644 src/boards/pca10059/board.mk create mode 100644 src/boards/pca10100/board.h create mode 100644 src/boards/pca10100/board.mk diff --git a/Makefile b/Makefile index a979bfb..15ade33 100644 --- a/Makefile +++ b/Makefile @@ -85,14 +85,25 @@ ifeq ($(filter $(BOARD),$(BOARD_LIST)),) $(error Invalid BOARD specified) endif +# Build directory BUILD = _build-$(BOARD) -ifneq ($(IS_52832),) -SD_NAME = s132 -DFU_DEV_REV = 0xADAF +# Board specific +-include src/boards/$(BOARD)/board.mk + +# MCU_SUB_VARIANT can be nrf52 (nrf52832), nrf52833, nrf52840 +ifeq ($(MCU_SUB_VARIANT),nrf52) + SD_NAME = s132 + DFU_DEV_REV = 0xADAF + MCU_FLAGS = -DNRF52 -DNRF52832_XXAA -DS132 +else ifeq ($(MCU_SUB_VARIANT),nrf52833) + SD_NAME = s140 + DFU_DEV_REV = 52840 + MCU_FLAGS = -DNRF52833_XXAA -DS140 else -SD_NAME = s140 -DFU_DEV_REV = 52840 + SD_NAME = s140 + DFU_DEV_REV = 52840 + MCU_FLAGS = -DNRF52840_XXAA -DS140 endif #****************************************************************************** @@ -109,6 +120,7 @@ C_SOURCE_FILES += $(SRC_PATH)/dfu_init.c # nrfx C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_power.c C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_nvmc.c +C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_$(MCU_SUB_VARIANT).c # SDK 11 files C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader.c @@ -134,10 +146,8 @@ C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_slip.c C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_transport.c C_SOURCE_FILES += $(SDK_PATH)/libraries/util/nrf_assert.c -ifneq ($(IS_52832),) - -C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_nrf52.c - +# UART or USB Serial +ifeq ($(MCU_SUB_VARIANT),nrf52) C_SOURCE_FILES += $(SDK_PATH)/libraries/uart/app_uart.c C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c @@ -147,17 +157,13 @@ IPATH += $(SDK_PATH)/drivers_nrf/common IPATH += $(SDK_PATH)/drivers_nrf/uart else - # src C_SOURCE_FILES += $(SRC_PATH)/usb/usb_desc.c C_SOURCE_FILES += $(SRC_PATH)/usb/usb.c C_SOURCE_FILES += $(SRC_PATH)/usb/msc_uf2.c C_SOURCE_FILES += $(SRC_PATH)/usb/uf2/ghostfat.c -# nrfx -C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_nrf52840.c - -# Tinyusb stack +# TinyUSB stack C_SOURCE_FILES += $(TUSB_PATH)/portable/nordic/nrf5x/dcd_nrf5x.c C_SOURCE_FILES += $(TUSB_PATH)/common/tusb_fifo.c C_SOURCE_FILES += $(TUSB_PATH)/device/usbd.c @@ -172,11 +178,7 @@ endif #****************************************************************************** # Assembly Files #****************************************************************************** -ifneq ($(IS_52832),) -ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_nrf52.S -else -ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_nrf52840.S -endif +ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_$(MCU_SUB_VARIANT).S #****************************************************************************** # INCLUDE PATH @@ -244,6 +246,7 @@ CFLAGS += -DSWI_DISABLE0 CFLAGS += -DSOFTDEVICE_PRESENT CFLAGS += -DFLOAT_ABI_HARD CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096 +CFLAGS += $(MCU_FLAGS) CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION)"' CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION) $(SD_NAME) $(SD_VERSION)"' @@ -251,15 +254,6 @@ CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION) $(SD_NAME) $(SD_VERSION)"' _VER = $(subst ., ,$(word 1, $(subst -, ,$(GIT_VERSION)))) CFLAGS += -DMK_BOOTLOADER_VERSION='($(word 1,$(_VER)) << 16) + ($(word 2,$(_VER)) << 8) + $(word 3,$(_VER))' -ifneq ($(IS_52832),) -CFLAGS += -DNRF52 -CFLAGS += -DNRF52832_XXAA -CFLAGS += -DS132 -else -CFLAGS += -DNRF52840_XXAA -CFLAGS += -DS140 -endif - #****************************************************************************** # Linker Flags @@ -288,14 +282,7 @@ ASMFLAGS += -DBLE_STACK_SUPPORT_REQD ASMFLAGS += -DSWI_DISABLE0 ASMFLAGS += -DSOFTDEVICE_PRESENT ASMFLAGS += -DFLOAT_ABI_HARD - -ifneq ($(IS_52832),) -ASMFLAGS += -DNRF52 -ASMFLAGS += -DS132 -else -ASMFLAGS += -DNRF52840_XXAA -ASMFLAGS += -DS140 -endif +ASMFLAGS += $(MCU_FLAGS) C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES)) C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) ) diff --git a/src/boards/arduino_nano_33_ble/board.mk b/src/boards/arduino_nano_33_ble/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/arduino_nano_33_ble/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/circuitplayground_nrf52840/board.mk b/src/boards/circuitplayground_nrf52840/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/circuitplayground_nrf52840/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/electronut_labs_papyr/board.mk b/src/boards/electronut_labs_papyr/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/electronut_labs_papyr/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/feather_nrf52832/board.mk b/src/boards/feather_nrf52832/board.mk new file mode 100644 index 0000000..f932bb8 --- /dev/null +++ b/src/boards/feather_nrf52832/board.mk @@ -0,0 +1,2 @@ +# nrf52 is nrf52832 +MCU_SUB_VARIANT = nrf52 diff --git a/src/boards/feather_nrf52840_express/board.mk b/src/boards/feather_nrf52840_express/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/feather_nrf52840_express/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/itsybitsy_nrf52840_express/board.mk b/src/boards/itsybitsy_nrf52840_express/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/itsybitsy_nrf52840_express/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/mdk_nrf52840_dongle/board.mk b/src/boards/mdk_nrf52840_dongle/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/mdk_nrf52840_dongle/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/metro_nrf52840_express/board.mk b/src/boards/metro_nrf52840_express/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/metro_nrf52840_express/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/particle_argon/board.mk b/src/boards/particle_argon/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/particle_argon/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/particle_boron/board.mk b/src/boards/particle_boron/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/particle_boron/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/particle_xenon/board.mk b/src/boards/particle_xenon/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/particle_xenon/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/pca10056/board.mk b/src/boards/pca10056/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/pca10056/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/pca10059/board.mk b/src/boards/pca10059/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/pca10059/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/pca10100/board.h b/src/boards/pca10100/board.h new file mode 100644 index 0000000..cd1e9d5 --- /dev/null +++ b/src/boards/pca10100/board.h @@ -0,0 +1,61 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2018 Ha Thach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef PCA10100_H +#define PCA10100_H + +/*------------------------------------------------------------------*/ +/* LED + *------------------------------------------------------------------*/ +#define LEDS_NUMBER 2 +#define LED_PRIMARY_PIN 13 +#define LED_SECONDARY_PIN 14 +#define LED_STATE_ON 0 + +/*------------------------------------------------------------------*/ +/* BUTTON + *------------------------------------------------------------------*/ +#define BUTTONS_NUMBER 2 +#define BUTTON_1 11 +#define BUTTON_2 12 +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +/*------------------------------------------------------------------*/ +/* UART + *------------------------------------------------------------------*/ +#define RX_PIN_NUMBER 8 +#define TX_PIN_NUMBER 6 +#define CTS_PIN_NUMBER 0 +#define RTS_PIN_NUMBER 0 +#define HWFC false + +// Used as model string in OTA mode +#define BLEDIS_MANUFACTURER "Nordic" +#define BLEDIS_MODEL "PCA10100" + +#define UF2_PRODUCT_NAME "Nordic nRF52833 DK" +#define UF2_BOARD_ID "nRF52833-pca10100-v1" +#define UF2_INDEX_URL "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK" + +#endif // PCA10100_H diff --git a/src/boards/pca10100/board.mk b/src/boards/pca10100/board.mk new file mode 100644 index 0000000..d60ac48 --- /dev/null +++ b/src/boards/pca10100/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52833