S32K312 Flash Driver in RAM erases the same block failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K312 Flash Driver in RAM erases the same block failed

1,038 Views
zhangyiyi
Contributor I

The S32K312 project I developed with the C40 SDK.

I made the Flash Driver image by following the steps below:

1,Add __attribute__((section (".acfls_code_ram"))) to void C40_Ip_MainInterfaceWriteLogicalAddress(uint32 Address) function of C40_Ip.c SDK file.

__attribute__((section (".acfls_code_ram"))) void C40_Ip_MainInterfaceWriteLogicalAddress(uint32 Address,PFLASH_Type *  C40_Ip_pPFlashBaseAddress)
{
    /* Write the program/erase address */
    C40_Ip_pPFlashBaseAddress->PFCPGM_PEADR_L = Address;
}

2,Change the int_sram_fls_rsv size of the .ld file.

int_sram : ORIGIN = 0x20400000, LENGTH = 0x0000E000 
int_sram_fls_rsv : ORIGIN = 0x2040E000, LENGTH = 0x00000300
int_sram_stack_c0 : ORIGIN = 0x2040E300, LENGTH = 0x00000E00 
int_sram_no_cacheable : ORIGIN = 0x2040F100, LENGTH = 0x00006E00 
int_sram_results : ORIGIN = 0x20415F00, LENGTH = 0x00000100
int_sram_shareable : ORIGIN = 0x20416000, LENGTH = 0x00002000 
ram_rsvd2 : ORIGIN = 0x20418000, LENGTH = 0 /* End of SRAM */

 

.acfls_code_ram :
{
acfls_code_ram_start = .;
*(.acfls_code_ram)
acfls_code_ram_stop = .;
} > int_sram_fls_rsv

3,Compile the project.

4,Cut the RAM part of SREC file as ram.srec.

5,Load ram.srec to S32K312 board.

(  my_boot_size:0x00440000-0x00425FF0)

(S32K312_block_0 : 0x00440000-0x004FFFFFF     S32K312_block_1 : 0x00440000-0x004FFFFFF)

 

Then the project code tries to erase 0x004F1000-0x004F2000 but failed,it displays handware error.

However, when I use Debug breakpoint step by step ,it works well. Why?

How can I do it?

 

My_Project :  https://wwvj.lanzoum.com/iyYFw0yfaifi 

0 Kudos
2 Replies

994 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @zhangyiyi,

As you step through the function, can you read the program counter, is it really in SRAM?

You can use ITCM for this:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-Siul2-Port-Ip-Example-S32K344-ITCM-DTCM-S32...

 

BR, Daniel

0 Kudos

1,031 Views
zhangyiyi
Contributor I

(S32K312_block_0 : 0x00400000-0x004FFFFFF S32K312_block_1 : 0x00500000-0x005FFFFFF)

Page 620 in S32K3_RM.pdf

0 Kudos