How to execute "Hello World" in i.Mx 8 ?

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

How to execute "Hello World" in i.Mx 8 ?

Jump to solution
3,456 Views
anaseem
Contributor IV

I created "Hello World" program in eclipse IDE on Windows Desktop PC.  The executable filename is example.exe

My MCIMX8QXP-CPU: I.MX8QuadPlus Multisensory Enablement Kit (MEK) is connected to puTTy serial terminal on my Windows PC.

The board boots from SD Card. 

root.PNG

I want to execute "Hello World" program in MEK.  How do I copy example.exe to the Linux 'root' folder?

1 Solution
3,016 Views
guo_li
Contributor I

You can use PSFTP (should be installed with putty) to upload the exe file to MEK, but I guess it won't execute because it was built with Windows compiler so it cannot run under Linux. I would suggest you write the code directly in MEK using vi, then use gcc to compile and build the exe file.

View solution in original post

11 Replies
3,005 Views
jishin42
Contributor III
0 Kudos
3,017 Views
anaseem
Contributor IV

I created "Hello World" program in eclipse IDE on Windows Desktop PC.  I selected MinGW GCC Toolchain.

>> but I guess it won't execute because it was built with Windows compiler so it cannot run under Linux.

It was built with gcc compiler.  I downloaded this compiler from www.equation.com.  This compiler only applies to

windows, not Linux?  If yes, is there a different gcc compiler for Linux?

0 Kudos
3,017 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

The gcc compiler is usually included in our Yocto end images. However, if you want to include it, you need to add the Yocto recipe in the local.conf file. To make that, you need to write the below in the local.conf file.

IMAGE_INSTALL_append = " gcc"

Hope this can help you.

Best regards,

Diego.

3,017 Views
anaseem
Contributor IV

Do you know why gcc compiler isn't included in default Linux distribution provided in MEK?  vi editor is included.  Also, many 'c' header files are included, src folder is there.

0 Kudos
3,017 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

For Android, we do not support the gcc compiler, Android does have an internal gcc compiler. However, this kind of support is out of our scope. To run a simple hello world example in Android I suggest you use Java. However, this is also not supported by us.

On Linux, you can use the gcc compiler and create a c code for a "hello world" example. To make that you can use the gcc compiler that is already in our end Yocto image. Or, you can create a recipe with the "hello world" example. Please see the below web-pages.

http://www.linfo.org/create_c1.html

https://community.nxp.com/docs/DOC-331917

In the second web-page, please go to the "Adding an empty layer and a new recipe"  part. At the time you are creating the new layer, it will say if you want to add the hello world example, just say yes, and after that, you will have the hello world example natively in your end Yocto image. 

For more detailed information, you can see the below web-page:

https://community.nxp.com/docs/DOC-95333

And to know more about Yocto, you can see the below training.

https://community.nxp.com/docs/DOC-94849

Hope this information could help you. 

Best regards,

Diego.

3,017 Views
anaseem
Contributor IV

Is Yocto end image Linux distribution?

Isn't purpose of Yocto project to build Linux OS?  Android Linux distribution already comes in SD card with MEK.  So, I don't think I need Yocto right now?

I want to run simple program like "Hello World" in MEK.  What tools do I need to install in my windows PC.  Do I need a cross compiler and linker and 'c' language libraries?  Can I use eclipse IDE with cross gcc toolchain?

Later in development I'll need to create Linux image using Yocto project but to start out I need cross development environment and create simple 'c' programs to run in MEK.

0 Kudos
3,017 Views
guo_li
Contributor I

You can use PSFTP (should be installed with putty) to upload the exe file to MEK, but I guess it won't execute because it was built with Windows compiler so it cannot run under Linux. I would suggest you write the code directly in MEK using vi, then use gcc to compile and build the exe file.

3,017 Views
anaseem
Contributor IV

>>  I would suggest you write the code directly in MEK

I haven't used MEK before.  Is MEK IDE?  Do I need to install it in my windows machine?  Does it come with gcc compiler and editor?  Please provide information on MEK.

Other Options:

When I created "Hello World" project in eclipse IDE, I selected MinGW GCC Toolchain.  Will my program run in Linux if I choose Cross GCC toolchain from eclipse IDE?

0 Kudos
3,017 Views
guo_li
Contributor I

MEK is Multisensory Enablement Kit, the board running Linux. I originally thought the MEK linux comes with gcc but later I found no gcc was installed. So your solution is correct, use cross compiler as your described.

I also noticed that the default linux coming with MEK doesn't have sftp installed :smileysad:, so PSFTP cannot be used too. Need other solutions.

3,017 Views
anaseem
Contributor IV

>> I originally thought the MEK linux comes with gcc but later I found no gcc was installed

How did you find out?  Is this information specified in some document?  Is this possible to use Yocto Project to create linux image with gcc and vi or vim editor so a person can develop application software in MEK?

0 Kudos
3,017 Views
anaseem
Contributor IV

>>  use cross compiler

What do I enter in below fields?

cross_gcc_command.PNG

0 Kudos