Photon, local build, on Windows

@mdma i think i have the problem with creds not being written… do you know what was happening to cause it? i have downloaded the 2 files (photon 0.4.2 release) and flashed them to the photon but still its not saving the creds… i can enter them in with the terminal no probs and it connects and gets to breathing cyan but after a power cycle it wont reconnect.

also i noticed particle setup errors when trying to set it up… here is the output (it was connected via USB and blinking blue)

C:\Spark\photon>particle setup
                  _   _      _        _
 _ __   __ _ _ __| |_(_) ___| | ___  (_) ___
| '_ \ / _` | '__| __| |/ __| |/ _ \ | |/ _ \
| |_) | (_| | |  | |_| | (__| |  __/_| | (_) |
| .__/ \__,_|_|   \__|_|\___|_|\___(_)_|\___/
|_|                     https://particle.io/

> Setup is easy! Let's get started...
> It appears as though you are already logged in as chrxxx@xxxxxx.au
? Would you like to log in with a different account? No

! PROTIP: Hold the MODE/SETUP button on your device until it blinks blue!
! PROTIP: Please make sure you are connected to the internet.

> No devices detected via USB.
? Would you like to scan for nearby Photons in Wi-Fi setup mode? Yes

! PROTIP: Wireless setup of Photons works like a wizard!
! PROTIP: We will automagically change the Wi-Fi network to which your computer is connected.
! PROTIP: You may lose your connection to the internet for a moment.

? Found "Photon-LE8D". Would you like to perform setup on this one now? Yes

! PROTIP: You will need to know the password for your Wi-Fi network (if any) to proceed.
! PROTIP: You can press ctrl + C to quit setup at any time.

! Woops. Something went wrong connecting to Photon-LE8D. Please manually re-connect to your Wi-Fi network.

Ok, I believe that the Error 74 is nothing to worry about, and is a result of the dfu-util returning Error during download get_status, as is listed in the firmware readme as "You can ignore this message for now. We're not sure what this error is all about. I'm still not sure what the issue with the stat not working in the cmd prompt is for you guys, I haven't had any issues with that. I also have cygwin installed, not sure if that has made any difference in the operation of stat.

With the various errors, I've been finding that it's quite important to keep the system firmware and the user firmware compiled with the same codebase. Per the makefile readme:

When building locally on the photon from the develop branch, it is necessary to update the system firmware to the latest version:

put the Photon in DFU mode
cd modules
make PLATFORM=photon clean all program-dfu
You can optionally add APP/APPDIR/TEST values to the command above to build a specific user app.
This will flash the latest system modules and the default user application to your device.

A key indicator that this is necessary is that the Photon doesn't run your application after flashing, due to a version mis-match. (A future release will turn the LED purple to indicate Safe Mode when the user firmware isn't run.)

I've been having success with this order:

  1. Get the newest firmware from origin/develop
  2. go into the modules folder, and run make clean all program-dfu PLATFORM=photon w/ the Photon in dfu mode
  3. The two system firmwares will be updated, and then the user firmware
  4. Modify user\src\application.cpp for your code
  5. Go into the main folder, and run make all program-dfu PLATFORM=photon

So far that seems to be working. Alternatively, it's also been working, after running the step 4, making without program-dfu, and then uploading via the Particle-CLI. I'm finding though, that if the system firmware code was changed (i.e. a pull of newer orign/develop code), the make clean all program-dfu in the modules folder has to be redone.

1 Like

Thank you @mumblepins for the summary. And I discovered that I now can use the simple windows command prompt on Win7 64 to compile and flash as long as I force the minGW path to PRECEDE the existing PATH by using the command:

set PATH=C:\minGW;C:\minGW\msys\1.0\bin;%PATH%

for some reason (some other offending executable on the old path?) putting mingGW on the path later bombs with the stat.exe error while putting it before all other items resolves the error, though the inconsequential Error 74 and Error 2 messages still display without evident harm.
Edit: also solves identical program I had on Win8.1 64 laptop. Compiles and flashes successfully.
Note: if you use the set PATH method, you have to re-invoke the command if you close and then reopen the Windows command prompt.

Maybe try a where stat to see which file is called in both path versions? That could be helpful for other people with this problem.

where stat yields C:\minGW\msys\1.0\bin\stat.exe either way. Strange.

Edit: but I checked and the stat.exe error only seems to happen if I do a ‘make clean all’, or when the .bin files aren’t already present. It’s as if the compile loses it’s way trying to create the .bin files

Sorry for taking so long to put my 2 cents worth here. I have everything running great on my Win7x64 system. I have the latest minGW, gnu tools 4.9 2015q1, GnuWin32 make 3.81 and Git-1.9.5-preview20150319. The END of my DOS command prompt path is:

...C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q1\bin;C:\Program Files (x86)\GnuWin32\bin;C:\MinGW\msys\1.0\bin;C:\Git\bin

The path order is important. I hope this helps! :smile:

1 Like

So i seem to have it all working now (compile part)…Thanks everyone for your help

Only problem now is i cant get the photon to “turn on” by itself, i have to push the reset button after switching it on. and its not saving the wifi cred’s and i have to enter them every time…

Thanks @peekay123. Your path doesn’t work for me, however. The only thing that does is putting C:\MinGW\msys\1.0\bin at the very beginning of my system path (not later in the user path). Perhaps it’s because I have so many older programs and paths that I never got rid of over the years as I upgraded windows versions.

2 Likes

The same problem (multiple definition of sscanf) happens with local build on Linux when using older versions of GCC-ARM.

To ensure that the right gcc is used, you can pass GCC_PREFIX to make. E.g.
make PLATFORM=photon GCC_PREFIX=~/Tools/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- APP=myapp

Then you don’t have to worry about your PATH.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\William\Documents\GitHub>g:

G:>cd Particle\firmware\modules

G:\Particle\firmware\modules>make PLATFORM =photon clean all
make: *** empty variable name. Stop.

G:\Particle\firmware\modules>make PLATFORM=photon clean all
The system cannot find the file specified.
The system cannot find the file specified.
clean all
make -C G:/Particle/firmware/modules/photon/system-part1/ clean all PLATFORM=ph
oton
process_begin: CreateProcess(NULL, git rev-parse --abbrev-ref HEAD, ...) failed.

The system cannot find the path specified.
The system cannot find the path specified.
'arm-none-eabi-gcc' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the file specified.
The system cannot find the file specified.
make[1]: Entering directory `G:/Particle/firmware/modules/photon/system-part1'
make -C ../../../communication clean
process_begin: CreateProcess(NULL, git rev-parse --abbrev-ref HEAD, ...) failed.

The system cannot find the path specified.
The system cannot find the path specified.
'arm-none-eabi-gcc' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the file specified.
The system cannot find the file specified.
make[2]: Entering directory G:/Particle/firmware/communication' rm -f ../build/target/communication/platform-6-m-prod-6/lib/tropicssl/library/ae s.o ../build/target/communication/platform-6-m-prod-6/lib/tropicssl/library/bign bla bla bla .o.d ../build/target/communication/platform-6-m-prod-6/src/dsakeygen.o.d ../buil d/target/communication/platform-6-m-prod-6/libcommunication.a, ...) failed. make (e=2): The system cannot find the file specified. make[2]: *** [clean] Error 2 make[2]: Leaving directory G:/Particle/firmware/communication'
make[1]: *** [clean_communication] Error 2
make[1]: Leaving directory `G:/Particle/firmware/modules/photon/system-part1'
make: *** [G:/Particle/firmware/modules/photon/system-part1/makefile] Error 2

G:\Particle\firmware\modules>

win 8.1
I had been able to compile on netbeans for the spark core
I am trying to change to a 'particle photon'
so far i have retrieved all firmware from git.
upgraded my compiler to '4.9 2015q2' (arm-none-eabi-gcc -- help returns the help info)
have spent 2 days trying everything, and reading forums
what have i missed

You have a space there… should be make clean all PLATFORM=photon

Another error here… Did you add to PATH?
–>'arm-none-eabi-gcc' is not recognized as an internal or external command,

I had run into similar issues recently, and this is how I got the issue resolved. It might help you. Do take a look.