1. Malloc() fails
That is understandable - microblaze control of heap that doesn't clear and ends up over-allocating. The heap and stack I normally leave as default to dlmb/ilmb when building a system from base system builder. Never tried assigning to another memory device. So basically its an EDK uBlaze issue. However, my end goal design is multi-microblaze and I haven't seen the malloc failed on reset of multi-microblaze running ImpC SW independently (just got that working yesterday) - but then again I probably need to run a numerous hard reset test to confirm it doesn't malloc fail on me. I've only done the hard reset about 5-6 times and didn't get any memory failure.
2. SYS_Rst
Yes I had SYS_Rst of my ImpC FSL HW peripheral connected to system_reset, and that's when the build error came into play. It could not find a port in the ImpC FSL HW VHDL to bind to system_reset. I just got confirmation of 2.20.f8 release to attempt to fix the FSL rst issue. I will give that a try and see if the build error occurs. But to get around that error before I go into the MPD file of the ImpC HW and remove the SYS_RST port.
3. HW stream macros
Your statement is correct. Here's my assumption: I am not sure what the settings are when a sample project is built, specifically heap settings in linker script. But building a software project from scratch and setting heap to 0x0 in linker script generation worked for me. I can probably narrow the issue down to the linker script. Maybe if I create the sample project when the system is built in base builder, then remove the files and add the ImpC SW file, go back into Generate Linker Script and generate a new linker script ensuring heap is set to 0x0. Now I know the question comes up why a setting for heap of 0x0. Well honestly, I don't know. It's something that stuck in my head after doing a random tutorial on building a software project in XPS. (Also, had to remove all stream open and close function calls in SW - design would not work with those included...go figure).
Hi Michael,
It sounds like the reset issue is the main problem, but several different things seem to be going on:
1. malloc() fails
If malloc() is failing only after several resets, I would think that the cause would be improper reset handling by the MicroBlaze processor, or some kind of stack corruption problem. The malloc() function is provided by the MicroBlaze's C library, and if it is maintaining heap state between resets somehow, that could cause the heap to be over-allocated and malloc() to fail. The Impulse C driver assumes that a hardware reset "frees" all memory on the heap.
Which memory have you assigned the heap to in the linker script? How large is it? Have you tried putting the heap in a different memory?
2. SYS_Rst not connected
Have you tried connecting this port manually to the system reset signal in XPS?
3. HW_STREAM macros not working if tutorial steps followed
Not sure if I'm stating this one correctly, but is it true that if you ask XPS to create the sample software project and then replace that project's source code with the Impulse-exported source code, the stream macros don't work, but they do if you create a software project from scratch? Or are you saying that it's just not necessary to use a generated sample project as a base in XPS?
We're testing a fix for the reset issue in the lab and hope to have a comprehensive fix soon.
Ralph