Hi all,
We are using Eclipse + OpenOCD 0.10.0-rc2 with a dual core Cortex-M4 target.
We are experiencing strange behavior with OpenOCD where it crashes with this
error:
Open On-Chip Debugger 0.10.0-rc2
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
ATTACH
adapter speed: 1000 kHz
Info : auto-selecting first available session transport "jtag". To override use
'transport select <transport>'.
cortex_m reset_config sysresetreq
cortex_m reset_config sysresetreq
Info : clock speed 1000 kHz
Info : JTAG tap: netx90.dap tap/device found: 0x6ba00477 (mfg: 0x23b (ARM
Ltd.), part: 0xba00, ver: 0x6)
Info : JTAG tap: netx90.tap tap/device found: 0x102046ad (mfg: 0x356 (Hilscher
Gesellschaft), part: 0x0204, ver: 0x1)
Info : netx90.app: hardware has 6 breakpoints, 4 watchpoints
Info : netx90.comm: hardware has 6 breakpoints, 4 watchpoints
gdb-server-ready
Info : accepting 'gdb' connection on tcp/3333
undefined debug reason 7 - target needs reset
Assertion failed!
Program: C:\BuildTools\openocd\0.10.0\bin\openocd.exe
File: ../src/target/armv7m.c, Line 218
Expression: num < (int)armv7m->arm.core_cache->num_regs
We observe this when we attach to the target, halt it and then connect with gdb
(using Eclipse). At this point if we open the Registers view and scroll down to
the d0-d15 registers, OpenOCD crashes with the error above. The error does not
occur only immediately after reset.
I started debugging OpenOCD to find out why we reach the 'Assertion failed!'
error and it seems that there is a bug in the armv7m_get_core_reg() function:
static int armv7m_get_core_reg(struct reg *reg)
{
int retval;
struct arm_reg *armv7m_reg = reg->arch_info;
struct target *target = armv7m_reg->target;
struct arm *arm = target_to_arm(target);
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
//BUG: Why is read_core_reg called with the armv7m_reg->num instead of the
register index?
retval = arm->read_core_reg(target, reg, armv7m_reg->num, arm->core_mode);
return retval;
}
Under normal circumstances registers are initially loaded in the
cortex_m_debug_entry() function where the register index is passed correctly to
the armv7m_read_core_reg() function.
But in our case for some reason cortex_m_debug_entry() is not called and when
gdb starts sending 'p' packets to read the registers, they are loaded using the
armv7m_get_core_reg() function instead.
This happens in the gdb_get_register_packet() function:
static int gdb_get_register_packet(struct connection *connection,
char const *packet, int packet_size)
{
...
if (!reg_list[reg_num]->valid) {
retval = reg_list[reg_num]->type->get(reg_list[reg_num]); // here the register
is loaded with armv7m_get_core_reg()
if (retval != ERROR_OK && gdb_report_register_access_error) {
LOG_DEBUG("Couldn't get register %s.", reg_list[reg_num]->name);
free(reg_list);
return gdb_error(connection, retval);
}
}
...
}
The armv7m_get_core_reg() function passes the wrong register index to
armv7m_read_core_reg() and the assertion error is reached.
Please excuse me if this was already reported, I couldn't find anything related
to the error.
Best regards,
Plamena Marinova
Hilscher Development & Test Center EOOD | Business Park Varna - B8, 402 |
9009 Varna | Bulgaria | www.hilscher.com
Important Information:
This e-mail message including its attachments contains confidential and legally
protected information solely intended for the addressee. If you are not the
intended addressee of this message, please contact the addresser immediately
and delete this message including its attachments. The unauthorized
dissemination, copying and change of this e-mail are strictly forbidden. The
addresser shall not be liable for the content of such changed e-mails.
Внимание:
Това електронно съобщение и прикачените към него файлове съдържат информация
предназначена единствено за неговите преки получатели. Ако вашият адрес не е в
списъка от получатели моля незабавно да изтриете това съобщение и прикачените
към него файлове като своевременно уведомите подателя. Копиране, промяна или
споделяне с трети лица на информацията представена в това съобщение без
изричното съгласие на автора е строго забранено.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel