mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
The Mikroe STM32 F4 board now uses /dev/config for configuration data storage. From Ken Pettit
This commit is contained in:
@@ -31,12 +31,28 @@ config MIKROE_FLASH_PART
|
|||||||
---help---
|
---help---
|
||||||
Enables creation of partitions on the FLASH
|
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
|
config MIKROE_FLASH_PART_LIST
|
||||||
string "Flash partition size list"
|
string "Flash partition size list"
|
||||||
default "256,768"
|
default "8,248,768"
|
||||||
depends on MIKROE_FLASH_PART
|
depends on MIKROE_FLASH_PART
|
||||||
---help---
|
---help---
|
||||||
Comma separated list of partition sizes in KB
|
Comma separated list of partition sizes in KB.
|
||||||
|
|
||||||
config MIKROE_RAMMTD
|
config MIKROE_RAMMTD
|
||||||
bool "MTD driver for SMARTFS RAM disk"
|
bool "MTD driver for SMARTFS RAM disk"
|
||||||
|
|||||||
@@ -59,6 +59,12 @@
|
|||||||
# include <apps/usbmonitor.h>
|
# include <apps/usbmonitor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART
|
||||||
|
#ifdef CONFIG_PLATFORM_CONFIGDATA
|
||||||
|
# include <nuttx/configdata.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
# include "stm32_usbhost.h"
|
# include "stm32_usbhost.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -227,6 +233,7 @@ int nsh_archinitialize(void)
|
|||||||
partno = 0;
|
partno = 0;
|
||||||
ptr = partstring;
|
ptr = partstring;
|
||||||
partoffset = 0;
|
partoffset = 0;
|
||||||
|
|
||||||
while (*ptr != '\0')
|
while (*ptr != '\0')
|
||||||
{
|
{
|
||||||
/* Get the partition size */
|
/* Get the partition size */
|
||||||
@@ -235,12 +242,27 @@ int nsh_archinitialize(void)
|
|||||||
mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16);
|
mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16);
|
||||||
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)
|
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||||
sprintf(partname, "p%d", partno);
|
sprintf(partname, "p%d", partno);
|
||||||
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, partname);
|
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, partname);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Update the pointer to point to the next size in the list */
|
/* Update the pointer to point to the next size in the list */
|
||||||
|
|
||||||
@@ -258,7 +280,6 @@ int nsh_archinitialize(void)
|
|||||||
|
|
||||||
partno++;
|
partno++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else /* CONFIG_MIKROE_FLASH_PART */
|
#else /* CONFIG_MIKROE_FLASH_PART */
|
||||||
|
|
||||||
/* Configure the device with no partition support */
|
/* Configure the device with no partition support */
|
||||||
@@ -267,6 +288,7 @@ int nsh_archinitialize(void)
|
|||||||
|
|
||||||
#endif /* CONFIG_MIKROE_FLASH_PART */
|
#endif /* CONFIG_MIKROE_FLASH_PART */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a RAM MTD device if configured */
|
/* Create a RAM MTD device if configured */
|
||||||
|
|
||||||
@@ -308,7 +330,6 @@ int nsh_archinitialize(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
message("nsh_archinitialize: Successfully bound SPI to the MMC/SD driver\n");
|
message("nsh_archinitialize: Successfully bound SPI to the MMC/SD driver\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user