Compile for ARM Cortex M3 using standard GCC?

14,479

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.

Share:
14,479

Related videos on Youtube

Bojangles
Author by

Bojangles

Full stack web developer working with Node and React in Typescript and rather a lot of Rust.

Updated on May 16, 2022

Comments

  • Bojangles
    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?

  • Bojangles
    Bojangles over 11 years
    Thanks. I wasn't aware it was free - thanks for the heads up!
  • old_timer
    old_timer over 11 years
    well there is a lite version, and you need to read the license agreement.
  • old_timer
    old_timer over 11 years
    llvm, 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
    old_timer over 11 years
    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.
  • Admin
    Admin over 7 years
    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.
  • David Grayson
    David Grayson over 4 years
    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