2020-08-12 12:42 PM
Does ofstringstream and stringstream not work with freeRTOS?
We develop a device using stm32f46x using touch GFX and freeRTOS. The system is generated with the latest STM32Cube IDE and the configuration tool. After crashes with localtime, new etc. I overloaded new and malloc first and later I used the suggested solution of David Nadler. Now the program crashed with hardfault (CFSR Register Content 0x1400 - stack fault) at every place where a std::ofstringstream or std::stringstream uses operator<<. Debugging seem to show sufficient stack and heap sizes. Always when "<<" is applied with data (not with precision()) a hardfault is thrown immdiately. While I had set breakpoint at the malloc and malloc_r wrappers, these functions are not called.
2020-08-12 12:48 PM
This may help: http://www.nadler.com/embedded/newlibAndFreeRTOS.html
2020-08-12 01:07 PM
What I mentioned with the use of the malloc and malloc_r wrappers is from your link. I used the recommended solution of David Nadler. It seems to work with some other parts but ostringstream does not. No malloc_lock in Nadler's heap_useNewlib_ST.c is not called.
Maybe the solution does not work for the precompiled lib provided by ST?
2020-08-14 12:16 PM
Now I solved it.
The main reason was that I had used the ostringstream in order to convert a floating point number into a string. Floating Pointer formating however is disabled in the compiler options by default. Using printf did also not work but there was a warning displayed in the editor: If one activates printf support, the ofstream::operator<<(float) works.
AT the same time there were two other problems which had also caused crashes. One was that after an update of the CubeMX has replaced IRQ 5 by IRQ 0 - there is another discussion about this. And the modification of malloc in combination with freeRTOS if one uses loaltime, std::string, ...
2023-11-24 04:13 PM
Hi
Im having same problem but im also kinda new to stm32. Could you tell what you exactly change with IRQ and malloc and where? Thanks