Cross compile and execute C / C++ code on iMX8M Mini

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cross compile and execute C / C++ code on iMX8M Mini

3,456 Views
msingh1920
Contributor V

Hi,
I have iMX8M Mini EVK with Android 9.0 running on it.
i am successfully able to use Android NDK and run and execute sample hello app on this iMX board.

  1. But instead of using NDK i want to cross compile C / C++ code using some tool-chain or some other method and execute it it on target hardware i.e iMX8M Mini EVK.
    As per my understanding on embedded Linux we need tool-chains and sysroot to cross compile any program or libraries but i am not new to Embedded Android so i am not understanding how to do the same thing in Android.
  2. Also After my boards boots up when i try to execute basic commands such as sudo or vi or vim or dmesg on iMX8M mini then it gives me errors like - su: invalid uid/gid 'dmesg'    or commands not found etc.. Even GCC is also not available i think,

    Thanks,
    Maneesh 
     
       
3 Replies

3,007 Views
msingh1920
Contributor V

Hi,

Is there anyone from team NXP or from this forum who can reply to my above question ?

I am still waiting for any reply from this forum.

1. I know how to build hello world app using Android NDK software but i want to cross-compile and build

   basic hello_world.c file and execute it on my board without using Android NDK.

2. I am using iMX8M Mini EVK with pre-build Android 9.0 Image running on it.

3. For Linux system we need cross-tolchain such as arm-none-eabi-gcc by which we can cross compile

   the C/C++ file and then we can copy it to any sd card or pen drive and then execute it on target board.

   but how we can do same thing in Android OS ???

   If I will use Android NDK then it creates a app which i don't want.. I simply want to cross-compile and execute my

   single C /C++ file from android console.

Thanks,

Maneesh

0 Kudos
Reply

66 Views
chillinwithscb
Contributor II

I'm trying to find the best way to do this too. I _think_ the way is to create a cross-compiler toolchain via yocto. Then can build on ubuntu or something and scp the binary to the target to run. Also, can setup yocto to build and package the executable in an image file.

0 Kudos
Reply

3,007 Views
joanxie
NXP TechSupport
NXP TechSupport

normally suggest customer to use eclipse IDE, if you use toolchain, maybe you can refer to the topic as below:

https://community.nxp.com/message/1141513 

0 Kudos
Reply