I have been working with a project on an NXP LPC11XX device and FreeRTOS. The issue is that the demo project for this uses some Eclipse based IDE and I wont have any of that. I got it converted to compile in linux and I can program without any issue. The problem I am seeing is when the demo project gets to a memset() a hard fault is generated in the CPU. This is not my code, but I have a feeling it is related to something that I did. I am using the codesourcery "gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188)" compiler (which I have used without issue on Cortex-M3 devices). I see the hardfault generated on a damn "lsls" instruction which touches nothing in memory, see this massive pastebin of GDB output: http://pastebin.com/3pg0puSe (I don't know what common practice is here for large blocks of text like that.)
Any thoughts, anyone? Thanks for the help!
Hard to see, but the last instruction was blx r3
.
It looks like R3 did not have its last bit set (for Thumb mode), its value is 0x481c
.
This will IIRC cause an illegal instruction exception. Your debugger fools you in this case, as the value loaded into the PC by blx
was probably invalid.
You might just forgot the linker option which sets the instruction mode/CPU model (and the set of libs to use) - so it linked against an ARM mode library.