I'm using KEAZ128 and S32DS, and below are my main function
linker file
section setting
and data defination.
What my problem is that I can erase and program the sector after 0x4000 when there is no flash_data's defination and .mytext section setting. And once I allocate flash_data in the .mytext section, I can't erase and program the sector after 0x4000 anymore. Please help. Project attached.
My problem is how to read the flash value when the power is turned on after the power is turned off.
Hi Peter,
Read the flash is very simple, just read the address, and get the address data is OK.
If you still have question about it, please create the new question post for yourself, don't follow other's question post.
If you still want I to reply you, in your own post, you can add assign to kerry zhou, thank you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kerry :
I am running this program no problem but I delete it.
FLASH_EraseSector(VERIFIED_SECTOR*FLASH_SECTOR_SIZE);
Read flash but read 0
My problem is how to read the flash value when the power is turned off after the power is turned off.
Hi Yan Sun,
How do you test it, do you just debug the code and check the memory data?
If yes, it's the IDE's problem, when you use the __attribute__ ((section(".mysection1"))) uint32_t flash_data[128]; The IDE seems protect the memory according address.
Actually, I also use the printf to see the data, I find the flash erase and program all works.
Please check my test result and the attached code:
1. Erase
You can find the memory still 0 after erase, but the printf data is 0XFF, it's correct.
2. Program.
Please use my attached project.
In the optimization, please don't select the data section, do it like the following code:
我在每个节点前后用数组都出来试了一下,结果如下:
擦除前
擦除后
写入后
就结果来看好像擦除是可以的,但是写入并没有成功。
楼主,你测试我给你的代码呢。
然后你用串口接收打印就知道了,我的代码我昨天已经测试过了,其实就是比你多了打印功能,不能光相信IDE的debug信息查看。我个人认为S32DS不够成熟,之前这种功能我在CW, KDS, MCUXpressoIDE上面都没遇到过。
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
这个我再多验证一下。还请教一个问题,就是将函数拷到RAM运行是怎么实现的,还是说就是直接将函数用__attribute__分配到ram中就行了?谢谢
对的,其实和flash的操作一样,就是在ld文件中分配的区域是RAM区域。
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------