uVision erases first page when flashing

Hello,

I have bootloader at page 0,1,2,3 in STM32C051F8P6.
uVision is configured to flash application from page 6.
uVision erases first page when flashing.
When I generate a hex file from uVision and uses STM32CubeProgrammer to flash then it does not erase the first page.

  • Page 0. 0x08000000. Problem here: uVision erases this. STM32CubeProgrammer does not erase this.
  • Page 1. 0x08000800. Not erased
  • Page 2. 0x08001000. Not erased
  • Page 3. 0x08001800. Not erased
  • Page 6. 0x08003000. Successfully puts application from here

What I always need to do now in uVision is to flash application first then bootloader because flashing the application destroys the first page of the bootloader.
How to prevent uVision erasing page 0 at 0x08000000 even though it is configured to flash from 0x08003000? 




  • Just to clarify, when you say it's configured to flash from 0x08003000, do you mean you've changed the linker start address, or the Flash Download address range in uVision? Have you ever tried modifying the address range under Programming Algorithm by selecting your flash algorithm 'STM32C0x_64' and changing the 'Start' address to 0x08003000?
    Reference: developer.arm.com/.../Target-Driver-Settings

  • I updated the IROM1 setting in uVision Options > Target from 0x08000000 to 0x08003000. This successfully flashes the application from 0x08003000, but during flashing, page 0 still gets erased. However, pages 1, 2, and 3 remain intact. Additionally, the scatter file or the linker file is generated:

    ; *************************************************************
    ; *** Scatter-Loading Description File generated by uVision ***
    ; *************************************************************

    LR_IROM1 0x08003000 0x00008000  {    ; load region size_region
      ER_IROM1 0x08003000 0x00008000  {  ; load address = execution address
       *.o (RESET, +First)
       *(InRoot$$Sections)
       .ANY (+RO)
       .ANY (+XO)
      }
      RW_IRAM1 0x20000000 0x00003000  {  ; RW data
       .ANY (+RW +ZI)
      }
    }

    I tried modifying the address range under Programming Algorithm from
    start=0x08000000, size=0x00010000 to
    start=0x08003000, size=0x0000D000
    But it still erases page 0.

    But I also get this when I change the address range under Programming Algorithm:
    No Algorithm found for: 08002000H - 0800202FH
    No Algorithm found for: 08002800H - 0800282FH
    Partial Erase Done (areas with no algorithms skipped!)
    No Algorithm found for: 08002000H - 0800202FH
    No Algorithm found for: 08002800H - 0800282FH
    Partial Programming Done (areas with no algorithms skipped!)
    Partial Verify OK (areas with no algorithms skipped!)
    Application running ...