Skip to main content
BengofEtech
Associate III
January 21, 2020
Question

C Standard Library not working on STM32H7

  • January 21, 2020
  • 7 replies
  • 2025 views

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

This topic has been closed for replies.

7 replies

Ozone
Principal
January 21, 2020

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
January 21, 2020

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
January 21, 2020

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.

Tesla DeLorean
Guru
January 21, 2020

Are we sure strtok() is even thread safe?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
BengofEtech
Associate III
January 21, 2020

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
Associate III
January 21, 2020

Could even reproduce it in a new empty CubeMx created project

waclawek.jan
Super User
January 21, 2020

Specify "fail".

JW

BengofEtech
Associate III
January 21, 2020

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.

Dave Nadler
Senior III
January 21, 2020

@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...