added board.mk for all boards

This commit is contained in:
hathach 2019-11-12 00:32:47 +07:00
parent 254ed6253e
commit 7cd90551c9
16 changed files with 99 additions and 36 deletions

View File

@ -85,14 +85,25 @@ ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
$(error Invalid BOARD specified)
endif
# Build directory
BUILD = _build-$(BOARD)
ifneq ($(IS_52832),)
# 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
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) ) )

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1,2 @@
# nrf52 is nrf52832
MCU_SUB_VARIANT = nrf52

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View File

@ -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

View File

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52833