2008-06-25 06:45 PM
string operations
2011-05-17 03:37 AM
Hi.
I am experiencing some problems with my cortex m3. Every time I want to use any string operation like strcpy, strcmp or memcpy my Programm jumps into the HardFaultException. Is there something that I am overlooking? Everything else works so far. Meaning communication over UART with Interrupts running quite fine for instance... I have to admit, I am somewhat unexperienced with ARM Controllers. Would be great if somebody can help. [ This message was edited by: intrinsor on 18-06-2008 15:56 ]2011-05-17 03:37 AM
what tools are you using e.g compiler, IDE, debugger etc? Check that your not running out of stack space i.e. increase the stack size and seeif the problem goes away.
2011-05-17 03:37 AM
I am using the codesourcery arm-2008q1 toolchain (arm-none-eabi), openocd and gdb as debugger with the ddd frontend.
As basic framework for my code I am using the STM V2.0 Firmware. Changing the stack is the next thing I will try.2011-05-17 03:37 AM
You are being careful to ensure that all your input strings have a proper NUL terminator, and all your output buffers are sufficiently large...?
2011-05-17 03:37 AM
Yes, I am sure that these parameters are correct. Unfortunately I couldn't check the stack size today - I have to do that the next day.
Next thing that seems odd is that I can't initialize chars like :char temp[10]=''hello''; as local variables in any function like main etc. I get an HardFaultException in that case. I can however declare the variable like: char temp[10]; locally.2011-05-17 03:37 AM
Stack size increasing brings nothing unfortunately.
Has anybody encountered problems like these?2011-05-17 03:37 AM
We've all used ''string handling'' functions for years with simpler micros of the past. Understand your need and frustration.
Wonder if STM V2.0 fw may be ''too new'' for codesourcery? The abundance of tools is not always our friend... Perhaps you could try V1 and see if fault continues. If your problem persists I'll run several string handlers under IAR and confirm that it works. Sometimes we can glean a hint from other's success.2011-05-17 03:37 AM
Hi STM32 fans :)
Be aware of this post : about strings usage with IAR , Here is attached the patch. It is clearly linked to the Compiler librairies, so I presume that in GNU codesourcery has the same case may be. Hope this helps you :) Cheers, STOne-32.2011-05-17 03:37 AM
Quote:
On 19-06-2008 at 00:28, Anonymous wrote: Next thing that seems odd is that I can't initialize chars like :char temp[10]=''hello''; as local variables in any function like main etc. I get an HardFaultException in that case. I can however declare the variable like: char temp[10]; locally. To initialize a variable like this, the compiler places a memcpy() to copy the read only data (''hello'') into the local variable that is on the stack.