Hello, I use the chip of S32K344 and want to write data into data flash (0x10000000).
The dFlashVersion can't write to the data flash! My method below:
MEMORY
{
int_dflash : ORIGIN = 0x10000000, LENGTH = 0x00001000
}
SECTION
{
.dflash:
{
. = ALIGN(4);
KEEP (*(.dflash))
. = ALIGN(4);
} > int_dflash
}
__attribute__((section(".dflash"))) const uint8_t dFlashVersion[] =
{0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22};
and reference the method : How to set data flash memory in link file - NXP Community
Here is my debug configuration, I click the Browse button and didn't find any *.pcp files.
Is this why writing data fails? Or how to solve it?
Thanks,
Best Regards.
Solved! Go to Solution.
Hi @Foxconn
You mentioned that you have S32K344 but the screenshot shows S32K324. Could you confirm what do you have exactly? I know that it's the same device and that we can easily switch between lockstep and decoupled mode but the project should be created for correct derivative in any case. Maybe this is the reason.
I have some project here for S32K344 where boot header is forced to data flash:
I use this default configuration:
and when loading this project to S32K344, it is successfully programmed:
Regards,
Lukas
Hi @Foxconn
You mentioned that you have S32K344 but the screenshot shows S32K324. Could you confirm what do you have exactly? I know that it's the same device and that we can easily switch between lockstep and decoupled mode but the project should be created for correct derivative in any case. Maybe this is the reason.
I have some project here for S32K344 where boot header is forced to data flash:
I use this default configuration:
and when loading this project to S32K344, it is successfully programmed:
Regards,
Lukas
Thank you for your support!
I found out that I used another ld file and the section needed to add the address
This will be the solution! (This version writes to dataflash 0x10000000)
#define FW_VERSION_LENGTH 16
__attribute__((section(".dflash"))) const uint8_t usFwVersion[FW_VERSION_LENGTH] =
{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00};
And I found that the address (0x10000010) is not my data (0x809E4070, 0x01000000), and check the map file can not search the reason.
Can you analyze it for me?
Thx
Best Regards.
I don't know where it comes from, I would need to see whole map file and linker file, at least.
Regards,
Lukas
Dear Lukas,
I upload an attachment,
I keep track of other information in the data flash. The compiler seems to put the extra data there (behind my data)?
P.S. if my data configuration flash 0x10000050 and extra data will configuration 0x10000060 (behind my data) by compiler
.dflash 0x10000000 0x10
*(.dflash)
.dflash 0x10000000 0x10 ./src/AppSrc/MainApp.o
0x10000000 usFwVersion
. ARM.extab 0x10000010 0x0
. ARM.extab 0x10000010 0x0 c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/.. /lib/gcc/arm-none-eabi/10.2.0/thumb/v7e-m+fp/hard\libgcc.a(_udivmoddi4.o)
. ARM.exidx 0x10000010 0x8
. ARM.exidx 0x10000010 0x8 c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/.. /lib/gcc/arm-none-eabi/10.2.0/thumb/v7e-m+fp/hard\libgcc.a(_udivmoddi4.o)
.rel.dyn 0x10000018 0x0
.rel.iplt 0x10000018 0x0 ./Project_Settings/Startup_Code/Vector_Table.o
THX
Best Regards.
Hi @Foxconn
I found out that it's internally used by gcc for unwinding for exception handling.
If new application project is created in S32DS without RTD, it's explicitly defined in linker file like this and it's placed to program flash:
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > PFLASH
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > PFLASH
__exidx_end = .;
It's not present in linker file for RTD project for some reasons. And in your case, it looks like it is somehow forced to data flash by default. Please try to use the above definition in your linker file to force it to program flash. I guess that this could solve your problem.
Regards,
Lukas
Dear Lukas,
Thank you very much for solving my problem.
Return to normal state, there is no redundant data in the data flash.
Other than that, I'm not sure about creating a S32DS new project without an RTD.
My approach is to create an empty project to add the RTD functionality.
Does it have side effects?
THX
Best Regards.
Of course, if you use RTD, create new project with RTD.
I just wanted to highlight that I found that definition in project without RTD. It's not necessary for you to create such project without RTD.
Regards,
Lukas