Community
cancel
Showing results for 
Search instead for 
Did you mean: 
hhang
Novice
1,658 Views

How can I burn my C++ code to intel edison after disconnect by eclipse iot?

I'm using the eclipse Iot in Windows and I write a C++ code and try to upload it, it's working well but when I disconnect it everything was stopped.

So the question is how can I burn my code into the board? Thanks!

13 Replies
FBuit
Innovator
180 Views

You can execute your code following next steps:

  • connect to your edison via ssh/serial
  • cd /tmp/
  • execute your file ./your_app_name

Regards¡

hhang
Novice
180 Views

Thank you Fran.B

The second step is in Remote System Explorer and ssh terminals lauch? I'm a beginer to use eclipse .

I tried the terminals lauch and got the sentence below:

root@edison:~# cd/tmp

-sh: cd/tmp: No such file or directory

Is there some other things I have to do before?

(I'm not using Linux) 

Regards.

FBuit
Innovator
180 Views

are you writting cd /tmp ??

If you cant try to write

cd .. (go to the upper folder)

cd .. (go to the upper folder)

ls list all the folder of the directory

and

cd tmp

Regards

hhang
Novice
180 Views

Thanks.

But still the same issue, everything will stop after disconnect it or switch off it.

Regards.

Pedro_M_Intel
Employee
180 Views

Hello zhanghang,

This question is very similar to the one found in /message/358838# 358838 Re: C++ Creating Release Version, I'd suggest you to check it. It talks about how to create a system service which will make your script run on boot every time.

Let me know if it helps, or if you need help creating a service for your project.

Peter.

hhang
Novice
180 Views

Thanks for your response Peter,

It's really similar with my problem and I'm trying to use your way but I have some issues:

root@edison:~# gcc graphicsTest.cpp -o graphicsTest -lmraa

graphicsTest.cpp:15:39: fatal error: Adafruit_GFX/Adafruit_GFX.h: No such file or directory

# include "Adafruit_GFX/Adafruit_GFX.h"

^

compilation terminated.

The above information is what I got by edison. I think the problem is that I was using some other libraries and maybe I have to create the library files?

How can I create the library files? To use the same way as "vi Adafruit_GFX.h"? And before create this file I have to create a directory names Adafruit_GFX in the same directory as my .cpp file ?

Regards.

hhang
Novice
180 Views

Hi Peter,

After I created all the libraries I need, I got the errors below:

root@edison:~# gcc graphicsTest.cpp -o graphicsTest -lmraa

In file included from Adafruit_ILI9341/Adafruit_ILI9341.h:12:0,

from graphicsTest.cpp:17:

/usr/include/mraa/gpio.h:40:1: error: expected initializer before 'extern'

extern "C" {

^

In file included from /usr/include/c++/4.9.1/new:40:0,

from /usr/include/c++/4.9.1/ext/new_allocator.h:33,

from /usr/include/c++/4.9.1/i586-poky-linux/bits/c++allocator.h:33,

from /usr/include/c++/4.9.1/bits/allocator.h:46,

from /usr/include/c++/4.9.1/string:41,

from /usr/include/mraa/common.hpp:29,

from /usr/include/mraa.hpp:27,

from graphicsTest.cpp:25:

/usr/include/c++/4.9.1/exception:35:37: error: expected declaration before end of line

# pragma GCC visibility push(default)

^

Thanks!

Pedro_M_Intel
Employee
180 Views

Can you share your script and the libraries you installed? If the script compiles on Eclipse it should also compile on the Edison. Something that's correctly installed on Eclipse is probably missing on Edison. What did you add on Eclipse?

Peter.

hhang
Novice
180 Views

The libraries I include:

# include "Adafruit_GFX/Adafruit_GFX.h"

# include "Adafruit_ILI9341/Adafruit_ILI9341.h"

# include "Adafruit_TFTLCD/Adafruit_TFTLCD.h"

# include

# include

# include

# include

# include

# include "mraa.hpp"

# include "grove.h"

# include

# include "math.h"

# include

The first three libraries can be find from here: https://github.com/llatta/edison-graphics/tree/master/src edison-graphics/src at master · llatta/edison-graphics · GitHub

Note that the file graphicsTest from this link is not the file I'm using.(I'm just using the same name)

Thanks.

Pedro_M_Intel
Employee
180 Views

I just noticed that you were trying to compile C++ code with GCC, that might be one of the issues. GCC is used when compiling C code, if you would like to compile C++ code you will have to use G++. How to install G++ and compile with it is also mentioned in on my last reply.

Now, I believe I know how you can correctly compile your script, but will need git, in case you don't have it already, you can get it from AlexT's repo (you can find how to set it up also on ) with the command:

opkg install git.

Use git to download the library with the command:

git clone https://github.com/llatta/edison-graphics https://github.com/llatta/edison-graphics

Once downloaded go to /edison-graphics/src and store your script in there. Now compile it with the command:

g++ yourscript.cpp -o yourscriptoutput -lmraa

Let me know if it works.

Peter.

hhang
Novice
180 Views

Thanks.

But still the same issues as I write before:

root@edison:~# g++ graphicsTest.cpp -o graphicsTest -lmraa

In file included from Adafruit_ILI9341/Adafruit_ILI9341.h:12:0,

from graphicsTest.cpp:17:

/usr/include/mraa/gpio.h:40:1: error: expected initializer before 'extern'

extern "C" {

^

In file included from /usr/include/c++/4.9.1/new:40:0,

from /usr/include/c++/4.9.1/ext/new_allocator.h:33,

from /usr/include/c++/4.9.1/i586-poky-linux/bits/c++allocator.h:33,

from /usr/include/c++/4.9.1/bits/allocator.h:46,

from /usr/include/c++/4.9.1/string:41,

from /usr/include/mraa/common.hpp:29,

from /usr/include/mraa.hpp:27,

from graphicsTest.cpp:25:

/usr/include/c++/4.9.1/exception:35:37: error: expected declaration before end of line

# pragma GCC visibility push(default)

^

I've already installed git and g++ with the board by the commands you told me.

Thanks

Pedro_M_Intel
Employee
180 Views

Can you share your script? If you have downloaded the libraries and compiled the script in their directory there shouldn't be a problem, I would like to replicate this to see if I get the same behavior.

Peter.

Carlos_M_Intel
Employee
180 Views

Hi zhanghang,

Have you been able to compile and run your code successfully?

Could you share your script and let us from where are you downloading the libraries?

Regarding MRAA, which version do you have?

Regards,

Charlie

Reply