add boards.c , remove msc_uf2.h lots of clean up and refactor

This commit is contained in:
hathach
2018-08-14 15:56:24 +07:00
parent e4716816c2
commit 85ad6e6b65
13 changed files with 233 additions and 216 deletions

View File

@ -34,7 +34,8 @@
*/
/**************************************************************************/
#include "msc_uf2.h"
#include "tusb.h"
#include "uf2/uf2.h"
#if CFG_TUD_MSC

View File

@ -1,65 +0,0 @@
/**************************************************************************/
/*!
@file msc_uf2.h
@author hathach (tinyusb.org)
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2018, Adafruit Industries (adafruit.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#ifndef MSC_FLASH_H_
#define MSC_FLASH_H_
#include "tusb.h"
#ifdef __cplusplus
extern "C" {
#endif
// for checking flash size
#include "dfu_types.h"
#include "uf2/uf2.h"
/*------------------------------------------------------------------*/
/* FLASH Configuration
*------------------------------------------------------------------*/
#define MSC_UF2_FLASH_ADDR_START 0xAD000
#define MSC_UF2_FLASH_SIZE (256*1024)
#define MSC_UF2_BLOCK_SIZE 512
#define MSC_UF2_BLOCK_NUM UF2_NUM_BLOCKS
TU_VERIFY_STATIC( MSC_UF2_FLASH_ADDR_START+MSC_UF2_FLASH_SIZE == BOOTLOADER_REGION_START-DFU_APP_DATA_RESERVED, );
#ifdef __cplusplus
}
#endif
#endif /* MSC_FLASH_H_ */

View File

@ -114,7 +114,7 @@
#define CFG_TUD_MSC_VENDOR "Adafruit"
// Product name included in Inquiry response, max 16 bytes
#define CFG_TUD_MSC_PRODUCT "Feather52840"
#define CFG_TUD_MSC_PRODUCT "Feather nRF52840"
// Product revision string included in Inquiry response, max 4 bytes
#define CFG_TUD_MSC_PRODUCT_REV "1.0"

View File

@ -1,5 +1,5 @@
#define UF2_VERSION "1.00"
#define PRODUCT_NAME "Adafruit Bluefruit nRF52840"
#define PRODUCT_NAME "Adafruit " DIS_MODEL
#define BOARD_ID "NRF52-Bluefruit-v0"
#define INDEX_URL "https://www.adafruit.com/product/0000"
#define BOOTLOADER_ID MK_DIS_FIRMWARE
@ -8,7 +8,7 @@
#define VOLUME_LABEL "NRF52BOOT "
#define FLASH_SIZE (USER_FLASH_END-USER_FLASH_START) // Max flash size
// Only allow to write application
// Only allow to write application TODO dynamic depending on SD size
#define USER_FLASH_START 0x26000
#define USER_FLASH_END 0xAD000 // Fat Fs start here