[bsp] update stm32f429 bsp

- enable SPI/SPI Flash/SDIO/SDCARD default
- update mount file system code
- enable C99 for MDK4 template
- update all project file
This commit is contained in:
tanek liang 2017-11-28 21:31:55 +08:00
parent 89fd2e9f87
commit f37df10a63
7 changed files with 683 additions and 107 deletions

View File

@ -9,6 +9,9 @@ CONFIG_BOARD_STM32F429_APPOLO=y
#
CONFIG_RT_NAME_MAX=8
CONFIG_RT_ALIGN_SIZE=4
# CONFIG_RT_THREAD_PRIORITY_8 is not set
CONFIG_RT_THREAD_PRIORITY_32=y
# CONFIG_RT_THREAD_PRIORITY_256 is not set
CONFIG_RT_THREAD_PRIORITY_MAX=32
CONFIG_RT_TICK_PER_SECOND=1000
CONFIG_RT_DEBUG=y
@ -34,9 +37,11 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
#
CONFIG_RT_USING_MEMPOOL=y
CONFIG_RT_USING_MEMHEAP=y
CONFIG_RT_USING_HEAP=y
# CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
CONFIG_RT_USING_HEAP=y
#
# Kernel Device Object
@ -80,7 +85,8 @@ CONFIG_FINSH_CMD_SIZE=80
#
CONFIG_RT_USING_DFS=y
CONFIG_DFS_USING_WORKDIR=y
CONFIG_DFS_FILESYSTEMS_MAX=2
CONFIG_DFS_FILESYSTEMS_MAX=4
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
CONFIG_DFS_FD_MAX=4
CONFIG_RT_USING_DFS_ELMFAT=y
@ -96,14 +102,14 @@ CONFIG_RT_DFS_ELM_USE_LFN_0=y
CONFIG_RT_DFS_ELM_USE_LFN=0
CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_USING_DFS_DEVFS=y
CONFIG_RT_USING_DFS_NET=y
CONFIG_HAVE_SYS_SELECT_H=y
# CONFIG_HAVE_SYS_SOCKET_H is not set
# CONFIG_RT_USING_DFS_ROMFS is not set
CONFIG_RT_USING_DFS_ROMFS=y
# CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_NFS is not set
@ -123,8 +129,21 @@ CONFIG_RT_USING_MTD_NAND=y
# CONFIG_RT_MTD_NAND_DEBUG is not set
CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SDIO is not set
# CONFIG_RT_USING_SPI is not set
CONFIG_RT_USING_SPI=y
CONFIG_RT_USING_SFUD=y
CONFIG_RT_SFUD_USING_SFDP=y
# CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE is not set
# CONFIG_RT_SFUD_DEBUG is not set
# CONFIG_RT_USING_W25QXX is not set
# CONFIG_RT_USING_GD is not set
# CONFIG_RT_USING_ENC28J60 is not set
# CONFIG_RT_USING_SPI_WIFI is not set
# CONFIG_RT_USING_WDT is not set
# CONFIG_RT_USING_WIFI is not set
#
# Using USB
#
# CONFIG_RT_USING_USB_HOST is not set
# CONFIG_RT_USING_USB_DEVICE is not set
@ -213,6 +232,7 @@ CONFIG_LWIP_SO_RCVBUF=1
#
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
#
# IoT - internet of things
@ -223,26 +243,23 @@ CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_EZXML is not set
#
# Marvell WiFi
#
# CONFIG_PKG_USING_MARVELLWIFI is not set
# CONFIG_PKG_USING_NANOPB is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
#
# language packages
#
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
#
# multimedia packages
#
# CONFIG_PKG_USING_FASTLZ is not set
#
# tools packages
@ -254,6 +271,12 @@ CONFIG_LWIP_SO_RCVBUF=1
#
# miscellaneous packages
#
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set
CONFIG_RT_USING_EXT_SDRAM=y
CONFIG_RT_USING_UART1=y

View File

@ -26,6 +26,8 @@
/* dfs Filesystem APIs */
#include <dfs_fs.h>
#include <dfs_posix.h>
#include <dfs_romfs.h>
#endif
#ifdef RT_USING_LWIP
@ -44,8 +46,6 @@
#include <rtgui/driver.h>
#endif
//rt_module_t module_ptr;
#define DATA_PATH "/Data"
void rt_init_thread_entry(void* parameter)
{
/* initialization RT-Thread Components */
@ -58,41 +58,68 @@ void rt_init_thread_entry(void* parameter)
gdb_set_device("uart6");
gdb_start();
#endif
#ifdef RT_USING_DFS
#ifdef RT_USING_DFS_UFFS
/* mount nand flash partition 0 as root directory */
if (dfs_mount("nand0", "/", "uffs", 0, 0) == 0)
#ifdef RT_USING_DFS
#ifdef RT_USING_DFS_ELMFAT
{
mkdir("/sdcard",0);
rt_kprintf("uffs initialized!\n");
static const rt_uint8_t _romfs_root_readme_txt[] = {
0x52,0x54,0x2d,0x54,0x68,0x72,0x65,0x61,0x64,0x0d,0x0a,0x00
};
static const rt_uint8_t _romfs_root_sdcard_aaa_txt[] = {
0x52,0x54,0x2d,0x54,0x68,0x72,0x65,0x61,0x64,0x0d,0x0a,0x00
};
static const struct romfs_dirent _romfs_root_sdcard[] = {
{ROMFS_DIRENT_FILE, "aaa.txt", (rt_uint8_t *)_romfs_root_sdcard_aaa_txt, sizeof(_romfs_root_sdcard_aaa_txt)/sizeof(_romfs_root_sdcard_aaa_txt[0])}
};
static const rt_uint8_t _romfs_root_spi_bbb_txt[] = {
0x52,0x54,0x2d,0x54,0x68,0x72,0x65,0x61,0x64,0x0d,0x0a,0x00
};
static const struct romfs_dirent _romfs_root_spi[] = {
{ROMFS_DIRENT_FILE, "bbb.txt", (rt_uint8_t *)_romfs_root_spi_bbb_txt, sizeof(_romfs_root_spi_bbb_txt)/sizeof(_romfs_root_spi_bbb_txt[0])}
};
static const struct romfs_dirent _romfs_root[] = {
{ROMFS_DIRENT_FILE, "readme.txt", (rt_uint8_t *)_romfs_root_readme_txt, sizeof(_romfs_root_readme_txt)/sizeof(_romfs_root_readme_txt[0])},
{ROMFS_DIRENT_DIR, "sdcard", (rt_uint8_t *)_romfs_root_sdcard, sizeof(_romfs_root_sdcard)/sizeof(_romfs_root_sdcard[0])},
{ROMFS_DIRENT_DIR, "spi", (rt_uint8_t *)_romfs_root_spi, sizeof(_romfs_root_spi)/sizeof(_romfs_root_spi[0])}
};
static const struct romfs_dirent romfs_root = {
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root)/sizeof(_romfs_root[0])
};
if (dfs_mount(RT_NULL, "/", "rom", 0, &(romfs_root)) == 0)
{
rt_kprintf("ROM file system initializated!\n");
}
}
else
/* mount sd card fat partition 0 as root directory */
if (dfs_mount("W25Q256", "/spi", "elm", 0, 0) == 0)
{
rt_kprintf("uffs initialzation failed!\n");
rt_kprintf("spi flash mount to /spi !\n");
}
#endif /* RT_USING_DFS_UFFS */
#ifdef RT_USING_DFS_ELMFAT
/* mount sd card fat partition 0 as root directory */
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == 0)
{
rt_kprintf("File System initialized!\n");
}
else
{
rt_kprintf("File System initialzation failed!\n");
}
/* mount sd card fat partition 0 as root directory */
if (dfs_mount("W25Q256", "/spi", "elm", 0, 0) == 0)
{
rt_kprintf("spi flash mount to /spi !\n");
}
else
{
rt_kprintf("spi flash mount to /spi failed!\n");
}
#endif /* RT_USING_DFS_ELMFAT */
else
{
rt_kprintf("spi flash mount to /spi failed!\n");
}
/* mount sd card fat partition 0 as root directory */
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == 0)
{
rt_kprintf("sd card mount to /sdcard!\n");
}
else
{
rt_kprintf("sd card mount to /sdcard failed!\n");
}
#endif /* RT_USING_DFS_ELMFAT */
#endif /* DFS */

View File

@ -311,10 +311,13 @@
<state>$PROJ_DIR$\Libraries\CMSIS\Device\ST\STM32F4xx\Include</state>
<state>$PROJ_DIR$\.</state>
<state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4</state>
<state>$PROJ_DIR$\..\..\components\drivers\spi\sfud\inc</state>
<state>$PROJ_DIR$\..\..\components\dfs\include</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\devfs</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\net\socket</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\romfs</state>
<state>$PROJ_DIR$\Libraries\CMSIS\Include</state>
<state>$PROJ_DIR$\..\..\components\drivers\spi</state>
<state>$PROJ_DIR$\applications</state>
<state>$PROJ_DIR$\..\..\components\finsh</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\elmfat</state>
@ -1245,10 +1248,13 @@
<state>$PROJ_DIR$\Libraries\CMSIS\Device\ST\STM32F4xx\Include</state>
<state>$PROJ_DIR$\.</state>
<state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m4</state>
<state>$PROJ_DIR$\..\..\components\drivers\spi\sfud\inc</state>
<state>$PROJ_DIR$\..\..\components\dfs\include</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\devfs</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\net\socket</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\romfs</state>
<state>$PROJ_DIR$\Libraries\CMSIS\Include</state>
<state>$PROJ_DIR$\..\..\components\drivers\spi</state>
<state>$PROJ_DIR$\applications</state>
<state>$PROJ_DIR$\..\..\components\finsh</state>
<state>$PROJ_DIR$\..\..\components\dfs\filesystems\elmfat</state>
@ -1912,6 +1918,12 @@
<file>
<name>$PROJ_DIR$\drivers\drv_pcf8574.c</name>
</file>
<file>
<name>$PROJ_DIR$\drivers\drv_spi.c</name>
</file>
<file>
<name>$PROJ_DIR$\drivers\drv_spi_flash.c</name>
</file>
</group>
<group>
<name>STM32_HAL</name>
@ -2227,6 +2239,12 @@
<file>
<name>$PROJ_DIR$\..\..\components\dfs\filesystems\net\net_sockets.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\dfs\filesystems\romfs\dfs_romfs.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\dfs\filesystems\romfs\romfs.c</name>
</file>
</group>
<group>
<name>DeviceDrivers</name>
@ -2248,6 +2266,21 @@
<file>
<name>$PROJ_DIR$\..\..\components\drivers\serial\serial.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\spi\spi_core.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\spi\spi_dev.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\spi\spi_flash_sfud.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\spi\sfud\src\sfud.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\components\drivers\src\completion.c</name>
</file>

View File

@ -353,13 +353,13 @@
<wLevel>0</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<uC99>1</uC99>
<useXO>0</useXO>
<VariousControls>
<MiscControls />
<Define>USE_HAL_DRIVER, RT_USING_ARM_LIBC, STM32F429xx</Define>
<Undefine />
<IncludePath>applications;.;drivers;Libraries\STM32F4xx_HAL_Driver\Inc;Libraries\CMSIS\Device\ST\STM32F4xx\Include;Libraries\CMSIS\Include;..\..\include;..\..\libcpu\arm\cortex-m4;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\dfs\filesystems\net;..\..\components\dfs\filesystems\net\socket;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif</IncludePath>
<IncludePath>applications;.;drivers;Libraries\STM32F4xx_HAL_Driver\Inc;Libraries\CMSIS\Device\ST\STM32F4xx\Include;Libraries\CMSIS\Include;..\..\include;..\..\libcpu\arm\cortex-m4;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\dfs\filesystems\net;..\..\components\dfs\filesystems\net\socket;..\..\components\dfs\filesystems\romfs;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\spi\sfud\inc;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif</IncludePath>
</VariousControls>
</Cads>
<Aads>
@ -495,6 +495,20 @@
<FilePath>drivers\drv_pcf8574.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>drv_spi.c</FileName>
<FileType>1</FileType>
<FilePath>drivers\drv_spi.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>drv_spi_flash.c</FileName>
<FileType>1</FileType>
<FilePath>drivers\drv_spi_flash.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>STM32_HAL</GroupName>
@ -1214,6 +1228,20 @@
<FilePath>..\..\components\dfs\filesystems\net\net_sockets.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>dfs_romfs.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\dfs\filesystems\romfs\dfs_romfs.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>romfs.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\dfs\filesystems\romfs\romfs.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>DeviceDrivers</GroupName>
@ -1259,6 +1287,41 @@
<FilePath>..\..\components\drivers\serial\serial.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>spi_core.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\drivers\spi\spi_core.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>spi_dev.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\drivers\spi\spi_dev.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>spi_flash_sfud.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>sfud.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>sfud_sfdp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\components\drivers\spi\sfud\src\sfud_sfdp.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>completion.c</FileName>

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,9 @@
#define RT_NAME_MAX 8
#define RT_ALIGN_SIZE 4
/* RT_THREAD_PRIORITY_8 is not set */
#define RT_THREAD_PRIORITY_32
/* RT_THREAD_PRIORITY_256 is not set */
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 1000
#define RT_DEBUG
@ -33,9 +36,11 @@
#define RT_USING_MEMPOOL
#define RT_USING_MEMHEAP
#define RT_USING_HEAP
/* RT_USING_NOHEAP is not set */
#define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */
/* RT_USING_MEMHEAP_AS_HEAP is not set */
#define RT_USING_HEAP
/* Kernel Device Object */
@ -74,7 +79,8 @@
#define RT_USING_DFS
#define DFS_USING_WORKDIR
#define DFS_FILESYSTEMS_MAX 2
#define DFS_FILESYSTEMS_MAX 4
#define DFS_FILESYSTEM_TYPES_MAX 4
#define DFS_FD_MAX 4
#define RT_USING_DFS_ELMFAT
@ -89,14 +95,14 @@
#define RT_DFS_ELM_USE_LFN 0
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
/* RT_DFS_ELM_USE_ERASE is not set */
#define RT_DFS_ELM_REENTRANT
#define RT_USING_DFS_DEVFS
#define RT_USING_DFS_NET
#define HAVE_SYS_SELECT_H
/* HAVE_SYS_SOCKET_H is not set */
/* RT_USING_DFS_ROMFS is not set */
#define RT_USING_DFS_ROMFS
/* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_NFS is not set */
@ -115,8 +121,20 @@
/* RT_MTD_NAND_DEBUG is not set */
#define RT_USING_RTC
/* RT_USING_SDIO is not set */
/* RT_USING_SPI is not set */
#define RT_USING_SPI
#define RT_USING_SFUD
#define RT_SFUD_USING_SFDP
/* RT_SFUD_USING_FLASH_INFO_TABLE is not set */
/* RT_SFUD_DEBUG is not set */
/* RT_USING_W25QXX is not set */
/* RT_USING_GD is not set */
/* RT_USING_ENC28J60 is not set */
/* RT_USING_SPI_WIFI is not set */
/* RT_USING_WDT is not set */
/* RT_USING_WIFI is not set */
/* Using USB */
/* RT_USING_USB_HOST is not set */
/* RT_USING_USB_DEVICE is not set */
@ -194,6 +212,7 @@
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
/* IoT - internet of things */
@ -203,23 +222,20 @@
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_EZXML is not set */
/* Marvell WiFi */
/* PKG_USING_MARVELLWIFI is not set */
/* PKG_USING_NANOPB is not set */
/* security packages */
/* PKG_USING_MBEDTLS is not set */
/* PKG_USING_libsodium is not set */
/* language packages */
/* PKG_USING_JERRYSCRIPT is not set */
/* PKG_USING_MICROPYTHON is not set */
/* multimedia packages */
/* PKG_USING_FASTLZ is not set */
/* tools packages */
/* PKG_USING_CMBACKTRACE is not set */
@ -228,6 +244,11 @@
/* miscellaneous packages */
/* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */
#define RT_USING_EXT_SDRAM
#define RT_USING_UART1

View File

@ -356,7 +356,7 @@
<wLevel>0</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<uC99>1</uC99>
<useXO>0</useXO>
<VariousControls>
<MiscControls></MiscControls>