Iam using MX linux OS. I am trying to use stm32f103c8t6 MCU. From the user manual Beginning STM32 by Warren gay I installed git clone of stm32f103c8t6, libopencm3 and FreeRTOS successfully as per manual.

When I downloaded and unzipped ARM CROSS Compiler the files were saved under /opt/gcc-arm folder.

Upon typing arm-none-eabi-gcc --version it is showing command not found error.

Upon probing further and typing $ ls -l /opt/gcc-arm/bin it lists arm-none-eabi-gcc in the following format in green colour

-rwxr-xr-x 2 1001 1001 1296976 Nov 24 2020 arm-none-eabi-gcc

Similarly 'type gcc' command gives output as 'gcc is /usr/bin/gcc' instead of 'arm-none-eabi-gcc is hashed (/opt/gcc-arm/bin/gcc)' as mention is user manual.

And 'type arm-none-eabi-gcc' command gives output as 'not found'

As I understand green colour of file means file is executable but I am not able to reason out why the computer is not recognizing the command.

Finally a make command got following response.

$ make
make -C libopencm3 TARGETS=stm32/f1
make[1]: Entering directory '/home/user/stm32f103c8t6/libopencm3'
  BUILD   lib/stm32/f1
  CC      adc.c
make[2]: arm-none-eabi-gcc: Command not found
make[2]: *** [../../Makefile.include:41: adc.o] Error 127
Failure building: lib/stm32/f1: code: 2
make[1]: *** [Makefile:79: lib] Error 1
make[1]: Leaving directory '/home/user/stm32f103c8t6/libopencm3'
make: *** [Makefile:38: libopencm3/lib/libopencm3_stm32f1.a] Error 2

1 Answer 1


[This should have been a comment but I don't have the reputation for it]

It looks like the path to the compiler is not in your $PATH environment variable.

To be sure it all works, you should call the program with an absolute path, either:



cd /opt/gcc-arm/bin/
./arm-none-eabi-gcc #the ./ is necessary to execute from the current directory

If that works (no more command not found error) the problem is of easy solution: add in the end of your .bashrc (in your home folder, I assume you are using bash as a shell, post the output of the command echo $SHELL if the file isn't there):


Then execute . ~/.bashrc (run the freshly edited file) from the current shell or simply open a new terminal, you should now be able to find the command.


I assume you are cross compiling from an intel/AMD machine (the architecture should be x86_64, you find it with the command uname -m or with more info uname -a). In this case you build on the x86 machine with a cross compiler and produce ARM executables to run on your stm32 machine.

In case I made wrong assumptions and you are trying to run the cross compiler from the stm32, then don't. The advantage of the cross compiler is to do the heavy stuff on a more powerful machine and run it on your tiny embedded system, if you want to compile on the stm32 without relying on another computer (i.e. without cross-compiling) and you are running linux there, then just compile with the local gcc and run executable there.


The compiler arm-none-eabi-gcc is meant to compile bare-metal code (e.g. a firmware that runs directly on the embedded system, NOT on linux), while the linux's gcc (or the cross compiler arm-linux-gnueabihf-gcc, for instance) are building programs that run on linux.

  • Thanks for the response. When I use ./arm-none-eabi-gcc the output is 'bash: ./arm-none-eabi-gcc: cannot execute binary file: Exec format error'. Does this mean incompatible version of GCC Jul 23, 2021 at 11:22
  • Append to your answer the output of the following commands: uname -a and file /opt/gcc-arm/bin/arm-none-eabi-gcc It is probably a matter of architecture the binary was built for, I would assume your architecture is x86_64 (Intel/AMD 64 bits) since you are trying to cross-compile to ARM, otherwise I guess you missed some step. What is your guest operating system (where you are cross compiling from)?
    – glemco
    Jul 23, 2021 at 12:13
  • Are you really cross-compiling (check the note) ?
    – glemco
    Jul 23, 2021 at 12:23
  • Thanks for the response. I replaced 32 bit OS with 64 bit version, problem is solved. Jul 23, 2021 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .