Photon how to setup local compiling

@mdma,
Thanks for the explanation of the meaning off this error. I will not disturb you with simple path matters, but as far as I see the path contains: C:\particle\Toolchain\GCC-ARM\bin;
and there are all the compiler executables. I keep digging.
compliments on the improvements of Photon over Core to you and the team, OTA is even faster than DFU!

.

one thing you all have seemed to miss, in linux it uses the ā€œ|ā€ char to pipe, windows uses a ā€œ;ā€ for the same thing, it doesnt use the |,

Sorry for the dumb question. Iā€™m a little weary of all the maintenance and just want something to be easy. Where in Linux do I put my application? Add the usual single folder content to ./core-firmware/usr/src? Can it use a .ino or do I have to rename that file to application.cpp?

I think I figured it out. You do have to rename .ino to application.cpp. The stuff goes into firmware/user/src. And flash user-part.bin. Here are the details.

# process for project in ~/particle/Thermostat-Particle-Photon/myThermostat_Particle_DEV
# and device PhotonOBDHYK
cd ~/particle
cp myThermostat-Particle-Photon/myThermostat_Particle_DEV/* firmware/user/src
cp firmware/user/src/myThermostat.ino firmware/user/src/application.cpp
cd /home/davegutz/particle/firmware/main && make clean all PLATFORM=photon
cd ~/particle/firmware/build/target/user-part/platform-6-m
particle flash PhotonOBD9HYK user-part.bin

The version is a llittle old. To get this to compile I had to rollback my Particle.variable syntax:

//Particle.variable("stat", statStr);
Particle.variable("stat", statStr.c_str(), STRING);

This works, anyway. I am running Ubuntu 14.04 on VirtualBox 5.0.10 within Windows 10.

Well Iā€™m sure the Particle team is working hard on the Linux DEV tool which will make the following obsolete very soon, I hope (and thanks by the way).
Here is my toolchain to get setup in Ubuntu 14.04 (I create a folder called ~/particle to contain this stuff). I queried tool versions as I went so you can see just how old this is (made 12/30/2015).

in linux install keys and github following the instructions on these links:
https://help.github.com/articles/generating-ssh-keys/

First install the node.js and npm packages following these instructions that also install Homebrew
http://blog.teamtreehouse.com/install-node-js-npm-linux

When I was done:

node -v
v0.10.37
npm -v
1.4.28

now at linux cli:

add_ppa() { grep -h "^deb.*$1" /etc/apt/sources.list.d/* > /dev/null 2>&1; if [ $? -ne 0 ]; then echo "Adding ppa:$1"; sudo add-apt-repository -y ppa:$1; return 0; fi; echo "ppa:$1 already exists"; return 1; }
add_ppa terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get -y install gcc-arm-none-eabi git

mkdir particle && cd particle
git clone https://github.com/spark/firmware && cd firmware && git checkout latest && cd main && make clean all PLATFORM=photon && cd ../build/target/user-part/platform-6-m

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update 
sudo apt-get install python-software-properties python g++ make nodejs sudo apt-get install build-essential libusb-1.0-0-dev

sudo npm install -g particle-cli
particle --version
1.8.20
particle cloud login
# answer the login questions

cd ~/particle
git clone git@github.com:spark/core-communication-lib.git
git clone git@github.com:spark/core-firmware.git
git clone git@github.com:spark/core-common-lib.git
git clone git://git.code.sf.net/p/dfu-util/dfu-util
cd dfu-util
sudo apt-get build-dep dfu-util
./autogen.sh
./configure
make
sudo make install
cd ..

# Test on Photon
# Hold down the mode button and press and release the reset button until the core starts flashing yellow, then release the mode button.
# Virtual Box - Devices - USB - select the "DFU Mode" device
sudo dfu-util -l

Should look something like:

   Found DFU: [2b04:d006] ver=0200, devnum=3, cfg=1, intf=0, alt=1,     name="@DCT Flash /0x00000000/01*016Kg", serial="00000000010C" Found DFU: [2b04:d006] ver=0200, devnum=3, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/03*016Ka,01*016Kg,01*064Kg,07*128Kg", serial="00000000010C" 

Build and flash tinker

cd /home/davegutz/particle/firmware/main && make clean all PLATFORM=photon
cd ~/particle/firmware/build/target/user-part/platform-6-m

cd ~/particle/firmware
particle setup
particle list

Threw error:

#Error loading command /usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js Error: Cannot find module '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v47-linux-x64/serialport.node'

#THIS IS OK.
IT SIMPLY MEANS YOUR VIRTUAL BOX SETTINGS FOR USB ARE UNSET. THE PARTICLE CLI WILL STILL FIND THE PHOTON.

The following should now work

particle flash PhotonExp9HYK tinker

Now load your project

cd ~/particle
git clone git@github.com:davegutz/myThermostat-Particle-Photon.git

Note: Have to revert you Particle.variable statements from

Particle.variable("stat", statStr);
# to
Particle.variable("stat", statStr.c_str(), STRING);

Now the redo loop for a project:

# redo loop for project in ~/particle/Thermostat-Particle-Photon/myThermostat_Particle_DEV
# and device PhotonExp9HYK
cd ~/particle
cp myThermostat-Particle-Photon/myThermostat_Particle_DEV/* firmware/user/src
cp firmware/user/src/myThermostat.ino firmware/user/src/application.cpp
cd /home/davegutz/particle/firmware/main && make clean all PLATFORM=photon
cd ~/particle/firmware/build/target/user-part/platform-6-m
# put your photon into flash safe mode (flash purple)
particle flash PhotonExp9HYK user-part.bin

####Update from git
cd ~/particle/myThermostat-Particle-Photon
git pull