Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve flash configs for i.MX RT targets #492

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/examples/imx-rt1040.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=0
WOLFBOOT_PARTITION_SIZE?=0x20000
Expand Down
2 changes: 1 addition & 1 deletion config/examples/imx-rt1050.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=0
WOLFBOOT_PARTITION_SIZE?=0x20000
Expand Down
2 changes: 1 addition & 1 deletion config/examples/imx-rt1060.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=0
WOLFBOOT_PARTITION_SIZE?=0x20000
Expand Down
2 changes: 1 addition & 1 deletion config/examples/imx-rt1060_hab.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=0
WOLFBOOT_PARTITION_SIZE?=0x20000
Expand Down
2 changes: 1 addition & 1 deletion config/examples/imx-rt1064.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=0
WOLFBOOT_PARTITION_SIZE?=0x20000
Expand Down
74 changes: 64 additions & 10 deletions hal/imx_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@
#endif
#ifdef CPU_MIMXRT1061CVJ5B
#include "evkmimxrt1060_flexspi_nor_config.h"
#define USE_GET_CONFIG
#endif
#ifdef CPU_MIMXRT1052DVJ6B
#include "evkbimxrt1050_flexspi_nor_config.h"
/**
* Does not support getting the config through the FlexSPI ROM API
* (see ch. 9.13.1 in rev.5 of the reference manual)
*/
#endif
#ifdef CPU_MIMXRT1042XJM5B
#include "evkmimxrt1040_flexspi_nor_config.h"
#define USE_GET_CONFIG
#endif

#include "xip/fsl_flexspi_nor_boot.h"
Expand Down Expand Up @@ -235,7 +241,32 @@ bootloader_api_entry_t *g_bootloaderTree;

/** Flash configuration in the .flash_config section of flash **/
#ifdef CPU_MIMXRT1064DVL6A
#define CONFIG_FLASH_SIZE (4 * 1024 * 1024) /* 4MBytes */
#if defined(CONFIG_FLASH_W25Q16JV)
/* Winbond W25Q16JV */
#define CONFIG_FLASH_SIZE (2 * 1024 * 1024) /* 2MBytes */
#elif defined(CONFIG_FLASH_W25Q32JV)
/* Winbond W25Q32JV */
#define CONFIG_FLASH_SIZE (4 * 1024 * 1024) /* 4MBytes */
#elif defined(CONFIG_FLASH_W25Q64JV)
/* Winbond W25Q64JV */
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#elif defined(CONFIG_FLASH_W25Q128JV)
/* Winbond W25Q128JV */
#define CONFIG_FLASH_SIZE (16 * 1024 * 1024) /* 16MBytes */
#elif defined(CONFIG_FLASH_W25Q256JV)
/* Winbond W25Q256JV */
#define CONFIG_FLASH_SIZE (32 * 1024 * 1024) /* 32MBytes */
#elif defined(CONFIG_FLASH_W25Q512JV)
/* Winbond W25Q512JV */
#define CONFIG_FLASH_SIZE (64 * 1024 * 1024) /* 64MBytes */
#elif defined(CONFIG_FLASH_IS25WP064A)
/* ISSI IS25WP064A (on EVKB with rework see AN12183) */
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#else
/* Default to 4MBytes */
#define CONFIG_FLASH_SIZE (4 * 1024 * 1024) /* 4MBytes */
#endif

#define CONFIG_FLASH_PAGE_SIZE 256UL /* 256Bytes */
#define CONFIG_FLASH_SECTOR_SIZE (4 * 1024) /* 4KBytes */
#define CONFIG_FLASH_BLOCK_SIZE (64 * 1024) /* 64KBytes */
Expand Down Expand Up @@ -266,8 +297,33 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {


/** Flash configuration in the .flash_config section of flash **/
#if defined(CPU_MIMXRT1062DVL6A) || defined(CPU_MIMXRT1062DVL6B)
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#if defined(CPU_MIMXRT1062DVL6A) || defined(CPU_MIMXRT1062DVL6B) || defined(CPU_MIMXRT1061CVJ5B) || defined(CPU_MIMXRT1042XJM5B)
#if defined(CONFIG_FLASH_W25Q16JV)
/* Winbond W25Q16JV */
#define CONFIG_FLASH_SIZE (2 * 1024 * 1024) /* 2MBytes */
#elif defined(CONFIG_FLASH_W25Q32JV)
/* Winbond W25Q32JV */
#define CONFIG_FLASH_SIZE (4 * 1024 * 1024) /* 4MBytes */
#elif defined(CONFIG_FLASH_W25Q64JV)
/* Winbond W25Q64JV */
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#elif defined(CONFIG_FLASH_W25Q128JV)
/* Winbond W25Q128JV */
#define CONFIG_FLASH_SIZE (16 * 1024 * 1024) /* 16MBytes */
#elif defined(CONFIG_FLASH_W25Q256JV)
/* Winbond W25Q256JV */
#define CONFIG_FLASH_SIZE (32 * 1024 * 1024) /* 32MBytes */
#elif defined(CONFIG_FLASH_W25Q512JV)
/* Winbond W25Q512JV */
#define CONFIG_FLASH_SIZE (64 * 1024 * 1024) /* 64MBytes */
#elif defined(CONFIG_FLASH_IS25WP064A)
/* ISSI IS25WP064A (on EVKB with rework see AN12183) */
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#else
/* Default to 8MBytes */
#define CONFIG_FLASH_SIZE (8 * 1024 * 1024) /* 8MBytes */
#endif

#define CONFIG_FLASH_PAGE_SIZE 256UL /* 256Bytes */
#define CONFIG_FLASH_SECTOR_SIZE (4 * 1024) /* 4KBytes */
#define CONFIG_FLASH_BLOCK_SIZE (64 * 1024) /* 64KBytes */
Expand All @@ -294,12 +350,10 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
.blockSize = CONFIG_FLASH_BLOCK_SIZE,
.isUniformBlockSize = CONFIG_FLASH_UNIFORM_BLOCKSIZE,
};
#endif

#endif /* CPU_MIMXRT1062DVL6A || CPU_MIMXRT1062DVL6B || CPU_MIMXRT1061CVJ5B || CPU_MIMXRT1042XJM5B */

/** Flash configuration in the .flash_config section of flash **/
#if defined(CPU_MIMXRT1061CVJ5B) || defined(CPU_MIMXRT1052DVJ6B) || defined(CPU_MIMXRT1042XJM5B)

#if defined(CPU_MIMXRT1052DVJ6B)
#if defined(CONFIG_FLASH_W25Q16JV)
/* Winbond W25Q16JV */
#define CONFIG_FLASH_SIZE (2 * 1024 * 1024) /* 2MBytes */
Expand Down Expand Up @@ -590,11 +644,11 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
.ipcmdSerialClkFreq = 0,
};
#endif
#endif /* CPU_MIMXRT1042XJM5B || CPU_MIMXRT1052DVJ6B */

#endif /* CPU_MIMXRT1052DVJ6B */

#ifndef __FLASH_BASE
#if defined(CPU_MIMXRT1062DVL6A) || defined(CPU_MIMXRT1062DVL6B) || \
#if defined(CPU_MIMXRT1062DVL6A) || \
defined(CPU_MIMXRT1062DVL6B) || \
defined(CPU_MIMXRT1061CVJ5B) || \
defined(CPU_MIMXRT1052DVJ6B) || \
defined(CPU_MIMXRT1042XJM5B)
Expand Down
Loading