This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWI driver reading out of bounds memory. "Can't compute CFA for this frame."

On a custom board using the nRF51822, with SDK 11.0.0, SD s130 and gcc, I'm seeing the following stack trace when doing some TWI operations to program an accelerometer:

(gdb) bt full
#0  0x0002d29e in nrf_twi_event_clear (p_twi=<error reading variable: Cannot access memory at address 0x20007ddc>, event=<error reading variable: Cannot access memory at address 0x20007dda>)
    at /Users/Eliot/dev/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twi.h:300
No locals.
#1  0x0002d852 in twi_transfer (p_twi=<error reading variable: can't compute CFA for this frame>, p_error=<error reading variable: can't compute CFA for this frame>, 
    p_bytes_transferred=<error reading variable: can't compute CFA for this frame>, p_data=<error reading variable: can't compute CFA for this frame>, 
    length=<error reading variable: can't compute CFA for this frame>, no_stop=<error reading variable: can't compute CFA for this frame>)
    at /Users/Eliot/dev/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.c:370
        do_stop_check = <error reading variable do_stop_check (can't compute CFA for this frame)>

The address 0x20007dda is well out of bounds for me. Here's the bit of my .Map file that shows where my stack ends:

 COMMON         0x0000000020003b84       0x78 _build/SEGGER_RTT.o
                0x0000000020003b84                _SEGGER_RTT
                0x0000000020003bfc                . = ALIGN (0x4)
                0x0000000020003bfc                __bss_end__ = .

.heap           0x0000000020003c00        0x0
                0x0000000020003c00                __end__ = .
                0x0000000020003c00                PROVIDE (end, .)
 *(.heap*)
 .heap          0x0000000020003c00        0x0 _build/gcc_startup_nrf51.os
                0x0000000020003c00                __HeapLimit = .

.stack_dummy    0x0000000020003c00      0x800
 *(.stack*)
 .stack         0x0000000020003c00      0x800 _build/gcc_startup_nrf51.os
                0x0000000020008000                __StackTop = (ORIGIN (RAM) + 0x6008)
                0x0000000020007800                __StackLimit = (__StackTop - SIZEOF (.stack_dummy))
                0x0000000020008000                PROVIDE (__stack, __StackTop)
                0x0000000000000001                ASSERT ((__StackLimit >= __HeapLimit), region RAM overflowed with stack)
OUTPUT(_build/biketracker_app_s130.elf elf32-littlearm)

Any ideas?

Related