Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hello,
I've developed a basic bare metal application on c7x making use of tisp to test the hardware and develop our algorithms. This has been working fine, but now I need to implement IPC with the linux host and it seems that requires FreeRTOS, even though I would prefer to stay bare metal. (The library is missing for NoRTOS)
To move to RTOS, the first step I take is to include the library, which because of the entry point requires me to change the linker file to include some stuff for MMU and BSS. I use a reference from an example. The FreeRTOS entry point seems to have some dependency on MMU configuration from ti_dpl_config.c, generated by sysconfig. So I include that file as well
With these changes in place, my project builds again, and the main function runs as before, but TISP, in particular the use of the DRU, is broken. The loop checking for completion of the transfer now hangs forever.
In particular, this line of DmaUtilsAutoInc3d_wait() hangs forever:
while ((eflRegisterVal & waitWord) != waitWord) {
Nothing in my main function has changed - the only change is the addition of FreeRTOS library and the adjustment of the entry point, and associated linker changes. For reference, here is my old linker file:
-heap 0xF0000 // 756 kB -stack 0x4000 // 16 kB --cinit_compression=off --args 0x1000 --diag_suppress=10068 // "no matching section" MEMORY { L2SRAM_CINIT (RWX) : org = 0x7E000000, len = 0x000100 //for 256byte init c7x_0 = 7E000000, c7x_1 = 7E200000 L2SRAM (RWX) : org = 0x7E000100, len = 0x1fff00 //for 2MBytes EL2 L2SRAMAUX (RWX): org = 0x7F000000, len = 0x040000 // for 256 KBytes J7AEN c7x_0 = 7F000000, c7x_1 = 7F800000 EXTMEM_STATIC (RWX): org = 0x80000000, len = 0x4000000 EXTMEM (RWX): org = 0x84000000, len = 0x200000 } SECTIONS { .sram_start START(_sram_start) > L2SRAM NOINIT // .kernel: { // *.obj (.text:optimized) { SIZE(_kernel_size) } // } > EXTMEM // .kernel_data SIZE(_data_size) .l2mem > L2SRAM .l1dmemory > L2SRAM .l2dmemory > L2SRAM .text: > L2SRAM .text:touch: > L2SRAM .text:_c_int00: > L2SRAM_CINIT .neardata: > L2SRAM .rodata: > L2SRAM .bss: > L2SRAM .init_array: > L2SRAM .far: > L2SRAM .fardata: > L2SRAM .neardata > L2SRAM .rodata > L2SRAM .data: > L2SRAM .switch: > L2SRAM .args: > L2SRAM align = 0x4, fill = 0 {_argsize = 0x200; } .sysmem: > L2SRAM .cinit: > EXTMEM .const: > L2SRAM START(const_start) SIZE(const_size) .pinit: > L2SRAM .cio: > L2SRAM .stack: > L2SRAM .ddrData > EXTMEM_STATIC .staticData > EXTMEM_STATIC .l2sramaux > L2SRAMAUX xdc.meta: > L2SRAM, type = COPY }
And here is the new linker file. It's basically straight from an example, but I've enlarged the heap and moved most of the local program data to SRAM
--ram_model -heap 0x20000 -stack 0x20000 --args 0x1000 --diag_suppress=10068 /* to suppress no matching section error */ --cinit_compression=off -e _c_int00_secure #define DDR0_ALLOCATED_START 0xA3000000 #define C7X_ALLOCATED_START DDR0_ALLOCATED_START #define C7X_RESOURCE_TABLE_BASE (C7X_ALLOCATED_START + 0x00100000) #define C7X_IPC_TRACE_BUFFER (C7X_ALLOCATED_START + 0x00100400) #define C7X_BOOT_BASE (C7X_ALLOCATED_START + 0x00200000) #define C7X_VECTOR_BASE (C7X_ALLOCATED_START + 0x00400000) #define C7X_DDR_SPACE_BASE (C7X_ALLOCATED_START + 0x00410000) MEMORY { L2SRAM (RWX): org = 0x7E000000, len = 0x200000 DDR0_RESERVED: org = 0x80000000, len = 0x19800000 /* Reserved for A53 OS */ C7X_IPC_D: org = C7X_ALLOCATED_START, len = 0x00100000 /* 1MB DDR */ C7X_BOOT_D: org = C7X_BOOT_BASE, len = 0x400 /* 1024B DDR */ C7X_VECS_D: org = C7X_VECTOR_BASE, len = 0x4000 /* 16KB DDR */ C7X_CIO_MEM: org = C7X_DDR_SPACE_BASE, len = 0x1000 /* 4KB */ C7X_DDR_SPACE: org = C7X_DDR_SPACE_BASE+0x1000, len = 0x00BF0000-0x1000 /* 11.9MB - 4KB DDR */ /* For resource table */ C7X_RT_D: org = C7X_RESOURCE_TABLE_BASE, len = 0x400 /* 1024B DDR */ /* IPC trace buffer */ LINUX_IPC_TRACE_BUFFER: org = C7X_IPC_TRACE_BUFFER, len = 0xFFC00 /* 1023KB DDR */ LOG_SHM_MEM : ORIGIN = 0xA7000000, LENGTH = 0x40000 /* Shared memory for RTOS NORTOS IPC */ RTOS_NORTOS_IPC_SHM_MEM: org = 0xA5000000, len = 0x1C00000 /* 8MB DDR */ } SECTIONS { boot: { boot.*<boot.oe71>(.text) } load > C7X_BOOT_D .vecs > C7X_VECS_D .secure_vecs > C7X_DDR_SPACE ALIGN(0x100000) .text:_c_int00_secure > C7X_DDR_SPACE ALIGN(0x200000) .text > C7X_DDR_SPACE ALIGN(0x100000) .bss > L2SRAM /* Zero-initialized data */ RUN_START(__BSS_START) RUN_END(__BSS_END) .l2mem > L2SRAM .ddrData > C7X_DDR_SPACE .data > L2SRAM /* Initialized data */ .cinit > L2SRAM /* could be part of const */ .init_array > L2SRAM /* C++ initializations */ .stack > L2SRAM ALIGN(0x2000) .args > L2SRAM .cio > C7X_CIO_MEM .const > L2SRAM .switch > L2SRAM /* For exception handling. */ .sysmem > L2SRAM /* heap */ GROUP: > C7X_DDR_SPACE { .data.Mmu_tableArray : type=NOINIT .data.Mmu_tableArraySlot : type=NOINIT .data.Mmu_level1Table : type=NOINIT .data.gMmu_tableArray_NS : type=NOINIT .data.Mmu_tableArraySlot_NS : type=NOINIT .data.Mmu_level1Table_NS : type=NOINIT } .benchmark_buffer: > C7X_DDR_SPACE ALIGN (32) /* This is the resource table used by linux to know where the IPC "VRINGs" are located */ .resource_table: { __RESOURCE_TABLE = .;} > C7X_RT_D /* This IPC log can be viewed via ROV in CCS and when linux is enabled, this log can also be viewed via linux debugfs */ .bss.debug_mem_trace_buf : {} palign(128) > LINUX_IPC_TRACE_BUFFER /* this is used when Debug log's to shared memory is enabled, else this is not used */ .bss.log_shared_mem (NOLOAD) : {} > LOG_SHM_MEM /* this is used only when IPC RPMessage is enabled */ .bss.ipc_vring_mem (NOLOAD) : {} > RTOS_NORTOS_IPC_SHM_MEM }
My only guess is this could be related to the MMU, but I don't know. Any help is appreciated.