cancel
Showing results for 
Search instead for 
Did you mean: 

Using SRAM2 ram-code, why can't I erase page 0 since I can erase page 64?

RLebe.1
Associate II

Context: Using STM3Cube. STM2L431CC. (256KB flash, single bank)

I have RAM code that successfully erase and program page 64 to 72.

The same ram-code is then used to program page 0..8.

The problem it fails to erase any page in range 0..63.

No interrupts are enabled. When the START bit is set it is cleared right away and the page isn't erased. Cache and pre-fetch are disabled, interrupts to. No apparent mechanism is enabled to protect page 0..64. The device isn't suppose to support dual-bank.

The IDE shows undocumented bits in OPTR BFB2=1 and DUALBANK=1 .

nBOOT1=1. Of course the SR.LOCK bit is 0 for unlocked.

So what is the problem here?

I can erase and program page 64 and up and can't on 0 and my code runs in RAM?

1 ACCEPTED SOLUTION

Accepted Solutions
RLebe.1
Associate II

Solved. look in .list for _veneer indirectly called function where indirection table was still in flash. Now all code in RAM and runs fine. The IDE fooled me because the memory was actually erase. Also the "Memory" menu of the IDE doesn't display we the content of those flash memory since after erase it was showing old code.

View solution in original post

5 REPLIES 5

>>I can erase and program page 64 and up and can't on 0 and my code runs in RAM?

All of it? Not got some dependencies, vector table, or systick running?

Got STM32L432KC where I'm definitely able to erase/write to the front end of FLASH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
RLebe.1
Associate II

Interrupts are disabled, the code doesn't use them. VTOR still points a page 0. systick is running but interrupts are disabled.

Is here an issue with systick running. ST code does active polling using systick to measure timout time. (But not interrupt based.)

Thank for your answer. Any other suggestions?

RLebe.1
Associate II

I am on a lead. Even the non-interrupt based code depends on SysTick and is interrupt based. Can't flush page 0 since the vector are there.

So I need to copy vector in RAM, change the VTOR and it should work. The handler and some other support code needed to be put in RAM to.

Now working.

>>Any other suggestions?

Do it in Assembler, contain the dependencies

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
RLebe.1
Associate II

Solved. look in .list for _veneer indirectly called function where indirection table was still in flash. Now all code in RAM and runs fine. The IDE fooled me because the memory was actually erase. Also the "Memory" menu of the IDE doesn't display we the content of those flash memory since after erase it was showing old code.