在调试s32k144的过程中,在使用s32ds中s32k sdk 3.0中的flash分区例程flash_partitioning_s32k144,例程中对pflash和eee的擦写都正常,然后我在该例程的基础上,在ld文件中加入对pflash的划分,- /* Flash */
- m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
- m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
- m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007DBF0
-
- m_text2 (RW) : ORIGIN = 0x0007e000, LENGTH = 0x00002000
- /* SRAM_L */
- m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000
- /* SRAM_U */
- m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
复制代码 以及添section定义
- .MySection1 :
- {
- . = ALIGN(4);
- *(.mysection1)
- . = ALIGN(4);
- } > m_text2
复制代码 然后再c文件中定义两个数组
- __attribute__((section (".mysection1"))) const uint32 Flash_data[512] =
- {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
- };
- __attribute__ ((section(".data"))) uint32 Ram_data[512];
复制代码 接着修改程序将
- INT_SYS_DisableIRQGlobal();
- ret = FLASH_DRV_EraseSector(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE);
- DEV_ASSERT(STATUS_SUCCESS == ret);
- INT_SYS_EnableIRQGlobal();
- /* Disable Callback */
- // flashSSDConfig.CallBack = NULL_CALLBACK;
- /* Verify the erase operation at margin level value of 1, user read */
- ret = FLASH_DRV_VerifySection(&flashSSDConfig, (uint32)&Flash_data[0], size / FTFx_PHRASE_SIZE, 1u);
- DEV_ASSERT(STATUS_SUCCESS == ret);
- /* Write some data to the erased DFlash sector */
- address = flashSSDConfig.DFlashBase;
- size = BUFFER_SIZE;
- ret = FLASH_DRV_Program(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE, (uint8_t *)Ram_data);
- DEV_ASSERT(STATUS_SUCCESS == ret);
- /* Verify the program operation at margin level value of 1, user margin */
- ret = FLASH_DRV_ProgramCheck(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE, (uint8_t *)Ram_data, &failAddr, 1u);
- DEV_ASSERT(STATUS_SUCCESS == ret);
复制代码 但是debug运行程序时,运行完FLASH_DRV_EraseSector函数后,对应地址后的区块并没有被擦除掉,不知道是什么原因,之前调试kea128的时候是同样的工作流程,却可以擦写成功,往有同样经历的大佬解答
|