Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HardFault strtok() #45

Closed
Ivanchenko59 opened this issue Aug 14, 2022 · 1 comment
Closed

HardFault strtok() #45

Ivanchenko59 opened this issue Aug 14, 2022 · 1 comment

Comments

@Ivanchenko59
Copy link
Contributor

Hello,
I encountered a hardfault error caused after executing strtok() from gsm_msg_read() function. strtok() is not thread-safe and since I'm using FreeRTOS this could be a problem. I was able to fix this by using strtok_r() instead of strtok(). And later, I used the custom function strtok() and it didn't cause any problems either. I also thought that this could be due to the lack of heap allocated for the task, but it seems that increasing the heap did not help me.
I don't fully understand the cause of the problem, so my solution was to use the self-written strtok() function.
It would be interesting to know if someone has come across this, or maybe my solution will help someone.
My setup: stm32F401, FreeRTOS, task heap 512 (also tried 1024).

@nimaltd
Copy link
Owner

nimaltd commented Aug 16, 2022

Hello, please increase your heap and stack. atleast 0x800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants