1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

boards/same54-xpro: configure FAT on SD card

This commit is contained in:
Benjamin Valentin 2022-03-20 21:06:13 +01:00
parent babee877ce
commit b97359ea71
6 changed files with 48 additions and 8 deletions

View File

@ -27,5 +27,6 @@ config BOARD_SAME54_XPRO
select HAVE_SAUL_GPIO
select HAVE_MTD_SPI_NOR
select HAVE_AT24MAC
select HAVE_SAM0_SDHC
# This specific board requires SPI_ON_QSPI for the MTD_SPI_NOR
select MODULE_PERIPH_SPI_ON_QSPI if MODULE_MTD_SPI_NOR

View File

@ -10,6 +10,7 @@ ifneq (,$(filter mtd,$(USEMODULE)))
FEATURES_REQUIRED += periph_spi_on_qspi
USEMODULE += mtd_spi_nor
USEMODULE += mtd_at24cxxx at24mac
USEMODULE += sam0_sdhc
endif
# enables sam0_eth as default network device
@ -17,8 +18,9 @@ ifneq (,$(filter netdev_default,$(USEMODULE)))
USEMODULE += sam0_eth
endif
# default to using littlefs2 on the external flash
# default to using littlefs2 on the external flash and fatfs on SD card
ifneq (,$(filter vfs_default,$(USEMODULE)))
USEPKG += littlefs2
USEMODULE += fatfs_vfs
USEMODULE += mtd
endif

View File

@ -20,10 +20,13 @@
#include "board.h"
#include "periph/gpio.h"
#include "mtd_spi_nor.h"
#include "timex.h"
#ifdef MODULE_VFS_DEFAULT
#include "vfs_default.h"
#endif
#ifdef MODULE_MTD
#ifdef MODULE_MTD_SPI_NOR
#include "mtd_spi_nor.h"
/* N25Q256A or SST26VF064B */
static const mtd_spi_nor_params_t _same54_nor_params = {
.opcode = &mtd_spi_nor_opcode_default,
@ -50,6 +53,12 @@ static mtd_spi_nor_t same54_nor_dev = {
};
mtd_dev_t *mtd0 = (mtd_dev_t *)&same54_nor_dev;
#ifdef MODULE_VFS_DEFAULT
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(same54_nor_dev), VFS_DEFAULT_NVM(0), 0);
#endif
#endif /* MODULE_MTD_SPI_NOR */
#ifdef MODULE_MTD_AT24CXXX
#include "mtd_at24cxxx.h"
#include "at24cxxx_params.h"
static at24cxxx_t at24cxxx_dev;
@ -61,9 +70,23 @@ static mtd_at24cxxx_t at24mac_dev = {
.params = at24cxxx_params,
};
mtd_dev_t *mtd1 = (mtd_dev_t *)&at24mac_dev;
#endif /* MODULE_MTD_AT24CXXX */
#ifdef MODULE_SAM0_SDHC
#include "mtd_sam0_sdhc.h"
static mtd_sam0_sdhc_t sdhc_dev = {
.base = {
.driver = &mtd_sam0_sdhc_driver,
},
.state = {
.dev = SDHC1,
.cd = GPIO_PIN(PD, 20),
.wp = GPIO_PIN(PD, 21),
},
};
mtd_dev_t *mtd2 = (mtd_dev_t *)&sdhc_dev;
#ifdef MODULE_VFS_DEFAULT
#include "vfs_default.h"
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(same54_nor_dev), VFS_DEFAULT_NVM(0), 0);
VFS_AUTO_MOUNT(fatfs, VFS_MTD(sdhc_dev), VFS_DEFAULT_SD(0), 1);
#endif
#endif /* MODULE_MTD */
#endif /* MODULE_SAM0_SDHC */

View File

@ -72,10 +72,11 @@ extern "C" {
* @name MTD configuration
* @{
*/
extern mtd_dev_t *mtd0, *mtd1;
extern mtd_dev_t *mtd0, *mtd1, *mtd2;
#define MTD_0 mtd0
#define MTD_1 mtd1
#define MTD_NUMOF 2
#define MTD_2 mtd2
#define MTD_NUMOF 3
/** @} */
/**

View File

@ -360,6 +360,17 @@ static const adc_conf_chan_t adc_channels[] = {
#define DAC_VREF DAC_CTRLB_REFSEL_VREFPU
/** @} */
/**
* @name SDHC configuration
*
* This is entirely optional, but allows us to save a few bytes if only
* a single SDHC instance is used.
* @{
*/
#define SDHC_DEV SDHC1 /**< The SDHC instance to use */
#define SDHC_DEV_ISR isr_sdhc1 /**< Interrupt service routing for SDHC1 */
/** @} */
/**
* @name Ethernet peripheral configuration
* @{

View File

@ -4906,11 +4906,13 @@ boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member LED0_TOGGLE \(macro
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member LED_PORT \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member MTD_0 \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member MTD_1 \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member MTD_2 \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member MTD_NUMOF \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member XTIMER_HZ \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member XTIMER_WIDTH \(macro definition\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member mtd0 \(variable\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member mtd1 \(variable\) of file board\.h is not documented\.
boards/same54\-xpro/include/board\.h:[0-9]+: warning: Member mtd2 \(variable\) of file board\.h is not documented\.
boards/same54\-xpro/include/eui_provider_params\.h:[0-9]+: warning: Member EUI48_PROVIDER_FUNC \(macro definition\) of file eui_provider_params\.h is not documented\.
boards/same54\-xpro/include/eui_provider_params\.h:[0-9]+: warning: Member EUI48_PROVIDER_TYPE \(macro definition\) of file eui_provider_params\.h is not documented\.
boards/same54\-xpro/include/periph_conf\.h:[0-9]+: warning: Member ADC_DEV \(macro definition\) of file periph_conf\.h is not documented\.