cancel
Showing results for 
Search instead for 
Did you mean: 

C Standard Library not working on STM32H7

BengofEtech
Associate III

Hello,

we switched from a STM32F7 to a STM32H7, porting the program to it.

I disabled D Cache, because it wouldnt work together with the ethernet. Now we got another Problem:

-Some Funtions of the STL are working, others are not. For example mmcpy or memset is fine, TIME, localtime or Strtok is not or only partly working.

Anyone experienced this?

edit: using gcc and cubeide

9 REPLIES 9
Ozone
Lead II

IDEs use to have architecture-specific versions of each library. Perhaps alignment or stack size issues ?

To be honest, I haven't worked with a H7 yet. And neither with CubeIDE.

berendi
Principal

Both MCUs have the same CPU core, and strtok() has no system specific code. If it has stopped working, then something is corrupting memory.

BengofEtech
Associate III

Okay i got the problem. but no solution its a freertos thing.

This functions only fail, when called out of a task, in initialization they work fine.

BengofEtech
Associate III

Could even reproduce it in a new empty CubeMx created project

Specify "fail".

JW

BengofEtech
Associate III

for example malloc wont provide memory, so the pointer gets set to NULL, strtok only provides the first tokenized stringt. Calling localtime(&time) will simply produce a hardfault.

Are we sure strtok() is even thread safe?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

its not, like malloc and free, but in the "real" application they are guarded. The problem occurs even with a single task running at highest priority and not getting preempted

@BengofEtech​ - Please see my web page below explaining your problem and how to fix it:

http://www.nadler.com/embedded/newlibAndFreeRTOS.html

Best Regards, Dave

@Markus GIRDLAND​ , @Camilo LEMOS​:

This is approximately the 25th thread from an ST customer impacted by this problem.

I provided ST with the solution last July...