Toolchain for Windows Installer

So, in an effort to make local building easier for people, I put together a basic installer for the Toolchain for Windows. It should download and install GCC Arm, GNU make, and the necessary components of the MinGW toolkit, and add them appropriately to the path. I generally followed @kennethlimcp’s guide here. I tested it on Win 7, so if something doesn’t work, let me know and I’ll try to fix it! This should decrease the number of steps necessary to get up and running with building locally:

  1. Get and run the installer for the toolchain
  2. (Recommended but not necessary) Install Git
  3. Download the Particle Firmware, either the zip or with git clone https://github.com/spark/firmware
  4. In a command prompt, go to the main folder
  5. run make clean all
15 Likes

Nice! :smiley:

Nicer than doughnuts!

Just tried the installer, everything ran good except when I tried this command

make PLATFORM=P1 clean all

this is the error I got. And I got a pop up saying the stat.exe crashed

Looks like stat is failing. :-/ This has been reported several times - I don’t know why - some issue with MinGW although some people seem to have managed to fix the problem without specifically mentioning how.

Here's what worked for me:

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.

The quick way to test if this works for you is to enter the following in your windows terminal:

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

@bpr, tried your suggestion for the path change, but I get the same error.

Last two suggestions:
Peruse your path and make sure you don’t have another make.exe on the path. I had an ancient Make.exe in a Borland Delphi bin folder that I had to rename. Second, ensure you didn’t leave the items C:\minGW;C:\minGW\msys\1.0\bin later in your path such that there are 2 instances of each.

Here’s my current path with top being 1st

C:\Particle\Toolchain\MinGW;
C:\Particle\Toolchain\MinGW\msys\1.0\bin;
C:\SparkCorePrograms\dfu;
C:\SparkCorePrograms\Git\bin;
C:\SparkCorePrograms\GNU Tools ARM Embedded\4.8 2014q2\bin;
C:\SparkCorePrograms\GnuWin32\bin;
C:\Users\Main\AppData\Roaming\npm;
C:\Particle\Toolchain\Make\bin;
C:\Particle\Toolchain\GCC-ARM\bin

Unless I’m mistaken, that looks like your USER path.
C:\MinGW\msys\1.0\bin has to be at the very beginning of your SYSTEM path (NOT later in the user path).
At least it did in my system.
I’d want to see what is displayed when you type “path” without the quotes in the terminal

1 Like

It’s also possible that @bpr’s comment about two makes is right, as it looks like you already had a toolchain setup for the Spark in your path. I’m working on a second release already, as I found that it seems to have trouble in Windows 10 Preview, so I’m switching how it assigns the Path. What version of Windows are you using?

Is this it? How do you change the system path?

C:\Users\Main>path
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files\ImageMagick-6.8.9-Q16;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Wind
owsPowerShell\v1.0;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\QuickT
ime\QTSystem;C:\Program Files (x86)\nodejs;C:\Program Files (x86)\Windows Kits
\8.1\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\110\Tool
s\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\M
icrosoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\NVIDIA Corporation\Ph
ysX\Common;C:\Particle\Toolchain\MinGW;C:\Particle\Toolchain\MinGW\msys\1.0\bin;
C:\SparkCorePrograms\dfu;C:\SparkCorePrograms\Git\bin;C:\SparkCorePrograms\GNU T
ools ARM Embedded\4.8 2014q2\bin;C:\SparkCorePrograms\GnuWin32\bin;C:\Users\Main
\AppData\Roaming\npm;C:\Particle\Toolchain\Make\bin;C:\Particle\Toolchain\GCC-AR
M\bin

C:\Users\Main>

@mumblepins, I’m using Windows 7 Ultimate

IF it’s a path problem like mine, what I did in my case is:
select Control Panel then System then Advanced then Environment then System Variables.
Scroll down in the BOTTOM window to the Path item, highlight it and click Edit…
Now, being super/ultra careful, add
C:\Particle\Toolchain\MinGW;C:\Particle\Toolchain\MinGW\msys\1.0\bin;
at the very beginning. YOU MUST NOT DELETE ANYTHING THAT"S ALREADY THERE. If you do destroy what’s already there, simply cancel the edit and retry. Once you get it right, click OK each window backing out.
BTW I always copy my paths and save them in a file safely first before editing.

Again, the simple temporary way to change the path and test if it’s the problem is the way I mentioned before, typing
set PATH=C:\Particle\Toolchain\MinGW;C:\Particle\Toolchain\MinGW\msys\1.0\bin;%PATH%
in the terminal window and not rebooting. I note you have MinGW in a different spot than I do so that may be why it didn’t work if you tried it before.

But I definitely defer to @mumblepins as he developed the install procedure.

To change the system path, the easiest way is search in the start menu for environ… and up will pop up “Edit the System Environment Variables” which will actually show you both the system and user variables. Temporarily you can also set it via the command set PATH=C:\Windows..... Whatever you want, seperated by semicolons or to append set PATH=%PATH%;C:\pathtoappend

Try a quick thing though first, open up a command prompt, run set PATH=C:\Particle\Toolchain\MinGW;C:\Particle\Toolchain\MinGW\msys\1.0\bin;C:\Particle\Toolchain\Make\bin;C:\Particle\Toolchain\GCC-ARM\bin and then run make.

1 Like

appears to have worked correctly. below is the output when runing: make PLATFORM=P1 clean all

Where does the files output to?

32+0 records in
32+0 records out
32 bytes (32 B) copied, 0 seconds, Infinity B/s
4+0 records in
4+0 records out
4 bytes (4 B) copied, 5.955 seconds, 0.0 kB/s
[ ! -f …/…/…/build/target/user-part/platform-8-m/user-part.bin ] || rm …/…/
…/build/target/user-part/platform-8-m/user-part.bin
mv …/…/…/build/target/user-part/platform-8-m/user-part.bin.pre_crc …/…/…/b
uild/target/user-part/platform-8-m/user-part.bin

arm-none-eabi-objcopy -O ihex …/…/…/build/target/user-part/platform-8-m/user-
part.elf …/…/…/build/target/user-part/platform-8-m/user-part.hex
arm-none-eabi-size --format=berkeley …/…/…/build/target/user-part/platform-8-
m/user-part.elf
text data bss dec hex filename
4596 144 332 5072 13d0 …/…/…/build/target/user-part/platform
-8-m/user-part.elf
arm-none-eabi-objdump -h -S …/…/…/build/target/user-part/platform-8-m/user-pa
rt.elf > …/…/…/build/target/user-part/platform-8-m/user-part.lst
make[1]: Leaving directory `/c/Users/Main/firmware/modules/photon/user-part’

C:\Users\Main\firmware\main>

Great! build/target/user-part/platform-8-m/user-part.bin is the main one you want.

1 Like

Is it possible to do this on Ubuntu?

I am normally a windows user but for some reason decided to setup a laptop for particle development using Ubuntu. I got the CLI working last night.

It’s probably easier. I can take a look at it in the next day or so.

I just tried updating the firmware to the development branch but I got the below: Did the new firmware update on the P1?

I went to the main and ran: make PLATFORM=P1 clean all program-dfu

© 2011-2012 Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

No valid DFU suffix signature
New DFU suffix added.
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
dfu-util -d 0x2B04:0xD008 -a 0 -s 0x80A0000:leave -D …/…/…/build/target/user-
part/platform-8-m/user-part.dfu
dfu-util 0.7

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

Filter on vendor = 0x2b04 product = 0xd008
Opening DFU capable USB device… ID 2b04:d008
Run-time device DFU version 011a
Found DFU: [2b04:d008] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /
0x08000000/03016Ka,01016Kg,01064Kg,07128Kg"
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
Dfu suffix version 100
DfuSe interface name: "Internal Flash "
Downloading to address = 0x080a0000, size = 4564

File downloaded successfully
Error during download get_status
Error during download get_status
make[1]: Leaving directory /c/Users/Main/firmware/modules/photon/user-part' make: Nothing to be done forprogram-dfu’.

C:\Users\Main\firmware\main>