10

Is it possible to compile C/C++ code for the ARM Cortex M3 (LPC1768) using vanilla GCC with the --target switch, or will I need to compile GCC, binutils, etc to do this?

1

3 Answers 3

10

As already said, those are not your only two options. I suggest trying this toolchain prepared by ARM engineers: GNU Tools for ARM Embedded Processors . It's specifically tailored for Cortex-M and Cortex-R cores, and it doesn't require registration to download it.

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

1 Comment

I find the new download page for this toolchain to be much easier to use, and it gives me more peace of mind knowing it comes from arm.com: developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
4

You can find an excellent series of tutorial style blog posts here, for example this one about bare metal programming for the M3.

Comments

3

CodeSourcery G++ supports a wide range of ARM processors including Cortex-M3. Its also free unless you need professional support.

4 Comments

well there is a lite version, and you need to read the license agreement.
llvm, though, cross compiles out of the box, you can use -march=arm to build for arm. Depends on what you are doing though
the cortex-m3 is thumb/thumb2 only so be careful to specify the processor type when compiling (with gcc), otherwise it will default to arm instructions. and my comment about llvm -march=arm will build arm it might be -march=thumb to build for thumb.
And make sure you do not specify -mthumb-interwork when you compile for Cortex-M, otherwise you will get ARM32 code in there, which your MCU will not understand, thus your program will crash.

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.