2021-01-14 08:57 AM
I'm trying to write code for an SNTP clock using the UTIL_LCD routines in the STM32H735G-DK firmware. I'm using lwIP and FreeRTOS for my implementation. I have the clock working with the LCD_TRACE display (the logging display that is used by the webserver demo.)
I've tried removing the LCD_Trace code and using UTIL_LCD_DisplayStringAt code.
The program crashes when FreeRTOS starts the kernel (the "SVC 0" crash).
I suspect I'm running out of memory. Unless there is a CRASH_NON_ST_CODE macro in the libraries, there's no other reasonable explanation.
I'm using the STM32Cube IDE. What's the best way to track memory? What special requirements are there for the UTIL_LCD routines? What's different between the LCD_Trace routines and UTIL_LCD? The version with LCD Trace works, but I change one line, it crashes.
2021-01-14 09:34 AM
Check the .LD file to see the available resources you give the Linker.
Review the .MAP file to see how the Linker allocated those resources.
Determine where your HEAP is an how it is being ALLOCATED. Write some code to walk the heap arena if that would be useful to know whats going on, likely a linked list, with nodes immediately in-front of the allocated addresses.
Make sure your STARTUP.S file does it's initialization job properly, if you've added multiple sections expect to have to unpack them.
Bring up external memory resources in SystemInit() BEFORE using them else where.
Have a Hard Fault Handler that output useful resources.
2021-01-14 12:57 PM
OK, thanks. I'm using most of these resources out of the box. Are there good tutorials from ST on this subject? It sounds like I need to see more than my debugger can give me. Even something to tell me the heap allocations from step to step would be helpful.
2021-01-14 01:30 PM
>> I'm using most of these resources out of the box.
GNU, you've got the roughest pick of lumber in the yard. Most of this stuff is thrown together quickly, that it can support it's own weight is about all you can hope for.
>> Are there good tutorials from ST on this subject?
I'm a datasheet, docs and source guy, learned my tradecraft decades ago, so probably not the right guy to ask. ST's been pushing videos and MOOC in recent times, and the concept you can press a button and magic will happen.