You can download a functional toolchain from developer.arm.com and install it manually after removing your existing gcc-arm-none-eabi package.

Go to that website, click the "Download" button and get: gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2. Save it in your home directory.

Make sure you've uninstalled the old Ubuntu packages.

sudo apt remove binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi

Untar the new package in your home directory:

tar -xjvf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2

Add the new toolchain to your path:

export PATH=$PATH:/home/(your user)/gcc-arm-none-eabi-7-2018-q2-update/bin/

At this point you should have a working ARM compiler and toolchain. (For the Unix newbies: if you close the terminal and open a new one, you'll have to re-run the export PATH statement so the compiler will get picked up again.)

To check if the compiler is installed:

gcc --version
Answer from user3486184 on Stack Exchange
🌐
Launchpad
launchpad.net › ~team-gcc-arm-embedded › +archive › ubuntu › ppa
team-gcc-arm-embedded ppa
Step1: Inside Ubuntu, open a terminal and input "sudo add-apt-repository ppa:team- ... To remove installed toolchain, just input "sudo apt-get remove gnu-arm-embedded". To update the toolchain, just repeat above step2 and step3.
🌐
GitHub
github.com › atsamd-rs › atsamd › issues › 275
failure to add ppa:team-gcc-arm-embedded/ppa · Issue #275 · atsamd-rs/atsamd
October 8, 2020 - The README suggests: $ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y $ sudo apt update $ sudo apt install gcc-arm-embedded However, sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y gives me the error: Err:8 http://ppa....
Author   mignon-p
Discussions

apt - How to install a functional ARM cross-GCC toolchain on Ubuntu 18.04 (Bionic Beaver) - Unix & Linux Stack Exchange
Done E: The repository 'http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu bionic Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. More on unix.stackexchange.com
🌐 unix.stackexchange.com
February 7, 2018
How can I set up the GCC ARM compiler for a STM32F412xx controller on Linux (Ubuntu) and build a demo project via CMake? - Stack Overflow
echo install arm x-compiler sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa sudo apt-get update sudo apt-get install gcc-arm-none-eabi echo install st link sudo apt-get install git build-essential libusb-1.0.0-dev cmake echo install eclipse sudo apt-get install openjdk-11-jdk More on stackoverflow.com
🌐 stackoverflow.com
Can I use ppa:team-gcc-arm-embedded to build PX4 formware?
I’m trying to use the latest gcc-arm-embedded and everything compiles, but I get a weird link error. Then genromfs step works fine: /usr/bin/genromfs -f /mnt/d/git/px4/Firmware/build_px4fmu-v2_default/src/firmware/nutt… More on discuss.px4.io
🌐 discuss.px4.io
0
0
March 7, 2017
Is there a PPA that always has the latest gcc version (including g++)?
For stability. Even compilers can have bugs like any other software written by humans. More on reddit.com
🌐 r/Ubuntu
13
8
September 24, 2021
🌐
Bitcraze
forum.bitcraze.io › board index › crazyflie nano quadcopter › support
cannot add PPA for gcc-arm-embedded - Bitcraze Forums
July 21, 2020 - So I looked up the chaintool version to with gcc -v. Mine is like this: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) I have Ubuntu 18.04 so adding the PPA was not a problem. But I guess this is different for linux mint. Maybe you can try to install the package directly, but that seems to be already done on your system: ... sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi You might need to downgrade it to version 8 since we have seen a problem with gcc9 with structs (as I can see from your error messages during compile).
🌐
Launchpad
launchpad.net › gcc-arm-embedded › +announcement › 13824
New PPA repository : GNU Arm Embedded Toolchain
January 20, 2016 - For our 2015Q4 GCC 5 release we decided to move from the old PPA maintained by Terry Guo [1] to a team maintained one [2]. We also took advantage of that move to rename the package from gcc-arm-none-eabi to gcc-arm-embedded.
🌐
Launchpad
launchpad.net › ~team-gcc-arm-embedded › +archive › ubuntu › ppa › +build › 13612999
amd64 build of gcc-arm-none-eabi 6-2017q2-1~artful1 : GNU Arm Embedded Toolchain : “GCC Arm Embedded Maintainers” team
gcc-arm-none-eabi - 6-2017q2-1~artful1 · Archive: GNU Arm Embedded Toolchain · Series: Artful · Architecture: amd64 · Pocket: Release · Component: main · Binary packages produced by this build: gcc-arm-embedded-6-2017q2-1~artful1 · Files resulting from this build: • Take the tour • Read the guide ·
🌐
Launchpad
launchpad.net › ~team-gcc-arm-embedded › +archive › ubuntu › ppa
GNU Arm Embedded Toolchain : “GCC Arm Embedded Maintainers” team
Step1: Inside Ubuntu, open a terminal and input "sudo add-apt-repository ppa:team- ... To remove installed toolchain, just input "sudo apt-get remove gnu-arm-embedded". To update the toolchain, just repeat above step2 and step3.
🌐
Launchpad
launchpad.net › ~team-gcc-arm-embedded › +archive › ubuntu › ppa › +builds
Builds : GNU Arm Embedded Toolchain : “GCC Arm Embedded Maintainers” team
This PPA is an alternative to toolchain released at https://launchpad.net/gcc-arm-embedded. The source codes for both are same. Currently supports Ubuntu 10.04/12.04/14.04/14.10 32 and 64 bit.
Find elsewhere
🌐
Paparazziuav
wiki.paparazziuav.org › wiki › Installation › Linux
Installation/Linux - PaparazziUAV
May 2, 2020 - On most Ubuntu versions the gcc-arm-embedded toolchain can be installed as a debian package from the ppa: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa sudo apt-get update sudo apt-get install gcc-arm-embedded
Top answer
1 of 5
49

It turned out that ARM decided to make our life easier (sarcasm) by deprecating the use of PPA - their page at launchpad now has an anouncement: "... all new binary and source packages will not be released on Launchpad henceforth ...".

So, to make use of their latest arm-none-eabi-gdb you have to install gcc-arm-embedded manually.

Remove arm-none-eabi-gcc from your system:

sudo apt remove gcc-arm-none-eabi

Download latest version (Linux x86_64 Tarball) from their website, check its MD5. Unpack it into some directory. I used /usr/share/ :

sudo tar xjf gcc-arm-none-eabi-YOUR-VERSION.bz2 -C /usr/share/

Create links so that binaries are accessible system-wide:

sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc 
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-g++ /usr/bin/arm-none-eabi-g++
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-gdb /usr/bin/arm-none-eabi-gdb
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy

Install dependencies. ARM's "full installation instructions" listed in readme.txt won't tell you what dependencies are - you have to figure it out by trial and error. In my system I had to manually create symbolic links to force it to work:

sudo apt install libncurses-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

Check if it works:

arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
arm-none-eabi-gdb --version
arm-none-eabi-size --version
2 of 5
10

I've wrapped the script here by @kmhallen into a semi-automated debian package builder here: https://gitlab.com/alelec/arm-none-eabi-gcc-deb/-/releases

Installing a package like this means you can skip the tedious manual symlinks to put tools on the path, and just as importantly you can uninstall / upgrade to newer packages (assuming I remember to make more packages)

Top answer
1 of 1
2

Building a project takes following steps:

1. Install the gcc-arm-none-eabi toolchain

It can be found on Launchpad or at ARM. Download the Linux installation tarball, extract, and add the /bin folder in the extracted folder to the PATH environment variable.

2. Install supporting packages

Install CMake, build-essential libusb-1.0.0-dev cmake, stlink, and OpenOCD from your distribution.

3. Create a CMake file for the toolchain

For the STM32F412 MPU I put mine below:

include(CMakeForceCompiler)

##############################
# gnu-none-ebai install dir
# /usr/lib/arm-none-eabi
#
# stm32f412
# Features:
#    - fpu
#    - dsp
#
# instructionset for libs:
# /usr/lib/arm-none-eabi/lib/armv7e-m/<soft/fpu>/{FPU precision}


set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(OBJCOPY arm-none-eabi-objcopy)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(COMMON_FLAGS "-march=armv7e-m -mtune=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mthumb-interwork -Og -ffunction-sections -fdata-sections -fno-move-loop-invariants")
set(LINKER_SCRIPTS "-T ${CMAKE_SOURCE_DIR}/ldscripts/STM32F412RG.ld -T ${CMAKE_SOURCE_DIR}/ldscripts/sections.ld -T ${CMAKE_SOURCE_DIR}/ldscripts/libs.ld")

set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11" CACHE INTERNAL "")
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99" CACHE INTERNAL "")
set(CMAKE_ASM_FLAGS "${COMMON_FLAGS}" CACHE INTERNAL "")
set(CMAKE_EXE_LINKER_FLAGS  "-W -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -nostartfiles --specs=nosys.specs -ffunction-sections -fdata-sections -fno-move-loop-invariants ${LINKER_SCRIPTS}" CACHE INTERNAL "")


#
include_directories(BEFORE SYSTEM "/usr/lib/arm-none-eabi/include/")

list(APPEND TOOLCHAIN_EXTRA_LIBDIR
    "/usr/lib/arm-none-eabi/lib/armv7e-m/fpu"
)

link_directories(${TOOLCHAIN_EXTRA_LIBDIR})

set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

4. Add/copy the linker scripts

4.1 sections.ld

/*
 * Default linker script for Cortex-M (it includes specifics for STM32F[34]xx).
 *
 * To make use of the multi-region initialisations, define
 * OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS for the _startup.c file.
 */

/*
 * The '__stack' definition is required by crt0, do not remove it.
 */
__stack = ORIGIN(RAM) + LENGTH(RAM);

_estack = __stack;     /* STM specific definition */


/*
 * Default stack sizes.
 * These are used by the startup in order to allocate stacks
 * for the different modes.
 */

__Main_Stack_Size = 1024 ;

PROVIDE ( _Main_Stack_Size = __Main_Stack_Size ) ;

__Main_Stack_Limit = __stack  - __Main_Stack_Size ;

/* "PROVIDE" allows to easily override these values from an
 * object file or the command line. */
PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ;

/*
 * There will be a link error if there is not this amount of
 * RAM free at the end.
 */
_Minimum_Stack_Size = 256 ;

/*
 * Default heap definitions.
 * The heap start immediately after the last statically allocated
 * .sbss/.noinit section, and extends up to the main stack limit.
 */
PROVIDE ( _Heap_Begin = _end_noinit ) ;
PROVIDE ( _Heap_Limit = __stack - __Main_Stack_Size ) ;

/*
 * The entry point is informative, for debuggers and simulators,
 * since the Cortex-M vector points to it anyway.
 */
ENTRY(_start)


/* Sections Definitions */

SECTIONS
{
    /*
     * For Cortex-M devices, the beginning of the startup code is stored in
     * the .isr_vector section, which goes to FLASH.
     */
    .isr_vector : ALIGN(4)
    {
        FILL(0xFF)

        __vectors_start = ABSOLUTE(.) ;
        __vectors_start__ = ABSOLUTE(.) ; /* STM specific definition */
        KEEP(*(.isr_vector))         /* Interrupt vectors */

        KEEP(*(.cfmconfig))            /* Freescale configuration words */

        /*
         * This section is here for convenience, to store the
         * startup code at the beginning of the flash area, hoping that
         * this will increase the readability of the listing.
         */
        *(.after_vectors .after_vectors.*)    /* Startup code and ISR */
        /* by StJ */
        __vectors_end = ABSOLUTE(.) ;
    } >FLASH

    .inits : ALIGN(4)
    {
        /*
         * Memory regions initialisation arrays.
         *
         * Thee are two kinds of arrays for each RAM region, one for
         * data and one for bss. Each is iterated at startup and the
         * region initialisation is performed.
         *
         * The data array includes:
         * - from (LOADADDR())
         * - region_begin (ADDR())
         * - region_end (ADDR()+SIZEOF())
         *
         * The bss array includes:
         * - region_begin (ADDR())
         * - region_end (ADDR()+SIZEOF())
         *
         * WARNING: It is mandatory that the regions are word aligned,
         * since the initialisation code works only on words.
         */

        __data_regions_array_start = .;

        LONG(LOADADDR(.data));
        LONG(ADDR(.data));
        LONG(ADDR(.data)+SIZEOF(.data));

        LONG(LOADADDR(.data_CCMRAM));
        LONG(ADDR(.data_CCMRAM));
        LONG(ADDR(.data_CCMRAM)+SIZEOF(.data_CCMRAM));

        __data_regions_array_end = .;

        __bss_regions_array_start = .;

        LONG(ADDR(.bss));
        LONG(ADDR(.bss)+SIZEOF(.bss));

        LONG(ADDR(.bss_CCMRAM));
        LONG(ADDR(.bss_CCMRAM)+SIZEOF(.bss_CCMRAM));

        __bss_regions_array_end = .;

        /* End of memory regions initialisation arrays. */

        /*
         * These are the old initialisation sections, intended to contain
         * naked code, with the prologue/epilogue added by crti.o/crtn.o
         * when linking with startup files. The standalone startup code
         * currently does not run these, better use the init arrays below.
         */
        KEEP(*(.init))
        KEEP(*(.fini))

        . = ALIGN(4);

        /*
         * The preinit code, i.e. an array of pointers to initialisation
         * functions to be performed before constructors.
         */
        PROVIDE_HIDDEN (__preinit_array_start = .);

        /*
         * Used to run the SystemInit() before anything else.
         */
        KEEP(*(.preinit_array_sysinit .preinit_array_sysinit.*))

        /*
         * Used for other platform inits.
         */
        KEEP(*(.preinit_array_platform .preinit_array_platform.*))

        /*
         * The application inits. If you need to enforce some order in
         * execution, create new sections, as before.
         */
        KEEP(*(.preinit_array .preinit_array.*))

        PROVIDE_HIDDEN (__preinit_array_end = .);

        . = ALIGN(4);

        /*
         * The init code, i.e. an array of pointers to static constructors.
         */
        PROVIDE_HIDDEN (__init_array_start = .);
        KEEP(*(SORT(.init_array.*)))
        KEEP(*(.init_array))
        PROVIDE_HIDDEN (__init_array_end = .);

        . = ALIGN(4);

        /*
         * The fini code, i.e. an array of pointers to static destructors.
         */
        PROVIDE_HIDDEN (__fini_array_start = .);
        KEEP(*(SORT(.fini_array.*)))
        KEEP(*(.fini_array))
        PROVIDE_HIDDEN (__fini_array_end = .);

    } >FLASH

    /*
     * For some STRx devices, the beginning of the startup code
     * is stored in the .flashtext section, which goes to FLASH.
     */
    .flashtext : ALIGN(4)
    {
        *(.flashtext .flashtext.*)    /* Startup code */
    } >FLASH


    /*
     * The program code is stored in the .text section,
     * which goes to FLASH.
     */
    .text : ALIGN(4)
    {
        *(.text .text.*)            /* All remaining code */

         /* read-only data (constants) */
        *(.rodata .rodata.* .constdata .constdata.*)

        *(vtable)                    /* C++ virtual tables */

        KEEP(*(.eh_frame*))

        /*
         * Stub sections generated by the linker, to glue together
         * ARM and Thumb code. .glue_7 is used for ARM code calling
         * Thumb code, and .glue_7t is used for Thumb code calling
         * ARM code. Apparently always generated by the linker, for some
         * architectures, so better leave them here.
         */
        *(.glue_7)
        *(.glue_7t)

    } >FLASH

    /* ARM magic sections */
    .ARM.extab : ALIGN(4)
       {
       *(.ARM.extab* .gnu.linkonce.armextab.*)
       } > FLASH

    . = ALIGN(4);
       __exidx_start = .;
       .ARM.exidx : ALIGN(4)
       {
       *(.ARM.exidx* .gnu.linkonce.armexidx.*)
       } > FLASH
       __exidx_end = .;

    . = ALIGN(4);
    _etext = .;
    __etext = .;

    /* MEMORY_ARRAY */
    /*
    .ROarraySection :
    {
         *(.ROarraySection .ROarraySection.*)
    } >MEMORY_ARRAY
    */

    /*
     * The secondary initialised data section.
     */
    .data_CCMRAM : ALIGN(4)
    {
       FILL(0xFF)
       *(.data.CCMRAM .data.CCMRAM.*)
       . = ALIGN(4) ;
    } > CCMRAM AT>FLASH

    /*
     * This address is used by the startup code to
     * initialise the .data section.
     */
    _sidata = LOADADDR(.data);

    /*
     * The initialised data section.
     *
     * The program executes knowing that the data is in the RAM
     * but the loader puts the initial values in the FLASH (inidata).
     * It is one task of the startup to copy the initial values from
     * FLASH to RAM.
     */
    .data : ALIGN(4)
    {
        FILL(0xFF)
        /* This is used by the startup code to initialise the .data section */
        _sdata = . ;            /* STM specific definition */
        __data_start__ = . ;
        *(.data_begin .data_begin.*)

        *(.data .data.*)

        *(.data_end .data_end.*)
        . = ALIGN(4);

        /* This is used by the startup code to initialise the .data section */
        _edata = . ;            /* STM specific definition */
        __data_end__ = . ;

    } >RAM AT>FLASH

    /*
     * The uninitialised data sections. NOLOAD is used to avoid
     * the "section `.bss' type changed to PROGBITS" warning
     */

    /* The secondary uninitialised data section. */
    .bss_CCMRAM (NOLOAD) : ALIGN(4)
    {
        *(.bss.CCMRAM .bss.CCMRAM.*)
    } > CCMRAM

    /* The primary uninitialised data section. */
    .bss (NOLOAD) : ALIGN(4)
    {
        __bss_start__ = .;         /* Standard newlib definition */
        _sbss = .;              /* STM specific definition */
        *(.bss_begin .bss_begin.*)

        *(.bss .bss.*)
        *(COMMON)

        *(.bss_end .bss_end.*)
        . = ALIGN(4);
        __bss_end__ = .;        /* Standard newlib definition */
        _ebss = . ;             /* STM specific definition */
    } >RAM

    .noinit_CCMRAM (NOLOAD) : ALIGN(4)
    {
        *(.noinit.CCMRAM .noinit.CCMRAM.*)
    } > CCMRAM

    .noinit (NOLOAD) : ALIGN(4)
    {
        _noinit = .;

        *(.noinit .noinit.*)

         . = ALIGN(4) ;
        _end_noinit = .;
    } > RAM

    /* Mandatory to be word aligned, _sbrk assumes this */
    PROVIDE ( end = _end_noinit ); /* was _ebss */
    PROVIDE ( _end = _end_noinit );
    PROVIDE ( __end = _end_noinit );
    PROVIDE ( __end__ = _end_noinit );

    /*
     * Used for validation only, do not allocate anything here!
     *
     * This is just to check that there is enough RAM left for the Main
     * stack. It should generate an error if it's full.
     */
    ._check_stack : ALIGN(4)
    {
        . = . + _Minimum_Stack_Size ;
    } >RAM

    /*
     * The FLASH Bank1.
     * The C or assembly source must explicitly place the code
     * or data there using the "section" attribute.
     */
    .b1text : ALIGN(4)
    {
        *(.b1text)                   /* Remaining code */
        *(.b1rodata)                 /* Read-only data (constants) */
        *(.b1rodata.*)
    } >FLASHB1

    /*
     * The EXTMEM.
     * The C or assembly source must explicitly place the code or data there
     * using the "section" attribute.
     */

    /* EXTMEM Bank0 */
    .eb0text : ALIGN(4)
    {
        *(.eb0text)                   /* Remaining code */
        *(.eb0rodata)                 /* Read-only data (constants) */
        *(.eb0rodata.*)
    } >EXTMEMB0

    /* EXTMEM Bank1 */
    .eb1text : ALIGN(4)
    {
        *(.eb1text)                   /* Remaining code */
        *(.eb1rodata)                 /* Read-only data (constants) */
        *(.eb1rodata.*)
    } >EXTMEMB1

    /* EXTMEM Bank2 */
    .eb2text : ALIGN(4)
    {
        *(.eb2text)                   /* Remaining code */
        *(.eb2rodata)                 /* Read-only data (constants) */
        *(.eb2rodata.*)
    } >EXTMEMB2

    /* EXTMEM Bank0 */
    .eb3text : ALIGN(4)
    {
        *(.eb3text)                   /* Remaining code */
        *(.eb3rodata)                 /* Read-only data (constants) */
        *(.eb3rodata.*)
    } >EXTMEMB3


    /* After that there are only debugging sections. */

    /* This can remove the debugging information from the standard libraries */
    /*
    DISCARD :
    {
     libc.a ( * )
     libm.a ( * )
     libgcc.a ( * )
     }
     */

    /* Stabs debugging sections.  */
    .stab          0 : { *(.stab) }
    .stabstr       0 : { *(.stabstr) }
    .stab.excl     0 : { *(.stab.excl) }
    .stab.exclstr  0 : { *(.stab.exclstr) }
    .stab.index    0 : { *(.stab.index) }
    .stab.indexstr 0 : { *(.stab.indexstr) }
    .comment       0 : { *(.comment) }
    /*
     * DWARF debug sections.
     * Symbols in the DWARF debugging sections are relative to the beginning
     * of the section so we begin them at 0.
     */
    /* DWARF 1 */
    .debug          0 : { *(.debug) }
    .line           0 : { *(.line) }
    /* GNU DWARF 1 extensions */
    .debug_srcinfo  0 : { *(.debug_srcinfo) }
    .debug_sfnames  0 : { *(.debug_sfnames) }
    /* DWARF 1.1 and DWARF 2 */
    .debug_aranges  0 : { *(.debug_aranges) }
    .debug_pubnames 0 : { *(.debug_pubnames) }
    /* DWARF 2 */
    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    .debug_abbrev   0 : { *(.debug_abbrev) }
    .debug_line     0 : { *(.debug_line) }
    .debug_frame    0 : { *(.debug_frame) }
    .debug_str      0 : { *(.debug_str) }
    .debug_loc      0 : { *(.debug_loc) }
    .debug_macinfo  0 : { *(.debug_macinfo) }
    /* SGI/MIPS DWARF 2 extensions */
    .debug_weaknames 0 : { *(.debug_weaknames) }
    .debug_funcnames 0 : { *(.debug_funcnames) }
    .debug_typenames 0 : { *(.debug_typenames) }
    .debug_varnames  0 : { *(.debug_varnames) }
}

/* Some adds */
__stack_end__ = _estack;
__RAM_segment_end__ = __stack ;
__vectors_load_start__ = __vectors_start;
__vectors_load_end__ = __vectors_end;
_start = main;

4.2 lib.ld

/*
 * Placeholder to list other libraries required by the application.

GROUP(
)

 */

4.3 STM32F412RG.ld

/*
 * Memory Spaces Definitions.
 *
 * Need modifying for a specific board.
 *   FLASH.ORIGIN: starting address of flash
 *   FLASH.LENGTH: length of flash
 *   RAM.ORIGIN: starting address of RAM bank 0
 *   RAM.LENGTH: length of RAM bank 0
 *
 * The values below can be addressed in further linker scripts
 * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'.
 */

MEMORY
{
  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
  CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0K
  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
  FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  MEMORY_ARRAY (xrw)  : ORIGIN = 0x20002000, LENGTH = 32
}

/*
 * For external ram use something like:

   RAM (xrw) : ORIGIN = 0x64000000, LENGTH = 2048K

 */

5. Instruction

  1. Create your CMake project - this example is taken from a bootloader

    cmake_minimum_required(VERSION 3.10)
    set(BL "BOOTLOADER")
    set(${BL}_VERSION_MAJOR 1)
    set(${BL}_VERSION_MINOR 4)
    set(${BL}_VERSION_REVISION 1)
    set(${BL}_SOVERSION 1)
    list(APPEND ${BL}_DEFINES
        USE_HAL_DRIVER
        STM32F412Rx
    )
    set(LINKER_FLAGS_BL "-Xlinker -Map=bl.map -Ttext 0x08020000")
    list(APPEND ${BL}_inc
        ${CMAKE_CURRENT_SOURCE_DIR}/inc/
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/CMSIS/Include
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/CMSIS/Device/ST/STM32F4xx/Include
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Inc
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Inc/Legacy
        ${CMAKE_CURRENT_SOURCE_DIR}/middlewares/ST/STM32_USB_Device_Library/Core/Inc
        ${CMAKE_CURRENT_SOURCE_DIR}/middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
        ${CMAKE_CURRENT_SOURCE_DIR}/application/rtfw/Inc
        ${CMAKE_CURRENT_SOURCE_DIR}/../shared/inc
        ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/include
      ${CMAKE_BINARY_DIR}/generated/
    )
    list(APPEND ${BL}_sources
        ${CMAKE_CURRENT_SOURCE_DIR}/../shared/src/stm32_startup.s
        ${CMAKE_CURRENT_SOURCE_DIR}/src/system_stm32f4xx.c
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
        ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
    )
    list(APPEND ${BL}_libDirs
    )
    list(APPEND ${BL}_libs
    )
    include_directories(${${BL}_inc})
    link_directories(${${BL}_libDirs})
    add_executable(${BL}
        ${${BL}_sources}
        ${TOOLCHAIN_EXTRA_OBJECTS}
    )
    target_compile_definitions(${BL} PRIVATE ${${BL}_DEFINES})
    target_link_libraries(${BL} PRIVATE ${${BL}_libs})
    set_target_properties(${BL} PROPERTIES
        LINK_FLAGS "${LINKER_FLAGS_BL}"
        OUTPUT_NAME "${BL}_${GIT_COMMIT_TAG}_${GIT_COMMIT_HASH}"
        VERSION "${${BL}_VERSION_MAJOR}.${${BL}_VERSION_MINOR}.${${BL}_VERSION_REVISION}"
        SOVERSION "${${BL}_SOVERSION}"
        SUFFIX ".elf"
    )
    
  2. Create bin/files form the ELF file via object copy

  3. Connect your programmer (p.e. ST-LINK)

  4. Open OpenOCD with a configuration like this

    echo "use the st link v2 cfg"
    source [find interface/stlink-v2.cfg]
    
    transport select hla_swd
    
    echo "set target to stm32f4x"
    
    source [find target/stm32f4x.cfg]
    
    reset_config srst_only
    
    $_TARGETNAME configure -event gdb-attach {
            echo "Debugger attaching: halting execution"
            reset halt
            gdb_breakpoint_override hard
    }
    
    $_TARGETNAME configure -event gdb-detach {
            echo "Debugger detaching: resuming execution"
            resume
    }
    
  5. Happy bug hunt

🌐
Apache
mynewt.apache.org › latest › get_started › native_install › cross_tools.html
Installing the Cross Tools for ARM — Apache Mynewt latest documentation
$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi $ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa $ sudo apt-get update $ sudo apt-get install gcc-arm-none-eabi $ sudo apt-get install gdb-arm-none-eabi
🌐
Launchpad
bugs.launchpad.net › gcc-arm-embedded › +bug › 1767909
Bug #1767909 “18.04 Bionic Beaver release, Wishlist” : Bugs : GNU Arm Embedded Toolchain
Step1: Inside Ubuntu, open a terminal and input "sudo add-apt-repository ppa:team- ... To remove installed toolchain, just input "sudo apt-get remove gnu-arm-embedded". To update the toolchain, just repeat above step2 and step3.
🌐
Mcmanis
robotics.mcmanis.com › articles › 20190401_cross-compiling-cortex-m.html
Cross compiling from Linux for the Cortex-M -- Chuck's Robotics Notebook
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa This PPA is an alternative to toolchain released at https://launchpad.net/gcc-arm-embedded. The source codes for both are same.
🌐
PX4
discuss.px4.io › t › can-i-use-ppa-team-gcc-arm-embedded-to-build-px4-formware › 2663
Can I use ppa:team-gcc-arm-embedded to build PX4 formware? - Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink
March 7, 2017 - I’m trying to use the latest gcc-arm-embedded and everything compiles, but I get a weird link error. Then genromfs step works fine: /usr/bin/genromfs -f /mnt/d/git/px4/Firmware/build_px4fmu-v2_default/src/firmware/nuttx/romfs.bin -d /mnt/d/git/px4/Firmware/build_px4fmu-v2_default/tmp/ROMFS/px4fmu_common -V NSHInitVol but arm-none-eabi-ld doesn’t like it…
🌐
Launchpad
answers.launchpad.net › gcc-arm-embedded › +question › 660786
Question #660786 “Not able to install toolchain” : Questions : GNU Arm Embedded Toolchain
November 15, 2017 - @Rahul: You'll first need to install ... · Then at last you will need to enable the current PPA: 1) sudo add-apt-repository ppa:team- gcc-arm- embedded/ ppa 2) sudo apt-get update 3) sudo apt-get install gcc-arm-embedded ...
🌐
GitHub
github.com › ARMmbed › mbed-os › pull › 4921 › files
Update gcc-arm-embedded PPA in Travis by amq · Pull Request #4921 · ARMmbed/mbed-os
Description ppa:terry.guo/gcc-arm-embedded has been deprecated in favor of ppa:team-gcc-arm-embedded/ppa This also means switching from 4.9.3.2015q3 to 6-2017q2 Status READY Migrations NO
Author   ARMmbed