查看: 4700|回复: 0

[S32] S32K144 遇到的flash无法擦写的问题

[复制链接]
回帖奖励 5 NXP金币 回复本帖可获得 1 NXP金币奖励! 每人限 1 次

该用户从未签到

2

主题

4

帖子

0

注册会员

Rank: 2

积分
83
最后登录
2021-6-28
发表于 2020-1-7 16:18:33 | 显示全部楼层 |阅读模式
在调试s32k144的过程中,在使用s32ds中s32k sdk 3.0中的flash分区例程flash_partitioning_s32k144,例程中对pflash和eee的擦写都正常,然后我在该例程的基础上,在ld文件中加入对pflash的划分,
  1.   /* Flash */
  2.   m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  3.   m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  4.   m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0007DBF0
  5.   
  6.   m_text2               (RW)  : ORIGIN = 0x0007e000, LENGTH = 0x00002000

  7.   /* SRAM_L */
  8.   m_data                (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

  9.   /* SRAM_U */
  10.   m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00007000
复制代码
以及添section定义
  1. .MySection1 :
  2.   {
  3.     . = ALIGN(4);
  4.     *(.mysection1)
  5.     . = ALIGN(4);
  6.   } > m_text2
复制代码
然后再c文件中定义两个数组
  1. __attribute__((section (".mysection1"))) const uint32 Flash_data[512] =
  2. {
  3.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  4.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  5.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  6.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  7.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  8.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  9.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  10.         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  11. };

  12. __attribute__ ((section(".data"))) uint32 Ram_data[512];
复制代码
接着修改程序将
  1. INT_SYS_DisableIRQGlobal();

  2.         ret = FLASH_DRV_EraseSector(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE);
  3.         DEV_ASSERT(STATUS_SUCCESS == ret);
  4.          INT_SYS_EnableIRQGlobal();
  5.     /* Disable Callback */
  6. //    flashSSDConfig.CallBack = NULL_CALLBACK;


  7.         /* Verify the erase operation at margin level value of 1, user read */
  8.         ret = FLASH_DRV_VerifySection(&flashSSDConfig, (uint32)&Flash_data[0], size / FTFx_PHRASE_SIZE, 1u);
  9.         DEV_ASSERT(STATUS_SUCCESS == ret);

  10.         /* Write some data to the erased DFlash sector */
  11.         address = flashSSDConfig.DFlashBase;
  12.         size = BUFFER_SIZE;
  13.         ret = FLASH_DRV_Program(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE, (uint8_t *)Ram_data);
  14.         DEV_ASSERT(STATUS_SUCCESS == ret);

  15.         /* Verify the program operation at margin level value of 1, user margin */
  16.         ret = FLASH_DRV_ProgramCheck(&flashSSDConfig, (uint32)&Flash_data[0], FEATURE_FLS_PF_BLOCK_SECTOR_SIZE, (uint8_t *)Ram_data, &failAddr, 1u);
  17.         DEV_ASSERT(STATUS_SUCCESS == ret);
复制代码
但是debug运行程序时,运行完FLASH_DRV_EraseSector函数后,对应地址后的区块并没有被擦除掉,不知道是什么原因,之前调试kea128的时候是同样的工作流程,却可以擦写成功,往有同样经历的大佬解答
我知道答案 目前已有0人回答
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-24 00:20 , Processed in 0.084193 second(s), 22 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表