The Mikroe STM32 F4 board now uses /dev/config for configuration data storage. From Ken Pettit
This commit is contained in:
parent
b01900d7e6
commit
b102d01046
|
@ -5928,3 +5928,5 @@
|
|||
for an MTD device that can be used to provide a simple, lightweight
|
||||
interface to configation data storage that resides on some storage
|
||||
media that is wrapped as an MTD device. From Ken Pettit (2013-11-1).
|
||||
* configs/mikroe-stm32f4: Now uses /dev/config for configuration data
|
||||
storage. From Ken Pettit (2013-11-1).
|
||||
|
|
|
@ -8,55 +8,71 @@ if ARCH_BOARD_MIKROE_STM32F4
|
|||
config MIKROE_FLASH
|
||||
bool "MTD driver for onboard 1M FLASH"
|
||||
default n
|
||||
select MTD
|
||||
select MTD_M25P
|
||||
select MTD_SMART
|
||||
select FS_SMARTFS
|
||||
select STM32_SPI3
|
||||
select MTD_BYTE_WRITE
|
||||
select MTD
|
||||
select MTD_M25P
|
||||
select MTD_SMART
|
||||
select FS_SMARTFS
|
||||
select STM32_SPI3
|
||||
select MTD_BYTE_WRITE
|
||||
---help---
|
||||
Configures an MTD device for use with the onboard flash
|
||||
|
||||
config MIKROE_FLASH_MINOR
|
||||
int "Minor number for the FLASH /dev/smart entry"
|
||||
default 0
|
||||
depends on MIKROE_FLASH
|
||||
depends on MIKROE_FLASH
|
||||
---help---
|
||||
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
|
||||
depends on MIKROE_FLASH
|
||||
---help---
|
||||
Enables creation of partitions on the FLASH
|
||||
|
||||
config MIKROE_FLASH_CONFIG_PART
|
||||
bool "Create application config data partition on FLASH"
|
||||
default y
|
||||
depends on MIKROE_FLASH_PART
|
||||
depends on PLATFORM_CONFIGDATA
|
||||
---help---
|
||||
Enables creation of a /dev/config partition on the FLASH
|
||||
|
||||
config MIKROE_FLASH_CONFIG_PART_NUMBER
|
||||
int "Index number of config partition (in list below)"
|
||||
default 0
|
||||
depends on MIKROE_FLASH_CONFIG_PART
|
||||
---help---
|
||||
Specifies the index number of the config data partition
|
||||
from the partition list.
|
||||
|
||||
config MIKROE_FLASH_PART_LIST
|
||||
string "Flash partition size list"
|
||||
default "256,768"
|
||||
depends on MIKROE_FLASH_PART
|
||||
default "8,248,768"
|
||||
depends on MIKROE_FLASH_PART
|
||||
---help---
|
||||
Comma separated list of partition sizes in KB
|
||||
Comma separated list of partition sizes in KB.
|
||||
|
||||
config MIKROE_RAMMTD
|
||||
bool "MTD driver for SMARTFS RAM disk"
|
||||
default n
|
||||
select MTD
|
||||
select RAMMTD
|
||||
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
|
||||
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
|
||||
depends on MIKROE_RAMMTD
|
||||
---help---
|
||||
Sets the size of static RAM allocation for the SMART RAM device
|
||||
|
||||
|
|
|
@ -59,6 +59,12 @@
|
|||
# include <apps/usbmonitor.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART
|
||||
#ifdef CONFIG_PLATFORM_CONFIGDATA
|
||||
# include <nuttx/configdata.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
# include "stm32_usbhost.h"
|
||||
#endif
|
||||
|
@ -227,6 +233,7 @@ int nsh_archinitialize(void)
|
|||
partno = 0;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
@ -235,12 +242,27 @@ int nsh_archinitialize(void)
|
|||
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 */
|
||||
#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART
|
||||
/* Test if this is the config partition */
|
||||
|
||||
if (CONFIG_MIKROE_FLASH_CONFIG_PART_NUMBER == partno)
|
||||
{
|
||||
/* Register the partition as the config device */
|
||||
|
||||
mtdconfig_register(mtd_part);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Now initialize a SMART Flash block device and bind it
|
||||
* to the MTD device.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||
sprintf(partname, "p%d", partno);
|
||||
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, partname);
|
||||
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 */
|
||||
|
||||
|
@ -258,7 +280,6 @@ int nsh_archinitialize(void)
|
|||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_MIKROE_FLASH_PART */
|
||||
|
||||
/* Configure the device with no partition support */
|
||||
|
@ -266,20 +287,21 @@ int nsh_archinitialize(void)
|
|||
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd, NULL);
|
||||
|
||||
#endif /* CONFIG_MIKROE_FLASH_PART */
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a RAM MTD device if configured */
|
||||
|
||||
#if defined(CONFIG_RAMMTD) && defined(CONFIG_MIKROE_RAMMTD)
|
||||
{
|
||||
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);
|
||||
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 */
|
||||
/* 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(CONFIG_MIKROE_RAMMTD_MINOR, mtd, NULL);
|
||||
smart_initialize(CONFIG_MIKROE_RAMMTD_MINOR, mtd, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -308,7 +330,6 @@ int nsh_archinitialize(void)
|
|||
else
|
||||
{
|
||||
message("nsh_archinitialize: Successfully bound SPI to the MMC/SD driver\n");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue