Compile for ARM Cortex M3 using standard GCC?
Solution 1
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.
Solution 2
You can find an excellent series of tutorial style blog posts here, for example this one about bare metal programming for the M3.
Solution 3
CodeSourcery G++ supports a wide range of ARM processors including Cortex-M3. Its also free unless you need professional support.
Related videos on Youtube

Bojangles
Full stack web developer working with Node and React in Typescript and rather a lot of Rust.
Updated on May 16, 2022Comments
-
Bojangles 6 days
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?-
harvis almost 10 yearsYou can try this if you are using linux. eluaproject.net/doc/v0.8/en_tc_cortex.html
-
-
Bojangles over 11 yearsThanks. I wasn't aware it was free - thanks for the heads up!
-
old_timer over 11 yearswell there is a lite version, and you need to read the license agreement.
-
old_timer over 11 yearsllvm, though, cross compiles out of the box, you can use -march=arm to build for arm. Depends on what you are doing though
-
old_timer over 11 yearsthe 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.
-
Admin over 7 yearsAnd 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.
-
David Grayson over 4 yearsI 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