OS - linux. When installing with sudo apt-get install gcc-arm-embedded , version 7.3.0 is installed, which is not appropriate. I downloaded from the site an archive of tulchein version 4.9.3 and what to do next?

  • one
    There are no installation instructions in the source archive? - mkkik
  • what to do next? - read the instructions . on the website or in the archive itself. in another way - alas, no way. - aleksandr barakin February

1 answer 1

If nothing is clear at all, do this:

  1. Download the cross-compiler archive to any place.
  2. Put his binaries somewhere where you see fit. For example, I have them in the / usr / bin / directory . By the word "binaries" I mean files like "arm-linux-gnueabihf- *". Among them will be something like:
 arm-linux-gnueabihf-ar arm-linux-gnueabihf-as ... arm-linux-gnueabihf-g++-5 arm-linux-gnueabihf-gcc-5 

It is not necessary to put them in / usr / bin /, you can in a separate directory, but then you need to add this directory to PATH. There also need to put and symbolic links, if necessary.

  1. Create a project directory in which to cross-compile the application.
  2. In this directory, create a tool-chain for cMake of approximately the following form:

    $ cat ARM-toolchain

    SET (CMAKE_C_COMPILER linux-gnueabihf-gcc) SET (CMAKE_CXX_COMPILER linux-gnueabihf-g ++) SET (CMAKE_STRIP arm-cortexa9_neon-linux-gnueabihf-strip) SET (CMAKE_BUILD_TYPE MinSizeRel) SET (CROSS true) add_definitions (-DCROSS)

Please note that here I am already using symbolic links to not change
toolchain when changing the version of cross-compilers. Instead of arm-linux-gnueabihf-gcc-5, I indicated the link linux-gnueabihf-gcc which indicates the default version of the compiler.

  1. In the project directory, create CMakeLists.txt What it is, I will not explain here.
  2. Create an ARM_build folder and navigate to this folder.
  3. Run the command:

    cmake -DCMAKE_TOOLCHAIN_FILE = .. / ARM-toolchain ..

cmake will take your toolchain and create a Makefile , in which it will write the compilers for cross-compiling.

  1. Run the build

    make