Hard Fault in the "Bfree" function (mprec.c).
Hello. Recently I have been trying to use NewLib-nano(from tool-chain in version 4.8 2014q2) with FreeRTOS(8.0.1).
To get NewLIb nano work with FreeRTOS I did everything according to article:
http://
so my malloc and free functions looks like these:
https:/
Additional, using flag "configUSE_
Every things looks to work ok. I have got 3 tasks running on the same priority and they are printing decimal values using printf and semihosting.
Everything is changing when I try to print floating point values. Program prints values correctly but from time to time it gets crash on printf.
After restarting program will crash on exactly the same printf call. But when I Copy it in different place it's executed correctly and correct float values are printed.
As I mention within one executable file the crash point is constant. Function printf call the _dtoa_r and it call Bfree function where program crashed.
I suspect that library is trying to call some allocator which is not correlated with _malloc_r function.
Corrupted print out instruction:
printf(
Result in the terminal:
"vSHT1X_
Debug information:
[Hard fault handler - all numbers in hex]
R0 = 0x200084ec
R1 = 0x00000001
R2 = 0x89080006
R3 = 0x20004c50
R12 = 0x8075b852
LR [R14] = 0x0801fc6f subroutine call return address
PC [R15] = 0x08020a78 program counter
PSR = 0x21000000
BFAR = 0x44204c68
CFSR = 0x00008200
HFSR = 0x40000000
DFSR = 0x00000001
AFSR = 0x00000000
SCB_SHCSR = 00000000
Where fault occurred: -> _Bfree
.text._Bfree 0x08020a56 0x2e c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/
.text.__multadd
Function which call the Bfree: -> _dtoa_r
.text._dtoa_r 0x0801fc30 0xb80 c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/
.text.__sflush_r
Any idea how to fix this issue?
Best Regards, Krzysztof
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Krzysztof Kawula for more information if necessary.