2012-12-07 05:39 PM
Hi All,
Device: STM32F207VCFlash: 256KBRAM: 128KBI have a general question regarding programming image file to user code area in flash located at: 0x8000000I am running following procedure to do this.1). Making sure Flash Erase/Read/Write utility functions are executing from SRAM2). Program the binary image file to Sector 5 on flash, located at addr: 0x8020000 (works fine)3). Disable interrupts4). Copy code image file from 0x8020000 to 0x8000000.Problem occurs when I try to erase sector 0 located at 0x8000000, my program stalls, and but debugger is running so I was able to identify that FLASH_SR value is (status: 0xC0), meaning that PGSERR and PGPERR bits are set. Not sure what the problem is. Do I need to relocated RESET vector and vector table to SRAM?Thanks in advance,Mit2012-12-07 06:47 PM
It would definitely be advisable to have some free standing vectors that aren't getting erased.
2012-12-07 08:06 PM
I relocated vector table using SCB->VTOR to SRAM, and the program is still stalled.
Is there anything else that you suggest?2012-12-08 05:58 AM
Have you stepped into the failure point with the debugger?
Have you cleared any pending status before starting? How are you disabling interrupts? Are you getting hard faults? Make sure sector 0 is not write protected. Try running without a debugger, output progress/telemetry via a serial port. The flash writes tends to give failure issues if it is not erased, or the writes are not suitably aligned. The first 16K sector should be able to erase and update, I have used it for a boot loader, and while I typically don't update it, but rather the application in other sectors, I do have a mechanism for updating it. When I do so I don't have to disable interrupts, as none are running.