Hi,
We encountered an issue on the M4F core, that it will have some exact values at the following addresses after initialized with 'sbl_null.release.hs_fs.tiimage' bootloader:
- Adress 0x400: BF30BF30
- Adress 0xFFC: 0001F2D8
I checked in our hardware and on the sk board as well, that these values will always be present at these addresses.
I noticed that, because our firmware runs into 'hwip_undefined_handler_exceprion' in one part of a function in some builds, in other builds in another segment of the same function.
It helps when the mentioned code segment is further in the memory, but that is not the desired solution, because we are not sure about what the exact cause of the issue.
For some reason makeing the char buffers larger in the function also helped, but that raises the question 'why', because those should be created in the stack memory and have nothing to do in the program memory.
Our linker.cmd matches the hello_worls projects linker file, but I still notice that the .sysmem heap segment is usually linked after the .text codesegment in our case, while in the example it becames the first segment from 0x200-0x8200, but as I understand, that shouldn't cause this issue.
In the example I also notice the first value at 0x400 present, when that memory is allocated for the heap, as well in our case if that segment is unallocated.
Can you suggest any ida what can cause the issue, that our code sometimes runs into handlerfault near address 0xFFC, and why are these values are always set inside the mentioned memory areas?
The mentioned segments assemply code:
00000ff8: 980A ldr r0, [r13, #0x28] 00000ffa: F44F7180 mov.w r1, #0x100 00000ffe: F006FEB7 bl PromPrint 00001002: E7FF b #0x1004 00001004: F89D02FF ldrb.w r0, [r13, #0x2ff] 00001008: 07C0 lsls r0, r0, #0x1f 0000100a: B1C8 cbz r0, #0x1040 0000100c: E7FF b #0x100e
Function PromPrint jumps to 0x7d70 now, and it works, but It the crash happens none of that code executes, because it alwazs crashes on address 0xFF(x).
I also noticed that if I try to go trough that function with debugger, I can only follow trough that code section in the assembly view.
Our Debug.map file output:
******************************************************************************
TI ARM Clang Linker PC v2.1.3
******************************************************************************
>> Linked Fri Jul 7 13:31:14 2023
OUTPUT FILE NAME: <SAF.out>
ENTRY POINT SYMBOL: "_c_int00" address: 0000e7ab
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
M4F_VECS 00000000 00000200 00000140 000000c0 RWIX
M4F_IRAM 00000200 0002fe00 0001d2d8 00012b28 RWIX
M4F_DRAM 00030000 00010000 00003440 0000cbc0 RWIX
PP_SOM_SHM_MEM 701c0000 00000100 000000bc 00000044 RWIX
PP_BASE_SHM_MEM 701c0100 00000100 00000000 00000100 RWIX
EC_PDO_SHM_MEM 701c0200 00000200 00000000 00000200 RWIX
EC_SDO_SHM_MEM 701c0400 0000fc00 00000000 0000fc00 RWIX
LOG_SHM_MEM 701d0000 00004000 00000000 00004000 RWIX
RTOS_NORTOS_IPC_SHM_M 701d4000 0000b000 00000000 0000b000 RWIX
USER_IPC_SHM_MEM1 701df000 00000100 00000000 00000100 RWIX
USER_IPC_SHM_MEM2 701df100 00000100 00000000 00000100 RWIX
USER_IPC_SHM_MEM3 701df200 00000100 00000000 00000100 RWIX
USER_IPC_SHM_MEM4 701df300 00000400 00000000 00000400 RWIX
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 00000140 00000140 rw-
00000000 00000000 00000140 00000140 rw- .vectors
00000200 00000200 000102d8 000102d8 r-x
00000200 00000200 000102d8 000102d8 r-x .text
000104d8 000104d8 0000d000 00000000 rw-
000104d8 000104d8 00008000 00000000 rw- .sysmem
000184d8 000184d8 00005000 00000000 rw- .stack
00030000 00030000 00001a50 00001a50 r--
00030000 00030000 00001a50 00001a50 r-- .rodata
00031a50 00031a50 00001600 00000000 rw-
00031a50 00031a50 00001600 00000000 rw- .bss
00033050 00033050 000003f0 000003f0 rw-
00033050 00033050 000003f0 000003f0 rw- .data
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
.vectors 0 00000000 00000140
00000000 00000140 nortos.am64x.m4f.ti-arm-clang.debug.lib : HwiP_armv7m_handlers_nortos.obj (.vectors)
.text 0 00000200 000102d8
00000200 00000e4c first object
0000104c 00000c00 second object
...
Example Debug.map file:
******************************************************************************
TI ARM Clang Linker PC v2.1.3
******************************************************************************
>> Linked Fri Jul 7 11:09:50 2023
OUTPUT FILE NAME: <hello_world_am64x-sk_m4fss0-0_nortos_ti-arm-clang.out>
ENTRY POINT SYMBOL: "_c_int00" address: 0000e99b
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
M4F_VECS 00000000 00000200 00000140 000000c0 RWIX
M4F_IRAM 00000200 0002fe00 00013b10 0001c2f0 RWIX
M4F_DRAM 00030000 00010000 000010a0 0000ef60 RWIX
USER_SHM_MEM 701d0000 00000080 00000000 00000080 RWIX
LOG_SHM_MEM 701d0080 00003f80 00000000 00003f80 RWIX
IPC_VRING_MEM 701d4000 0000c000 00000000 0000c000 RWIX
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 00000140 00000140 rw-
00000000 00000000 00000140 00000140 rw- .vectors
00000200 00000200 00008000 00000000 rw-
00000200 00000200 00008000 00000000 rw- .sysmem
00008200 00008200 00007b10 00007b10 r-x
00008200 00008200 00007b10 00007b10 r-x .text
0000fd10 0000fd10 00004000 00000000 rw-
0000fd10 0000fd10 00004000 00000000 rw- .stack
00030000 00030000 00000708 00000000 rw-
00030000 00030000 00000708 00000000 rw- .bss
00030708 00030708 000005d8 000005d8 r--
00030708 00030708 000005d8 000005d8 r-- .rodata
00030ce0 00030ce0 000003c0 000003c0 rw-
00030ce0 00030ce0 000003c0 000003c0 rw- .data
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
.vectors 0 00000000 00000140
00000000 00000140 nortos.am64x.m4f.ti-arm-clang.debug.lib : HwiP_armv7m_handlers_nortos.obj (.vectors)
.sysmem 0 00000200 00008000 UNINITIALIZED
00000200 00000010 libc.a : memory.c.obj (.sysmem)
00000210 00007ff0 --HOLE--
.text 0 00008200 00007b10
00008200 00000a30 nortos.am64x.m4f.ti-arm-clang.debug.lib : printf.obj (.text._vsnprintf)
00008c30 00000640 : printf.obj (.text._etoa)
00009270 00000580 : printf.obj (.text._ftoa)
000097f0 000004a8 : HwiP_armv7m.obj (.text.hwi)
00009c98 000002da drivers.am64x.m4f.ti-arm-clang.debug.lib : sciclient.obj (.text.Sciclient_service)
00009f72 00000286 : uart_v0.obj (.text.UART_open)
0000a1f8 00000242 : uart_v0.obj (.text.UART_fifoConfig)
Edit:
I managed to run into it again, and the disassembly shows me this code:
00000ff2: 9A1B ldr r2, [r13, #0x6c]
00000ff4: 991C ldr r1, [r13, #0x70]
00000ff6: 981D ldr r0, [r13, #0x74]
00000ff8: F8B230B0 ldrh.w r3, [r2, #0xb0]
00000ffc: C850 ldm r0!, {r4, r6}
00000ffe: 0001 movs r1, r0
00001000: 46EC mov r12, r13
00001002: F8CC2000 str.w r2, [r12]
00001006: F640127A movw r2, #0x97a
0000100a: F2C00203 movt r2, #3
Where the exception is thrown at 0x0ffc.
The memory of that area:
0x00000FE0 F8CCE004 F6402000 F2C01238 F00E0203 9A1BF9FB 981D991C 30B0F8B2
0x00000FFC 0001C850 F8CC46EC F6402000 F2C0127A F00E0203 E7FFF9EB 0308F89D
0x00001018 B19007C0 F64CE7FF F2C02023 F2400000 F2C042A9 21000203 F00E9109
0x00001034 9809F9D9 7180F44F FE9DF006
The registers state that cause it to happen:

The registers state after the exception occures:

In the second time it occures in another part of the function altaugh that function was not changed, but it happens in the exact same memory area always.












