2020-02-25 06:46 AM
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?
Solved! Go to Solution.
2020-02-26 03:17 AM
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.
2020-02-25 08:23 AM
>>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
2020-02-25 08:29 AM
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?
2020-02-25 01:12 PM
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.
2020-02-25 02:45 PM
>>Any other suggestions?
Do it in Assembler, contain the dependencies
2020-02-26 03:17 AM
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.