Trying to program optionbytes

Sysprogs forums Forums VisualGDB Trying to program optionbytes

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27581
    igor.k
    Participant

    Hallo, I’m trying to program option bytes for stm32f303vc device in several steps:

    1. i changed linkerscript by adding new section (.fusebytes).

    <p style=”text-align: left;”>MEMORY
    {
    FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 256K
    SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 40K
    CCMRAM (RWX) : ORIGIN = 0x10000000, LENGTH = 8K
    FUSE (R) : ORIGIN = 0x1FFFF800, LENGTH = 16 /*here is new section*/
    USTAVKIMEM (RW): ORIGIN = 0x0803F800, LENGTH = 2K
    }</p>
    SECTIONS
    {
    .fusebytes :
    {
    . = ALIGN(4);
    KEEP(*(.fusebytes))
    . = ALIGN(4);
    } > FUSE

    }

    2. I added the following in statup file

    const uint32_t OptionByte1 __attribute__((section(“.fusebytes”))) = 0x01FE55AA;

    const uint32_t OptionByte2 __attribute__((section(“.fusebytes”))) = 0x00FF00FF;

    const uint32_t OptionByte3 __attribute__((section(“.fusebytes”))) = 0x00FF00FF;

    const uint32_t OptionByte4 __attribute__((section(“.fusebytes”))) = 0x00FF00FF;

    3. Then i press ‘program and start without debugging ‘ and get the following  message form “Debugging failed. VisualGDB has encountered a problem while starting debugging: Failed to program 1 out of 7 sections”.

    First of all i didn’t press debug button. The second I don’t understand why visualgdb doesn’t want to program this memory section.

    Help, please!

    And thank u in advance!:)

    P.S. ST-Link utility programs stm32 flash with the input hex file which contains fusebytes section. As far as i remeber a week ago visualgdb programs this area, too.

    compare-section and maint info section give the following results:

    compare-section
    &”compare-section\n”
    Section .fusebytes, range 0x1ffff800 — 0x1ffff810: MIS-MATCHED!
    Section .isr_vector, range 0x8000000 — 0x8000188: matched.
    Section .text, range 0x8000188 — 0x800370c: matched.
    Section .init_array, range 0x800370c — 0x8003714: matched.
    Section .fini_array, range 0x8003714 — 0x8003718: matched.
    Section .data, range 0x8003718 — 0x800371c: matched.
    Section .ccmustavki, range 0x803f800 — 0x803f808: matched.
    &”warning: One or more sections of the target image does not match\nthe loaded file\n”
    &”\n”
    OK
    maint info section
    &”maint info section\n”
    Exec file:
    `E:\TOSHIBA\VSPrj\FLSnr_Prj\VisualGDB\Debug\Stm32F303VC’, file type elf32-littlearm.
    [0] 0x1ffff800->0x1ffff810 at 0x0002f800: .fusebytes ALLOC LOAD READONLY DATA HAS_CONTENTS
    [1] 0x8000000->0x8000188 at 0x00010000: .isr_vector ALLOC LOAD DATA HAS_CONTENTS
    [2] 0x8000188->0x800370c at 0x00010188: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
    [3] 0x800370c->0x800370c at 0x0002f810: .ARM.extab HAS_CONTENTS
    [4] 0x800370c->0x800370c at 0x0002f810: .exidx HAS_CONTENTS
    [5] 0x800370c->0x800373a at 0x0002f810: .ARM.attributes READONLY HAS_CONTENTS
    [6] 0x800370c->0x8003714 at 0x0001370c: .init_array ALLOC LOAD DATA HAS_CONTENTS
    [7] 0x8003714->0x8003718 at 0x00013714: .fini_array ALLOC LOAD DATA HAS_CONTENTS
    [8] 0x20000000->0x20000004 at 0x00020000: .data ALLOC LOAD DATA HAS_CONTENTS
    [9] 0x20000004->0x20008080 at 0x00020004: .bss ALLOC
    [10] 0x10000000->0x10000000 at 0x0002f83e: .ccmdata HAS_CONTENTS
    [11] 0x10000000->0x100000b0 at 0x00030000: .ccmbss ALLOC
    [12] 0x100000b0->0x100000b8 at 0x000200b0: .ccmustavki ALLOC LOAD DATA HAS_CONTENTS
    [13] 0x100000b8->0x100000b8 at 0x0002f83e: .heap HAS_CONTENTS
    [14] 0x100000b8->0x100000b8 at 0x0002f83e: .reserved_for_stack HAS_CONTENTS
    [15] 0x0000->0x12df4 at 0x0002f83e: .debug_info READONLY HAS_CONTENTS
    [16] 0x0000->0x2b5c at 0x00042632: .debug_abbrev READONLY HAS_CONTENTS
    [17] 0x0000->0x0390 at 0x0004518e: .debug_aranges READONLY HAS_CONTENTS
    [18] 0x0000->0x0290 at 0x0004551e: .debug_ranges READONLY HAS_CONTENTS
    [19] 0x0000->0x4aa2 at 0x000457ae: .debug_line READONLY HAS_CONTENTS
    [20] 0x0000->0x1cde at 0x0004a250: .debug_str READONLY HAS_CONTENTS
    [21] 0x0000->0x0079 at 0x0004bf2e: .comment READONLY HAS_CONTENTS
    [22] 0x0000->0x0aac at 0x0004bfa8: .debug_frame READONLY HAS_CONTENTS
    OK

    openocd results:

    C:\Users\Igor\AppData\Local\VisualGDB\EmbeddedDebugPackages\com.sysprogs.arm.openocd\bin\openocd.exe -c “gdb_port 50188” -c “telnet_port 50187” -f interface/stlink.cfg -c “transport select hla_swd” -f C:/Users/Igor/AppData/Local/Temp/tmpC4F3.tmp -c init -c “reset init” -c “echo VisualGDB_OpenOCD_Ready”
    Open On-Chip Debugger 0.10.0 (2020-03-05) [https://github.com/sysprogs/openocd]
    Licensed under GNU GPL v2
    libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    hla_swd
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    Info : clock speed 1000 kHz
    Info : STLINK v2 JTAG v32 API v2 SWIM v7 VID 0x0483 PID 0x3748
    Info : using stlink api v2
    Info : Target voltage: 3.236915
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    Info : Stlink adapter speed set to 950 kHz
    Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Listening on port 50188 for gdb connections
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    Info : Stlink adapter speed set to 950 kHz
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x08002334 msp: 0x10002000
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    Info : Stlink adapter speed set to 4000 kHz
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    VisualGDB_OpenOCD_Ready
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 50187 for telnet connections
    Info : accepting ‘gdb’ connection on tcp/50188
    Info : device id = 0x10036422
    Info : flash size = 256kbytes
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    Info : Stlink adapter speed set to 950 kHz
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x08002334 msp: 0x10002000
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    Info : Stlink adapter speed set to 4000 kHz
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    Info : device id = 0x10036422
    Info : flash size = 256kbytes
    flash_bank_summary:0x8000000|0x40000|stm32f3x.flash
    FLASH progress reporting is now on

    Info : Erasing FLASH: 0x08000000-0x08003800…
    Info : Erasing FLASH: 0x0803f800-0x08040000…
    Info : Programming FLASH (2 sections, 14116 bytes)…
    Info : Programming FLASH section 1/2 (14108 bytes) at 0x08000000…
    Info : Flash write discontinued at 0x0800371c, next section at 0x0803f800
    target halted due to breakpoint, current mode: Thread
    xPSR: 0x61000000 pc: 0x2000003a msp: 0x10002000
    Info : Programming FLASH section 2/2 (8 bytes) at 0x0803f800…
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    Info : Stlink adapter speed set to 950 kHz
    Info : Unable to match requested speed 1000 kHz, using 950 kHz
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x08002334 msp: 0x10002000
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    Info : Stlink adapter speed set to 4000 kHz
    Info : Unable to match requested speed 8000 kHz, using 4000 kHz
    target halted due to breakpoint, current mode: Thread
    xPSR: 0x61000000 pc: 0x2000002e msp: 0x10002000
    target halted due to breakpoint, current mode: Thread
    xPSR: 0x61000000 pc: 0x2000002e msp: 0x10002000
    Info : dropped ‘gdb’ connection (error -400)
    shutdown command invoked

    #27582
    support
    Keymaster

    Hi,

    This looks like a bug in OpenOCD. Please consider building it from sources as shown in this tutorial and stepping through the FLASH programming logic to pinpoint the problem.

    Alternatively, please try using Segger J-Link instead. It comes with its own GDB stub that is more reliable than OpenOCD and is fully supported by Segger.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.