This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137 could not read LwIP unaligned struct from SDRAM on HDK

Other Parts Discussed in Thread: TMS570LS3137

Dear colleagues,

I have an issue with running LwIP stack version 1.4.1 on TMS570LS3137 HDK rev. E. I took and modified LwIP example provided by TI. It runs without problem if is linked in to internal SRAM. It falls (abort exception PC 0x10) if it runs from external SDRAM. I think it caused by unaligned access via EMIF controller. For debugger info see below.

I use GCC compiler version 4.8.3. and CCS v6.

ASM dump. Second LDR instruction causes the fall.

384         ip_addr_copy(current_iphdr_dest, iphdr->dest);
000c38cc:   E51B3008 LDR             R3, [R11, #--8]
000c38d0:   E5932010 LDR             R2, [R3, #16]


Register's values:

R2	0x00000105	General Purpose Register 2 [Core]
R3	0x8001091E	General Purpose Register 3 [Core]	
R11	0x0803FC6C	General Purpose Register 11 [Core]	

# 
# System failure: data abort exception (SFC_ABORT)
# 
#  failcode: 00000001  subcode: 00000001    param: 00000000    flags: 00000002
# 
| ESM (error signaling module):
| 
|       sr1: 40000000      sr2: 00000000      sr3: 00000000      sr4: 00000000
|      epsr: 00000001     ssr2: 00000000
| 
| CP15 (system control coprocessor):
| 
|     sctlr: 8BE50878    actlr: 0E0000A7   sactlr: 00010002     cflr: 01000003
|      dfsr: 00000001    adfsr: 00800000     dfar: 8001092E
|      ifsr: 00000000    aifsr: 00000000     ifar: 00000000
| 
| EFC (eFuse controller):
| 
|     error: 00000000    bound: 0000200F     pins: 000082E0
| 
| TCRAM1 (tightly-coupled RAM):
| 
|   ramctrl: 0005000A  thrshld: 00000001  errstat: 00000000
|   cerrcnt: 00000000 cerraddr: 00000000 uerraddr: 00000010 perraddr: 00617150
| 
| TCRAM2 (tightly-coupled RAM):
| 
|   ramctrl: 0005000A  thrshld: 00000001  errstat: 00000000
|   cerrcnt: 00000000 cerraddr: 00000008 uerraddr: 00000018 perraddr: 00636200
| 
| FMC (flash module controller):
| 
|  fedacsts: 00000000 eedacsts: 00000000
|    fcecnt: 00000000  fceaddr: 00000000   fcepos: 00000000  fueaddr: 00000010
|    ececnt: 00000000  eceaddr: 00000000   ecepos: 00000000  eueaddr: 00000000
| 
| 
# system halted ...

I spent whole day by searching a solution. A change ETH_PAD_SIZE to 2 doesn't work. It generates incorrect ethernet frames. A modification of the packing macros for GCC tools in cc.h did not help as well.

Thak you for some reply and have a nice day.

  • I solved this problem.

    There are two possible solution suitable for me:

    • to reallocate offended part of the memory in to internal SRAM or
    • to write own exception handler which makes correct instruction call.

    I reallocated memory pool to internal SRAM as it is described in memp.c.

    extern u8_t __attribute__((section(".onchip_mem"))) memp_memory_UDP_PCB_base[];

    I found generated names of memp_memory_ variables by gcc objdump and put them in a new section located in SRAM.

    extern u8_t __attribute__((section(".memp"))) memp_memory_UDP_PCB_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_TCP_PCB_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_TCP_PCB_LISTEN_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_TCP_SEG_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_REASSDATA_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_FRAG_PBUF_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_SYS_TIMEOUT_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_PBUF_base[];
    extern u8_t __attribute__((section(".memp"))) memp_memory_PBUF_POOL_base[];

  • Thank you for posting this Matous