1

I'm trying to build and run some project from 3rd party sources for bare-metal(no OS)ARM Cortex M3.

I build it with arm-none-eabi-gcc(success) with newlib.

I run it under simulator of TI Code Composer Studio.

The problem:

When I run it, it fails into hard fault (entering into corresponding ISR) on the first call to the runtime library function

Till now I sow it failing on calls to memmove or memcpy. When tracing the disassembly I see that it fails exactly on the instruction

BLX memset

The question: What can cause the fault and how to debug it ???

4
  • 1
    Are you using both ARM and Thumb? 'BLX label' calls the label, (using link register for return address), and changes to Thumb mode. Are you linking with the correct version of the library? Commented Jun 6, 2013 at 8:22
  • These are good questions. I compile with the following options: -mcpu=cortex-m3 -mthumb. And for the linker - I don't specify any options regarding the library, how can I know/check that the library is ok ? Commented Jun 6, 2013 at 8:29
  • there are usually ARM and Thumb versions of the library. I do not know your build system, so I don't know the correct options. ARM/Thumb interop is a bit 'hairy', expecially with interrupt-handlers that must run in ARM mode. It's just very suspicious that the fail occurs on a branch that causes a switch to Thumb mode - maybe it's then prefetching an illegal ARM instruction, something like that? Commented Jun 6, 2013 at 9:37
  • You're totally right, I found the problem and fixed it. If you could place your comment as an answer I would accept it. I just forgot to specify for linker the -mcpu as I did for the compiler. Now it's ok and the instruction is BL now. Thank you. Commented Jun 6, 2013 at 9:45

1 Answer 1

2

Are you using both ARM and Thumb? 'BLX label' calls the label, (using link register for return address), and changes to Thumb mode. Are you linking with the correct version of the library?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.