The Mikroe STM32 F4 board now uses /dev/config for configuration data storage. From Ken Pettit

This commit is contained in:
Gregory Nutt
2013-11-01 07:50:35 -06:00
parent f1cb42dab4
commit ac5d6162e4
2 changed files with 62 additions and 25 deletions
+18 -2
View File
@@ -31,12 +31,28 @@ config MIKROE_FLASH_PART
---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"
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"
+24 -3
View File
@@ -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);
#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 */
@@ -267,6 +288,7 @@ int nsh_archinitialize(void)
#endif /* CONFIG_MIKROE_FLASH_PART */
}
}
/* Create a RAM MTD device if configured */
@@ -308,7 +330,6 @@ int nsh_archinitialize(void)
else
{
message("nsh_archinitialize: Successfully bound SPI to the MMC/SD driver\n");
}
#endif