Forum Discussion
Hi,
As i said in the original post, the problem i am facing is that malloc in the memtest.c is going out of the SRAM region and the memory transfers fail.
Below is the line of C-code:
ram_loc = (void*)alt_uncached_malloc (memory_size) ;
memory_base = (int) &ram_loc ;
Fixed Location code (alternatively if i use fixed memory locations within the SRAM region the entire test completes the intended memory and DMA transfers):
memory_base = 0x21c700 ;
memory_end = 0x21cf00 ;
I am also attaching the two logs one using the malloc code(that fails at address outside the SRAM region)
# Memory Test Main Menu
# a: Test RAM
#
# Testing RAM from 0x21FFD0 to 0x2203D0
# -Data bus test passed
# Break key hit
# Simulation stop requested.
-Address bus test failed at address 0x220010# End time: 13:50:26 on Nov 13,2018, Elapsed time: 0:24:23
# Errors: 0, Warnings: 87
and also one with fixed address (all memory test and DMA transfers complete).
# Memory Test Main Menu
# a: Test RAM
#
# Testing RAM from 0x21C700 to 0x21CF00
# -Data bus test passed
# -Address bus test passed
# -Byte and half-word access test passed
# -Testing each bit in memory device. passed
# -Testing memory using DMA.
# Source Address:0x206818 Destination Address:0x206A20
# DMA transfer Src2Mem Done starting At:0x21C700
# DMA transfer Mem2Dest Done starting At:0x21C700
# DMA transfer Src2Mem Done starting At:0x21C900
# DMA transfer Mem2Dest Done starting At:0x21C900
# DMA transfer Src2Mem Done starting At:0x21CB00
# DMA transfer Mem2Dest Done starting At:0x21CB00
# DMA transfer Src2Mem Done starting At:0x21CD00
# DMA transfer Mem2Dest Done starting At:0x21CD00
# passed
# Memory at 0x21C700 Okay
#
I have just added more print statments in the C-code to get these messages in the transcript.
Also attaching the memory map as seen in the summary.html of the entire system that i am currently using for the simulation in modelsim.
Question:
*How to restrict the malloc function to use free locations (that are not used by the boot code and rest of the main C code) in the SRAM region only* Or is there any other alternatives?