[RW612] Error occurred while adding a Flash region

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[RW612] Error occurred while adding a Flash region

2,020件の閲覧回数
hclee
Contributor III

Error occurred while adding a Flash region

I encountered an error while attempting to add a 4MByte Flash region to the frdmrw612_wifi_cli_over_ble_wu project, as shown in the image below.

I tried to initialize the new Flash region by creating a separate lfs_config and using the existing lfs_init function, but an error occurred during the lfs_mount process.

The error occurs specifically in the lfs_mount function when calling the lfs_dir_fetchmatch function, which returns an error value of -5.

What additional aspects should be checked when adding a new Flash region?

For reference, the symbols.ldt and end_text.ldt files have been updated with the new Flash region information, based on the existing LITTLEFS_FLASH_region information.


hclee_0-1739857849398.png

 



0 件の賞賛
返信
8 返答(返信)

1,994件の閲覧回数
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

What SDK version are you using?

Can you please share steps to replicate this?

Regards,

Daniel.

0 件の賞賛
返信

1,985件の閲覧回数
hclee
Contributor III

Hi, @DanielRuvalcaba 

The SDK version I am using is 2.16.100, as shown in the image below.

hclee_0-1739934637016.png



To reproduce the situation, I performed the following steps:

Step 1

In MCUXpresso, navigate to Project properties -> C/C++ Build -> MCU Settings and allocate the TEST_LITTLEFS_region.

Step 2

In the project folder, navigate to linkscripts and add the following content to two files:

   1. symbols.ldt
      TEST_LITTLEFS_FLASH_START_ADDRESS = __base_TEST_LITTLEFS_FLASH_region;
      TEST_LITTLEFS_FLASH_SECTOR_SIZE = 0x1000; /* 4k flash sector size */
      TEST_LITTLEFS_FLASH_MAX_SECTORS = (__top_TEST_LITTLEFS_FLASH_region
      TEST_LITTLEFS_FLASH_START_ADDRESS) / TEST_LITTLEFS_FLASH_SECTOR_SIZE;

    2. end_text.ldt
      .TEST_LITTLEFS_FLASH_region :
     {
      . = ORIGIN(TEST_LITTLEFS_FLASH_region) + LENGTH(TEST_LITTLEFS_FLASH_region) - 1;
     } > TEST_LITTLEFS_FLASH_region

Step 3

Flash Config

  • Define the flash specifications and write the Test_LittleFS_config as shown in the attached test_littlefs.c file.
    .....

    /* Maximum block read size definition */
    #define TEST_LITTLEFS_READ_SIZE 16

    /* Maximum block program size definition */
    #define TEST_LITTLEFS_PROG_SIZE 256

    /* Erasable block size definition */
    #define TEST_LITTLEFS_BLOCK_SIZE 4096

    /* Block count */
    #define TEST_LITTLEFS_BLOCK_COUNT 1024

    /* Minimum block cache size definition */
    #define TEST_LITTLEFS_CACHE_SIZE 256

    /* Minimum lookahead buffer size definition */
    #define TEST_LITTLEFS_LOOKAHEAD_SIZE 16

    extern uint32_t TEST_LITTLEFS_FLASH_START_ADDRESS[];

    /*
     * Name: TEST_FLASH_LITTLEFS_SECTOR_SIZE
     * Description: external symbol from linker command file, it represents the size
     *              of a FLASH sector
     */
    extern uint32_t TEST_LITTLEFS_FLASH_SECTOR_SIZE[];

    /*
     * Name:  TEST_LITTLEFS_FLASH_MAX_SECTORS
     * Description: external symbol from linker command file, it represents the sectors
     *              count used by the ENVM storage system; it has to be a multiple of 2
     */
    extern uint32_t TEST_LITTLEFS_FLASH_MAX_SECTORS[];

    static struct lfs_config Test_LittleFS_config = {
      .context = (void*)&Test_LittleFS_ctx,
      .read = test_lfs_mflash_read,
      .prog = test_lfs_mflash_prog,
      .erase = test_lfs_mflash_erase,
      .sync = test_lfs_mflash_sync,
    #ifdef LFS_THREADSAFE
      .lock = test_lfs_mflash_lock,
      .unlock = test_lfs_mflash_unlock,
    #endif
      .read_size = TEST_LITTLEFS_READ_SIZE,
      .prog_size = TEST_LITTLEFS_PROG_SIZE,
      .block_size = TEST_LITTLEFS_BLOCK_SIZE,
      .block_count = TEST_LITTLEFS_BLOCK_COUNT,
      .block_cycles = 100,
      .cache_size = TEST_LITTLEFS_CACHE_SIZE,
      .lookahead_size = TEST_LITTLEFS_LOOKAHEAD_SIZE
    };
    .....
     
     
    Step 4

    TEST_LITTLEFS INIT

    • Call the lfs_t * test_lfs_init(void) function in the test_littlefs.c file to attempt initialization.
    • Call the lfs_mount function and observe that an error occurs in the return result.

     

    Regards,

    hclee.

タグ(1)
0 件の賞賛
返信

1,975件の閲覧回数
hclee
Contributor III

Please refer to the "test_littlefs.c" file in this document.

タグ(1)
0 件の賞賛
返信

1,942件の閲覧回数
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

Thanks for the instructions.

I am having 2 issues while replicating this:

1. The following "TEST_LITTLEFS_FLASH_MAX_SECTORS = (__top_TEST_LITTLEFS_FLASH_region TEST_LITTLEFS_FLASH_START_ADDRESS) / TEST_LITTLEFS_FLASH_SECTOR_SIZE;" in symbols.ldt is giving me some problems in the linker. Is it defined correctly?

 

2. The project can't find #include "ble_lower_level.h" and #include "audio.h". These files are not included in the original wifi_cli_over_ble_wu example, right?

 

Regards,

Daniel.

0 件の賞賛
返信

1,936件の閲覧回数
hclee
Contributor III

1.
There was a typo in the part I mentioned.

The original is as follows:

EDGEFAST_BT_LITTLEFS_STORAGE_START_ADDRESS = __base_LITTLEFS_FLASH_region;
EDGEFAST_BT_LITTLEFS_STORAGE_SECTOR_SIZE = 0x1000;  /* 4k flash sector size */
EDGEFAST_BT_LITTLEFS_STORAGE_MAX_SECTORS = (__top_LITTLEFS_FLASH_region - EDGEFAST_BT_LITTLEFS_STORAGE_START_ADDRESS) / EDGEFAST_BT_LITTLEFS_STORAGE_SECTOR_SIZE;
 
 

What I wrote is as follows:

TESET_LITTLEFS_FLASH_START_ADDRESS = __base_TESET_LITTLEFS_FLASH_region;
TESET_LITTLEFS_FLASH_SECTOR_SIZE = 0x1000;  /* 4k flash sector size */
TESET_LITTLEFS_FLASH_MAX_SECTORS = (__top_TESET_LITTLEFS_FLASH_region - TESET_LITTLEFS_FLASH_START_ADDRESS) / TESET_LITTLEFS_FLASH_SECTOR_SIZE;
 
 

I thought I added it correctly according to the original format, but could there be a problem with this method?

 

2.

The audio.h file is a file I added separately. The file only contains several values defined with #define, and there is no content related to Flash.

タグ(2)
0 件の賞賛
返信

1,877件の閲覧回数
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

Thanks for the details.

I am checking this.

 

Regards,

Daniel.

0 件の賞賛
返信

1,783件の閲覧回数
hclee
Contributor III

Hi, @DanielRuvalcaba 

Could you provide an update on the status of the issue I inquired about earlier?

Regards,

hclee

タグ(1)
0 件の賞賛
返信

1,762件の閲覧回数
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

 

 

Sorry for the late reply. By any chance, have you tried to mount the littlefs as in littlefs_shell?

I'm sharing with you an article that might help you.

 

Regards,

Daniel.

0 件の賞賛
返信