Eclipse IDE setup for Photon(MAC)


#1

Hey everyone. I spent a couple days setting Eclipse up for Photon development on a Mac and thought I would put together a step by step guide. Please let me know if you have any questions or find anything wrong with the guide that needs to be corrected. Here is the link to the guide:

https://docs.google.com/document/d/1ied3PtoBCnuNVykivFmxCjPdtzI5B12bCS515ZjIwMU/edit?usp=sharing


#2

Sounds awesome, I’ll try this and comment later.


#3

Sounds good. Let me know if you get tripped up. I’d like to get the guide ironed out really well for people that need it.


#4

I just started doing, and noticed that there was a line

make platform=PHOTON clear all program-dfu

Which gives errors so I used:

make clean all PLATFORM=photon program-dfu

I’ll continue with the install.


#5

OK apart from that one line, which was correct later, it works fine. Nice job man!

OK here’s the problems I had on my computer. Like you said you Eclipse-$PATH != gobal unix $PATH so I added on my computer
/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin
It’ll be different to everyone else, but something like that

I tried adding serial terminal directly to Eclipse, but didn’t work now. I’ll try that later as well. EDIT. Seems like there’s some problem on Mac with RXTX library, and would need some serious hacking. I’m not sure if I bother, I’ll check how it is in the Arduino Eclipse version, but if it seems hard I’ll just use something else.

EDIT 2.
OK after a bit of digging around the RXTX plugin for serial communications directly from Eclipse is compatible only with 32 bit version. There is a 64bit linux port, but even this has major issues. If anyone has a solution that’d be great.

EDIT 3.

If you wish to compile with the develop branch you should use this in part 13).

make APP=myapp PLATFORM_ID=6 PARTICLE_DEVELOP=1 clean all


#6

Hey Thanks man. Glad somebody went through this guide. Its always hard to error check your own documentation because of course everything makes sense to you when you write it.

I never jacked with trying to get serial debug working in eclipse but it would be awesome. I use Zoc6 utility which works pretty good, not sure if it is still free or not. Kind of funny there isn’t a really good serial terminal program for mac other than the terminal itself :smile:

Ill make sure to get that line fixed in the guide. If anyone else sees anything pleas let me know.


#7

Hey @IOTrav and @FistOfTheNorthStar you two are awesome!!

I’ve been following this thread, and the quick progression has been great!

Sorry I don’t have anything to add to it at the moment, but I think you two working this out
is a great example of the community helping each other.

-Corey


#8

Hi Corey,

Thank you. Hopefully users will find this helpful in the future. I thought there was no sense in someone else having to figure this out again.


#9

So I noticed if I removed clean and all from the Build command under C/C++ Build the build was wicked fast and still seems to be working as expected. @FistOfTheNorthStar can you confirm removing that still works for you? Here is a pick of my settings.


If we confirm this works I would move that we alter this line in the document.


#10

Adding “clean all” to the make command line forces it to remake everything, every time. Basicly emulating a script that builds everything from scratch.

Removing “clean” lets make do what it is best at, only rebuilding the absolute minimum of targets required to succeed, hence the faster build.

I believe “all” is the default target, so you can leave it on the command line if you wish.


#11

That’s right. You should use it though when you fetch (all) from git (update). Or if you do other changes to the underlying libraries, but if you’re just doing programming to your app then clean all is not needed.


#12

Thanks @AndyW You appear to have said it best there. Yes all does appear to be executed by make by default so it does not have to be entered in the Build command line in Eclipse and after a little studying I had thought clean meant to rebuild everything as opposed to only rebuilding resources which have changed since the last make. Thank you for chiming in on that and confirming. The build in Eclipse is now taking around 1.278 seconds as opposed to 13 seconds when performing clean as well previously. I am going to go ahead and update the document for future users.


#13

You should not need to do a clean after refreshing from git or changing libraries, that kind of stuff is make’s day job.

If it does not do the right thing, then that is a bug and needs to be fixed by changes to the makefile(s).

I can see maybe using clean after you switch branches within git, but only to ensure that the first build after switching is fresh.


#14

Thanks guys. Documentation has been updates so clean is not performed each time. This thread however notes possible uses for it.


#15

Hey @IOTrav @FistOfTheNorthStar,

Once I verify all of this information, I will most likely include in this how-tos or one of our tutorials in the near future.

Thanks Again.
-Corey


#16

Great @corey I hope it helps others.


#17

Thanks very much for this guide! It’s been a real time-saver for me.
However, I have a problem.
I installed everything as outlined in the document (although I’m using the v0.4.9-rc1 branch, commit 3b49233). The build works fine. I can flash programs to my Photon, but there’s nothing happening there. I don’t get the “test” message (I use CoolTerm) over the wire. When I flash the same program with Particle cloud, it’s working.
Also, I don’t get any response when I try to flash a “blink an led” application via Eclipse: I can flash the program, the Photon restarts, but doesn’t do anything (it’s breathing, but the LED is not flashing)
Here’s my output log:

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x080a0000, size = 18292

Download    [                         ]   0%            0 bytes
Download    [                         ]   0%            0 bytes
Download    [=====                    ]  22%         4096 bytes
Download    [===========              ]  44%         8192 bytes
Download    [================         ]  67%        12288 bytes
Download    [======================   ]  89%        16384 bytes
Download    [=========================] 100%        18292 bytes
Download done.
File downloaded successfully

Any idea what is wrong? When I look in the myapp.bin and myapp.elf-files I find the “test”-string, so it seems to me that it’s built well.


#18

Uh oh - it seems to work with the branch you checked out in your document: photon_043. I don’t know why it won’t work with the latest code, but I’m happy it works now.


#19

You might need to add something to the Build Command for that version of firmware. I ran into that when trying to use the latest develop branch. If you checkout @FistOfTheNorthStar’s comment above you can see where he said to use PARTICLE_DEVELOP=1 if you want to compile from the develop branch. I wonder if the branch you are trying to use requires something similar.


#20

I found out that commit 49bfae601 works, and 6c5b6bd doesn’t work anymore. There’s something like

#define SYSTEM_VERSION_v048  0x00040800

and the SYSTEM_VERSION is set to that version. Maybe it has to do something with that?