Compiling examples from command line for colibri imx7

Hi,
I’m trying to use command line (cross-compilation for linux), to work with CAN bus, I started to read this

but it seems an archived website.
I need to know :

  1. Steps to configure environment for crosss-compile a toradex project
  2. Where I can find a simple example for CAN bus

Thanks in advance

Hello @Achref ,

Which OS and version are you using? TorizonCore or our BSP?

For CAN ,depending on your OS you can use this documentation ( for TorizonCore)

Or this one ( for BSP)

Best regards,
Josep

Hello @josep.tx,
Thanks for the reply,
I’m using BSP not TorizonCore. but I couldn’ find example for the CAN bus (or other dirvers), is there an example or I can use this FreeRTOS example FreeRTOS-Colibri-iMX7/examples/imx7_colibri_m4/driver_examples/flexcan at master · toradex/FreeRTOS-Colibri-iMX7 · GitHub ??
Thanks an advance

Hi @Achref !

If you want to use the Cortex-M4 of Colibri iMX7, you can follow the article FreeRTOS on the Cortex-M4 of a Colibri iMX7 | Toradex Developer Center

Best regards,

1 Like

Hi @henrique.tx
Thanks for this information,
I followed this article to use the GNU Makefiles and CMake with GCC for compiling.
I tried to compile the helloword example, but when I run the build_all.sh script, I got this message:
-bash: ./build_all.sh: /bin/sh^M: bad interpreter: No such file or directory

Best regards,

Hello @Achref ,

The problem is that ^M , you can get rid of these with the dos2unix tool

Best regards,
Josep

Thank you very much @josep.tx

Hi @henrique.tx @josep.tx

After using the GNU Makefiles and CMake with GCC the compilation succeeded and I obtained the hello_world.elf file after running the ./build_all.sh script, but when I connect to the board and trying to run the file I obtained a Segmentation fault message (the same thing when executing the pre-compiled file Index of /Colibri/FreeRTOS/Binaries)
Do I need to do those steps:

and when I compiled a hello_word example using armv7at2hf-neon-angstrom-linux-gnueabi compiler (using the two ways command line and eclipse), it work correctly, but I didn’t got the same information about the output file:

  1. Using build_all.sh script:
    root@colibri-imx7-emmc-14866722:~# file hello_world.elf hello_world.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

  2. Using armv7at2hf-neon-angstrom-linux-gnueabi: (which work correctly)
    root@colibri-imx7-emmc-14866722:~# file helloARM helloARM: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.1.10, BuildID[sha1]=ae85ee572be0790f6b41d00249bc4f6faa71f60f, with debug_info, not stripped

Best regards,