Re: Debugging NRF51822 (OpenOCD + GDB)


Scott Nelson <scott@...>
 

Thanks everyone! Learning a lot here.

Here’s what I get:

$ arm-none-eabi-addr2line -f -e outdir/nrf51_blenano/zephyr.elf 0xbc76
radio_event_adv_prepare.part.31
errno.c:?

I tried disassembling the object file that contains the radio_event_adv_prepare function:

$ arm-none-eabi-objdump -z -S outdir/nrf51_blenano/subsys/bluetooth/controller/ll_sw/ctrl.o

I didn’t see 0xbc76 in there though. Here’s the output for that section:

00000000 <radio_event_adv_prepare>:
0: b57f push {r0, r1, r2, r3, r4, r5, r6, lr}
__ASM volatile ("sev");
2: 4c0b ldr r4, [pc, #44] ; (30 <radio_event_adv_prepare+0x30>)
__ASM volatile ("wfe");
4: 7b25 ldrb r5, [r4, #12]
6: b2ed uxtb r5, r5
*((u32_t volatile *)ops_context) = status;
8: 2d00 cmp r5, #0
}
a: d001 beq.n 10 <radio_event_adv_prepare+0x10>
if (status == 0) {
c: f7ff fffe bl 0 <radio_event_adv_prepare>
hdr->ticks_xtal_to_start |= ((u32_t)1 << 31);
10: 2605 movs r6, #5
12: 0023 movs r3, r4
14: 0022 movs r2, r4
16: 7326 strb r6, [r4, #12]
18: 9503 str r5, [sp, #12]
}
1a: 4d06 ldr r5, [pc, #24] ; (34 <radio_event_adv_prepare+0x34>)
if (status == 0) {
1c: 9601 str r6, [sp, #4]
1e: 9502 str r5, [sp, #8]
hdr->ticks_xtal_to_start &= ~((u32_t)1 << 31);
20: 69e4 ldr r4, [r4, #28]
22: 3318 adds r3, #24
24: 3214 adds r2, #20
26: 9400 str r4, [sp, #0]
}
28: f7ff fffe bl 0 <radio_event_adv_prepare>
{
2c: bd7f pop {r0, r1, r2, r3, r4, r5, r6, pc}
2e: 46c0 nop ; (mov r8, r8)
if (bite & 0x01) {
30: 00000000 .word 0x00000000
while (byte_count--) {
34: 00000000 .word 0x00000000

When I manually looked through the zephyr.map file I found this:

.text.event_scan_prepare.part.32
0x000000000000bc70 0x6 subsys/built-in.o
*fill* 0x000000000000bc76 0x2

It now seems clear to me that the fault is BLE related but I’m not sure how to find the exact line or cause. Thanks again for your ongoing help and patience!

-Scott

On Aug 24, 2017, at 12:25 PM, Boie, Andrew P <andrew.p.boie@intel.com> wrote:

OK, I finally was able to catch the fault while I had a serial console connected
and here’s what I saw:

***** HARD FAULT *****
Executing thread ID (thread): 0x20001908
Faulting instruction address: 0xbc76

What do I do with that info? Is there a way to determine what code
corresponds to that address?
Yes, the addr2line tool will show you this, if you run it on the zephyr.elf binary.
https://sourceware.org/binutils/docs/binutils/addr2line.html

Andrew

Join users@lists.zephyrproject.org to automatically receive all group messages.