Rearchitecting of some MTD, partition, SMART interfaces, and FLASH drivers to: Better use the byte write capbility when available and to use smaller erase sectors for the erase sector size when available).
This commit is contained in:
parent
d9f4d2e054
commit
5de300ffc2
@ -5,53 +5,94 @@
|
||||
|
||||
if ARCH_BOARD_MIKROE_STM32F4
|
||||
|
||||
config PM_BUTTONS
|
||||
bool "PM Button support"
|
||||
config MIKROE_FLASH
|
||||
bool "MTD driver for onboard 1M FLASH"
|
||||
default n
|
||||
depends on PM && ARCH_IRQBUTTONS
|
||||
select MTD
|
||||
select MTD_M25P
|
||||
select MTD_SMART
|
||||
select FS_SMARTFS
|
||||
select STM32_SPI3
|
||||
select MTD_BYTE_WRITE
|
||||
---help---
|
||||
Enable PM button EXTI interrupts to support PM testing
|
||||
Configures an MTD device for use with the onboard flash
|
||||
|
||||
config PM_BUTTON_ACTIVITY
|
||||
int "Button PM activity weight"
|
||||
default 10
|
||||
depends on PM_BUTTONS
|
||||
config MIKROE_FLASH_MINOR
|
||||
int "Minor number for the FLASH /dev/smart entry"
|
||||
default 0
|
||||
depends on MIKROE_FLASH
|
||||
---help---
|
||||
The activity weight to report to the power management subsystem when a button is pressed.
|
||||
Sets the minor number for the FLASH MTD /dev entry
|
||||
|
||||
config MIKROE_FLASH_PART
|
||||
bool "Enable partition support on FLASH"
|
||||
default n
|
||||
depends on MIKROE_FLASH
|
||||
---help---
|
||||
Enables creation of partitions on the FLASH
|
||||
|
||||
config MIKROE_FLASH_PART_LIST
|
||||
string "Flash partition size list"
|
||||
default "256,768"
|
||||
depends on MIKROE_FLASH_PART
|
||||
---help---
|
||||
Comma separated list of partition sizes in KB
|
||||
|
||||
config MIKROE_RAMMTD
|
||||
bool "MTD driver for SMARTFS RAM disk"
|
||||
default n
|
||||
select MTD
|
||||
select RAMMTD
|
||||
---help---
|
||||
Configures an MTD based RAM device for use with SMARTFS.
|
||||
|
||||
config MIKROE_RAMMTD_MINOR
|
||||
int "Minor number for RAM /dev/smart entry"
|
||||
default 1
|
||||
depends on MIKROE_RAMMTD
|
||||
---help---
|
||||
Sets the minor number for the RAM MTD /dev entry
|
||||
|
||||
config MIKROE_RAMMTD_SIZE
|
||||
int "Size in KB of the RAM device to create"
|
||||
default 32
|
||||
depends on MIKROE_RAMMTD
|
||||
---help---
|
||||
Sets the size of static RAM allocation for the SMART RAM device
|
||||
|
||||
config PM_ALARM_SEC
|
||||
int "PM_STANDBY delay (seconds)"
|
||||
default 15
|
||||
depends on PM && RTC_ALARM
|
||||
--help---
|
||||
---help---
|
||||
Number of seconds to wait in PM_STANDBY before going to PM_STANDBY mode.
|
||||
|
||||
config PM_ALARM_NSEC
|
||||
int "PM_STANDBY delay (nanoseconds)"
|
||||
default 0
|
||||
depends on PM && RTC_ALARM
|
||||
--help---
|
||||
---help---
|
||||
Number of additional nanoseconds to wait in PM_STANDBY before going to PM_STANDBY mode.
|
||||
|
||||
config PM_SLEEP_WAKEUP
|
||||
bool "PM_SLEEP wake-up alarm"
|
||||
default n
|
||||
depends on PM && RTC_ALARM
|
||||
--help---
|
||||
---help---
|
||||
Wake-up of PM_SLEEP mode after a delay and resume normal operation.
|
||||
|
||||
config PM_SLEEP_WAKEUP_SEC
|
||||
int "PM_SLEEP delay (seconds)"
|
||||
default 10
|
||||
depends on PM && RTC_ALARM
|
||||
--help---
|
||||
---help---
|
||||
Number of seconds to wait in PM_SLEEP before going to PM_STANDBY mode.
|
||||
|
||||
config PM_SLEEP_WAKEUP_NSEC
|
||||
int "PM_SLEEP delay (nanoseconds)"
|
||||
default 0
|
||||
depends on PM && RTC_ALARM
|
||||
--help---
|
||||
---help---
|
||||
Number of additional nanoseconds to wait in PM_SLEEP before going to PM_STANDBY mode.
|
||||
|
||||
endif
|
||||
|
@ -2,7 +2,20 @@ README
|
||||
======
|
||||
|
||||
This README discusses issues unique to NuttX configurations for the
|
||||
MikroElektronika Mikromedia for STM32F4 development board.
|
||||
MikroElektronika Mikromedia for STM32F4 development board. This is
|
||||
another board support by NuttX that uses the same STM32F407VGT6 MCU
|
||||
as does the STM32F4-Discovery board. This board, however, has very
|
||||
different on-board peripherals than does the STM32F4-Discovery:
|
||||
|
||||
- TFT display with touch panel,
|
||||
- VS1053 stereo audio codec with headphone jack,
|
||||
- SD card slot,
|
||||
- Serial FLASH memory,
|
||||
- USB OTG FS with micro-AB connector, and
|
||||
- Battery connect and batter charger circuit.
|
||||
|
||||
See the http://www.mikroe.com/mikromedia/stm32-m4/ for more information
|
||||
about this board.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
@ -128,9 +128,14 @@
|
||||
# define CONFIG_EXAMPLES_SMART_NEBLOCKS (22)
|
||||
# endif
|
||||
|
||||
# undef CONFIG_EXAMPLES_SMART_BUFSIZE
|
||||
# define CONFIG_EXAMPLES_SMART_BUFSIZE \
|
||||
(CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS)
|
||||
#ifdef CONFIG_MIKROE_RAMMTD
|
||||
# ifndef CONFIG_MIKROE_RAMMTD_MINOR
|
||||
# define CONFIG_MIKROE_RAMMTD_MINOR 1
|
||||
# endif
|
||||
# ifndef CONFIG_MIKROE_RAMMTD_SIZE
|
||||
# define CONFIG_MIKROE_RAMMTD_SIZE 32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
@ -151,11 +156,6 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
/* Pre-allocated simulated flash */
|
||||
|
||||
#ifdef CONFIG_RAMMTD
|
||||
//static uint8_t g_simflash[CONFIG_EXAMPLES_SMART_BUFSIZE];
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -197,7 +197,7 @@ int nsh_archinitialize(void)
|
||||
|
||||
/* Now bind the SPI interface to the M25P8 SPI FLASH driver */
|
||||
|
||||
#ifdef CONFIG_MTD
|
||||
#if defined(CONFIG_MTD) && defined(CONFIG_MIKROE_FLASH)
|
||||
message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
|
||||
mtd = m25p_initialize(spi);
|
||||
if (!mtd)
|
||||
@ -208,28 +208,78 @@ int nsh_archinitialize(void)
|
||||
{
|
||||
message("nsh_archinitialize: Successfully bound SPI port 3 to the SPI FLASH driver\n");
|
||||
|
||||
#ifdef CONFIG_MIKROE_FLASH_PART
|
||||
{
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
const char *partstring = CONFIG_MIKROE_FLASH_PART_LIST;
|
||||
const char *ptr;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partname[4];
|
||||
|
||||
/* Now create a partition on the FLASH device */
|
||||
|
||||
partno = 0;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
||||
partsize = atoi(ptr);
|
||||
mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16);
|
||||
partoffset += (partsize >> 2) * 16;
|
||||
|
||||
/* Now initialize a SMART Flash block device and bind it to the MTD device */
|
||||
|
||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||
smart_initialize(0, mtd);
|
||||
sprintf(partname, "p%d", partno);
|
||||
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, partname);
|
||||
#endif
|
||||
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Increment the part number */
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_MIKROE_FLASH_PART */
|
||||
|
||||
/* Configure the device with no partition support */
|
||||
|
||||
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd, NULL);
|
||||
|
||||
#endif /* CONFIG_MIKROE_FLASH_PART */
|
||||
}
|
||||
|
||||
/* Create a RAM MTD device if configured */
|
||||
|
||||
#ifdef CONFIG_RAMMTD
|
||||
#if defined(CONFIG_RAMMTD) && defined(CONFIG_MIKROE_RAMMTD)
|
||||
{
|
||||
uint8_t *start = (uint8_t *) kmalloc(CONFIG_EXAMPLES_SMART_BUFSIZE);
|
||||
mtd = rammtd_initialize(start, CONFIG_EXAMPLES_SMART_BUFSIZE);
|
||||
uint8_t *start = (uint8_t *) kmalloc(CONFIG_MIKROE_RAMMTD_SIZE * 1024);
|
||||
mtd = rammtd_initialize(start, CONFIG_MIKROE_RAMMTD_SIZE * 1024);
|
||||
mtd->ioctl(mtd, MTDIOC_BULKERASE, 0);
|
||||
|
||||
/* Now initialize a SMART Flash block device and bind it to the MTD device */
|
||||
|
||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||
smart_initialize(1, mtd);
|
||||
smart_initialize(CONFIG_MIKROE_RAMMTD_MINOR, mtd, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RAMMTD */
|
||||
#endif /* CONFIG_RAMMTD && CONFIG_MIKROE_RAMMTD */
|
||||
|
||||
#endif /* CONFIG_MTD */
|
||||
#endif /* CONFIG_STM32_SPI3 */
|
||||
|
@ -16,7 +16,7 @@ CONFIG_HOST_LINUX=y
|
||||
#
|
||||
# Build Configuration
|
||||
#
|
||||
# CONFIG_APPS_DIR="../apps"
|
||||
CONFIG_APPS_DIR="../apps"
|
||||
# CONFIG_BUILD_2PASS is not set
|
||||
|
||||
#
|
||||
@ -38,27 +38,8 @@ CONFIG_RAW_BINARY=y
|
||||
#
|
||||
# Debug Options
|
||||
#
|
||||
CONFIG_DEBUG=y
|
||||
# CONFIG_DEBUG_VERBOSE is not set
|
||||
|
||||
#
|
||||
# Subsystem Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG_MM is not set
|
||||
# CONFIG_DEBUG_SCHED is not set
|
||||
# CONFIG_DEBUG_USB is not set
|
||||
CONFIG_DEBUG_FS=y
|
||||
# CONFIG_DEBUG_LIB is not set
|
||||
# CONFIG_DEBUG_BINFMT is not set
|
||||
# CONFIG_DEBUG_GRAPHICS is not set
|
||||
|
||||
#
|
||||
# Driver Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG_ANALOG is not set
|
||||
# CONFIG_DEBUG_SPI is not set
|
||||
# CONFIG_DEBUG_GPIO is not set
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
# CONFIG_DEBUG is not set
|
||||
# CONFIG_DEBUG_SYMBOLS is not set
|
||||
|
||||
#
|
||||
# System Type
|
||||
@ -104,7 +85,6 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
CONFIG_ARCH_HAVE_MPU=y
|
||||
# CONFIG_ARMV7M_MPU is not set
|
||||
# CONFIG_DEBUG_HARDFAULT is not set
|
||||
|
||||
#
|
||||
# ARMV7M Configuration Options
|
||||
@ -310,6 +290,13 @@ CONFIG_NSH_MMCSDSPIPORTNO=0
|
||||
#
|
||||
# Board-Specific Options
|
||||
#
|
||||
CONFIG_MIKROE_FLASH=y
|
||||
CONFIG_MIKROE_FLASH_MINOR=0
|
||||
CONFIG_MIKROE_FLASH_PART=y
|
||||
CONFIG_MIKROE_FLASH_PART_LIST="256,768"
|
||||
CONFIG_MIKROE_RAMMTD=y
|
||||
CONFIG_MIKROE_RAMMTD_MINOR=1
|
||||
CONFIG_MIKROE_RAMMTD_SIZE=32
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@ -408,21 +395,27 @@ CONFIG_MMCSD_SPI=y
|
||||
CONFIG_MMCSD_SPICLOCK=20000000
|
||||
# CONFIG_MMCSD_SDIO is not set
|
||||
CONFIG_MTD=y
|
||||
# CONFIG_MTD_PARTITION is not set
|
||||
|
||||
#
|
||||
# MTD Configuration
|
||||
#
|
||||
CONFIG_MTD_PARTITION=y
|
||||
CONFIG_MTD_BYTE_WRITE=y
|
||||
|
||||
#
|
||||
# MTD Device Drivers
|
||||
#
|
||||
CONFIG_RAMMTD=y
|
||||
CONFIG_RAMMTD_BLOCKSIZE=512
|
||||
CONFIG_RAMMTD_ERASESIZE=4096
|
||||
CONFIG_RAMMTD_ERASESTATE=0xff
|
||||
# CONFIG_RAMMTD_FLASHSIM is not set
|
||||
CONFIG_RAMMTD_SMART=y
|
||||
# CONFIG_MTD_AT24XX is not set
|
||||
# CONFIG_MTD_AT45DB is not set
|
||||
CONFIG_MTD_M25P=y
|
||||
CONFIG_M25P_SPIMODE=0
|
||||
CONFIG_M25P_MANUFACTURER=0x1C
|
||||
CONFIG_M25P_MEMORY_TYPE=0x31
|
||||
CONFIG_M25P_SUBSECTOR_ERASE=y
|
||||
CONFIG_M25P_BYTEWRITE=y
|
||||
CONFIG_MTD_SMART=y
|
||||
CONFIG_MTD_SMART_SECTOR_SIZE=512
|
||||
# CONFIG_MTD_RAMTRON is not set
|
||||
@ -441,7 +434,6 @@ CONFIG_SERIAL_REMOVABLE=y
|
||||
CONFIG_ARCH_HAVE_USART2=y
|
||||
CONFIG_MCU_SERIAL=y
|
||||
CONFIG_STANDARD_SERIAL=y
|
||||
# CONFIG_SERIAL_TIOCSERGSTRUCT is not set
|
||||
# CONFIG_USART2_SERIAL_CONSOLE is not set
|
||||
CONFIG_NO_SERIAL_CONSOLE=y
|
||||
|
||||
@ -529,7 +521,7 @@ CONFIG_FS_ROMFS=y
|
||||
CONFIG_FS_SMARTFS=y
|
||||
CONFIG_SMARTFS_ERASEDSTATE=0xff
|
||||
CONFIG_SMARTFS_MAXNAMLEN=16
|
||||
CONFIG_SMARTFS_MULTI_ROOT_DIRS=y
|
||||
# CONFIG_SMARTFS_MULTI_ROOT_DIRS is not set
|
||||
# CONFIG_FS_BINFS is not set
|
||||
|
||||
#
|
||||
@ -650,6 +642,7 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_NX is not set
|
||||
# CONFIG_EXAMPLES_NXCONSOLE is not set
|
||||
# CONFIG_EXAMPLES_NXFFS is not set
|
||||
# CONFIG_EXAMPLES_SMART is not set
|
||||
# CONFIG_EXAMPLES_NXFLAT is not set
|
||||
# CONFIG_EXAMPLES_NXHELLO is not set
|
||||
# CONFIG_EXAMPLES_NXIMAGE is not set
|
||||
@ -664,8 +657,8 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_ROMFS is not set
|
||||
# CONFIG_EXAMPLES_SENDMAIL is not set
|
||||
# CONFIG_EXAMPLES_SERLOOP is not set
|
||||
CONFIG_EXAMPLES_FLASH_TEST=y
|
||||
CONFIG_EXAMPLES_SMART_TEST=y
|
||||
# CONFIG_EXAMPLES_FLASH_TEST is not set
|
||||
# CONFIG_EXAMPLES_SMART_TEST is not set
|
||||
# CONFIG_EXAMPLES_TELNETD is not set
|
||||
# CONFIG_EXAMPLES_THTTPD is not set
|
||||
# CONFIG_EXAMPLES_TIFF is not set
|
||||
@ -774,23 +767,13 @@ CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_NESTDEPTH=3
|
||||
# CONFIG_NSH_DISABLESCRIPT is not set
|
||||
# CONFIG_NSH_DISABLEBG is not set
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
# CONFIG_NSH_ROMFSRC is not set
|
||||
CONFIG_NSH_ROMFSMOUNTPT="/etc"
|
||||
CONFIG_NSH_INITSCRIPT="init.d/rcS"
|
||||
CONFIG_NSH_ROMFSDEVNO=0
|
||||
CONFIG_NSH_ROMFSSECTSIZE=64
|
||||
CONFIG_NSH_FATDEVNO=0
|
||||
CONFIG_NSH_FATSECTSIZE=512
|
||||
CONFIG_NSH_FATNSECTORS=1024
|
||||
CONFIG_NSH_FATMOUNTPT="/tmp"
|
||||
# CONFIG_NSH_ROMFSETC is not set
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
# CONFIG_NSH_USBCONSOLE is not set
|
||||
|
||||
#
|
||||
# USB Trace Support
|
||||
#
|
||||
# CONFIG_NSH_USBDEV_TRACE is not set
|
||||
# CONFIG_NSH_CONDEV is not set
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
|
||||
|
@ -2,7 +2,20 @@ README
|
||||
======
|
||||
|
||||
This README discusses issues unique to NuttX configurations for the
|
||||
STMicro STM32F4Discovery development board.
|
||||
STMicro STM32F4Discovery development board featuring the STM32F407VGT6
|
||||
MCU. The STM32F407VGT6 is a 168MHz Cortex-M4 operation with 1Mbit Flash
|
||||
memory and 128kbytes. The board features:
|
||||
|
||||
- On-board ST-LINK/V2 for programming and debugging,
|
||||
- LIS302DL, ST MEMS motion sensor, 3-axis digital output accelerometer,
|
||||
- MP45DT02, ST MEMS audio sensor, omni-directional digital microphone,
|
||||
- CS43L22, audio DAC with integrated class D speaker driver,
|
||||
- Eight LEDs and two push-buttons,
|
||||
- USB OTG FS with micro-AB connector, and
|
||||
- Easy access to most MCU pins.
|
||||
|
||||
Refer to http://www.st.com/internet/evalboard/product/252419.jsp for
|
||||
further information about this board.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
Loading…
Reference in New Issue
Block a user