cancel
Showing results for 
Search instead for 
Did you mean: 

FlashErase/FlashProgram not working with any optimization level (-Os size/-O1 general/-O2 speed/-O3 fast) except -O0 none.

DMA
Associate II

Hi, I am working on SPC58NG84E7 bootloader. I have Bootloader code(at 0x00FC0000) with which i am using "FlashErase" API to Erase Flash Memory block at 0x00FF0000 with "-Os size" Optimization But its not working. Also, I tried putting breakpoint to the next line after erase, but breakpoint does not hit. Looks like its stuck in the execution.

I tried all other optimizations as well but same result.

Also, without optimization (NONE(-O0)) its working fine. 

Same result is for "FlashProgram" API.

What could be the issue here?

Please help me resolve the issue.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
ODOUV.1
ST Employee

Hello,

your parameters are good.

Would you please check it could be the same issue than this one :

Flash Erase for SPC58NG84E7 is not working (st.com)

Best Regards,

-Olivier

View solution in original post

14 REPLIES 14
ODOUV.1
ST Employee
DMA
Associate II

Hi Oliver,

Thanks for your reply. But that issue is different than what i am facing. It didn't work.

I am getting unhandled exception.

Any other suggestions??

Thanks and Regards

Deepesh

ODOUV.1
ST Employee

Hello Deepesh,

I have no over idea with your optimization level issue.

I will forward your concern to the Flash Driver expert and let you know any feedback.

Best Regards,

-Olivier

ODOUV.1
ST Employee

Hello,

how are you selecting your low block to erase at 0xFF_0000 ?

do you use lowBlockSelect 0x200 ? and other select to 0 ?

BRs,

-Olivier

DMA
Associate II

Configuration for flash is as follows:

SSD_CONFIG FLSHM_ssdConfig = {

C55_REG_BASE, /* C55 control register base */

MAIN_ARRAY_BASE, /* base of main array */

{ 0, 0, 0 }, /* blocks info of low address space */

{ 0, 0, 0 }, /* blocks info of mid address space */

{ 0, 0, 0 }, /* blocks info of high address space */

0, /* number of blocks in 256K address space */

UTEST_ARRAY_BASE, /* base of UTEST array */

TRUE, /* interface flag indicate main or alternate interface */

0x80,/* programmable size */

FALSE /* debug mode selection */

};

Below steps to get flash block erased-

#define LOWBLOCKSELECT 0x00000200U (0x00FF0000)

#define MIDBLOCKSELECT 0x00000000U

#define HIGHBLOCKSELECT 0x00000000U

 /* Unlock the requested block for Erase operation */

nLargeBlockSelect.firstLargeBlockSelect = 0;

nLargeBlockSelect.secondLargeBlockSelect = 0;

SetLock(&FLSHM_ssdConfig, C55_BLOCK_LOW, UNLOCK_ALL_BLOCKS);

/* Erase the requested block */

Return_Val = FlashErase(&FLSHM_ssdConfig, C55_ERASE_MAIN, LOWBLOCKSELECT,

MIDBLOCKSELECT, HIGHBLOCKSELECT, nLargeBlockSelect);

if(Return_Val == C55_OK)

{

 while(C55_INPROGRESS == FlashCheckStatus(&FLSHM_ssdConfig, C55_MODE_OP_ERASE, &opResult, &FLSHM_eraseCtxData));

 /* Erase is successful */

}

else

{

/* Erase failed */

}

ODOUV.1
ST Employee

Hello,

your parameters are good.

Would you please check it could be the same issue than this one :

Flash Erase for SPC58NG84E7 is not working (st.com)

Best Regards,

-Olivier

ODOUV.1
ST Employee

Could you try this Load in RAM configuration ? (in SPC58xGxx RLA Platfrom->runtime settings)0693W00000JNilIQAT.png 

BRs,

-Olivier

Hi Oliver

Yes Its similar to the issue that I am facing currently.

Current solution is to put your program in RAM.

I asked for an analysis from R&D.

I will keep you informed.

Best Regards,

-Olivier