Ozone programming STM32G4 board, error = 4

  • When I try and debug using Ozone on a custom STM32G4 board with my JLink Plus Compact, I get:

    J-Link: Flash download: Total: 2.351s (Prepare: 0.081s, Compare: 0.267s, Erase: 0.993s, Program: 1.008s, Verify: 0.000s, Restore: 0.000s)
    J-Link: Flash download: Program speed: 95 KB/s
    J-Link: Flash download: Bank 0 @ 0x08000000: 1 range affected (98304 bytes)
    J-Link: Flash download: Total: 2.032s (Prepare: 0.002s, Erase: 1.022s, Program: 1.007s, Verify: 0.000s, Restore: 0.000s)
    J-Link: Flash download: Program speed: 95 KB/s
    Programming failed (error code = 4) for block @ address 0x08016000 (61)
    Download failed: error during program/erase phase

    Elf.GetBaseAddr(); // returns 0x8000000
    Target.ReadU32 (0x08000000); // returns 0x4, data is 0x20007140
    Target.SetReg ("SP", 0x20007140, FALSE);
    Target.SetReg ("SP", 0x20007140, FALSE): Program is running.
    Elf.GetEntryPointPC(); // returns 0x8002DA4
    Target.SetReg ("PC", 0x8002DA4, FALSE);
    Target.SetReg ("PC", 0x8002DA4, FALSE): Program is running.

    What does this error mean?

  • I see that JLINKARM_EndDownload function from Jlink dll have a return value of -4 which says: "Error during verification phase."
    From the examples I see that it's used to actually download the data into the flash memory.
    Do you have a verify function implemented on your flash loader?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!