This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/17518] New: flash block_boundaries should round the offset, not the absolute address


https://sourceware.org/bugzilla/show_bug.cgi?id=17518

            Bug ID: 17518
           Summary: flash block_boundaries should round the offset, not
                    the absolute address
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: jim at jtan dot com

gdb/target-memory.c:block_boundaries() figures out which flash blocks need to
be erased for a particular range of addresses, based on the flash blocksize. 
However, it incorrectly rounds the absolute flash address, rather than the
offset from the start of the flash region.  For example, with OpenOCD HEAD and
the nRF51 target, which defines a single-block region of size 0xfc [*]:

    (gdb) info mem
    Using memory regions provided by the target.
    Num Enb Low Addr   High Addr  Attrs
    0   y   0x00000000 0x00040000 flash blocksize 0x400 nocache
    1   y   0x00040000 0x10001000 rw nocache
    2   y   0x10001000 0x100010fc flash blocksize 0xfc nocache
    3   y   0x100010fc 0x100000000 rw nocache
    (gdb) load
    target state: halted
    target halted due to debug-request, current mode: Thread
    xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
    target state: halted
    target halted due to debug-request, current mode: Thread
    xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
    Error: No flash at address 0x10000fb0
    Error: flash_erase returned -4
    Error erasing flash with vFlashErase packet
    (gdb)

GDB tries to erase the block from 0x10000fb0 even though the flash region
starts at 0x10001000.  It should erase the one and only block at 0x10001000
instead.

[*] The size 0xfc is a bug in OpenOCD, but GDB is still doing the wrong thing
here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]