nimaltd / gsm_v5

gsm module library for STM32 LL
GNU General Public License v3.0
232 stars 86 forks source link

HardFault strtok() #45

Closed Ivanchenko59 closed 1 year ago

Ivanchenko59 commented 2 years ago

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 commented 2 years ago

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