From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8988 invoked by alias); 28 Oct 2014 21:45:17 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 8944 invoked by uid 48); 28 Oct 2014 21:45:12 -0000 From: "jim at jtan dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/17518] New: flash block_boundaries should round the offset, not the absolute address Date: Tue, 28 Oct 2014 21:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.7 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jim at jtan dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00133.txt.bz2 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.