Toolchain for Windows Installer

I’m not trying to hijack this thread, but since so many people are watching it… is there a Mac equivalent thread?

I’ve been out of touch with this for quite a while, but I see that people still use this, so I thought I’d update it some (while procrastinating PhD writing :-P). I’ve split the installer into two parts now, as the CLI and Toolchain are really quite independent. So, notes on the goods:

  • For everything, install defaults to C:\Particle
  • CLI Installer
    • Source
    • basically just installs NodeJS, the CLI itself, DFU-util, and downloads Zadig for your driver replacement pleasure. Puts everything in %InstallDir%\Tools\
  • Toolchain Installer
  • Source
  • Components:
    • Toolchain (GCC arm 4.9.3 right now, as 5 was giving trouble) and build tools (Includes make for windows, and mingw)
    • Git
    • Netbeans, with JDK and a NB project ready to go

Some other notes:

  • Tested with Win7 and Win10 blank virtual machines, so YMMV with other programs already installed.
  • I removed the default setup for the Netbeans compiler setup, as different versions of Netbeans kept screwing it up and it was easier to make a video showing the process (Note: May need to switch “Tool Collection Family” to Cygwin)
  • Cygwin may not be needed in Windows 7 for a successful build. Also, if you want to just build on Win10 without Cygwin, you may have to run a MSYS shell to be able to build successfully. I was getting an error in the CRC32 call in the build.
5 Likes

@RWB, the default way the installer works is to unzip the MinGW-get folder (not the mingw-get installer) to the C:\particle\toolchain\mingw folder, and then run mingw-get.exe install mingw32-base mingw32-gcc-g++ msys-make mingw-developer-toolkit from the mingw\bin folder. Then $INSTDIR\Toolchain\MinGW and $INSTDIR\Toolchain\MinGW\msys\1.0\bin get added to the path. I’m guessing though, that the new installer should help, along with the updated sources list that it looks at. I’ll try to stay on the updates of at least the sources more :slight_smile:

1 Like

@BulldogLowell, Mac setup should be pretty straightforward. For the toolchain itself, I’d follow the homebrew recommendation on the Github page. This page has a nice overview of how to get Make on OSX. Netbeans is available for OSX, and I’m pretty sure that the toolchain settings would be similar (though you’d need to find the right directory under /usr/local for the compilers)

Added to the Command Line Guide in the docs, thanks @mumblepins!!

3 Likes

is there a way to re-install everything included in the installer. I deleted a directory and the installer skips the files saying that these were already installed.

I’m not positive about this, but I’m pretty sure that if you run the uninstaller located in the root directory of where you installed the stuff, that should delete the registry entries that are make it think that those things are still there.

If you don’t want to do that or it doesn’t work, delete the registry key at:

Win64:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ParticleToolchainInstaller

Win32:
HKEY_LOCAL_MACHINE\SOFTWARE\ParticleToolchainInstaller

Thank you! Removing the registry key worked.

but i get this error in NetBeans

cd 'C:\Particle\firmware'
C:\Particle\Toolchain\Make\bin\make.exe clean PLATFORM=photon
Building firmware for Production Photon, platform ID: 6, product ID: 6
/C/Particle/Toolchain/Make/bin/make.exe -C ./communication clean
process_begin: CreateProcess(NULL, /C/Particle/Toolchain/Make/bin/make.exe -C ./communication clean, ...) failed.
make (e=2): The system cannot find the file specified.

make: *** [clean_communication] Error 2

CLEAN FAILED (exit value 2, total time: 110ms)

Figured it out! spell error “ParticleToolChain” -UPDATE

Ive got back to trying to program and compile locally using netbeans. I followed the instructions installed the tool chain and everything works fine. What would be the procedure for starting a new project in NetBeans?

I tried adding using existing sources for a C++ project and i get this error when i try build and clean. I dont see an option to add an existing makefile?

cd 'C:\Particle\apptest2\firmware\build'
C:\Particle\Toolchain\MinGW\msys\1.0\bin\make.exe -f makefile clean
make.exe": makefile: No such file or directory
make.exe": *** No rule to make target `makefile'.  Stop.

CLEAN FAILED (exit value 2, total time: 254ms)

The basic outline is New Project --> C++ from existing sources --> select the root folder of the firmware, the correct tool collection, and automatic should work. If you got to the project properties after it’s created, it should either be using a Working Directory of . (the root director), main, or modules (See the Build documentation for details). The error that you’re getting looks like that working directory is set to build for some reason.

Here’s what i just tried.
Git cloned a new firmware folder. Started a new project from existing sources. Selected firmware root folder. Tool collection to Particle Tool chain. Left everything else on automatic. This builds and cleans the project but i do not get the option of selecting a device configuration like the one in your sample project.

Here’s a scrreenshot of the props after build and clean are successful using default settings

Ah. In order to have the different configurations, you’ll need to modify the make command with PLATFORM=photon. You can also add multiple configurations with the manage configurations button

Awesome! Wish I had this when I first installed XD

got it!! I can modify the existing tinker app now and reflash it. What about starting a new project? I made a new folder in application directory and with just one function in it to try it out. How do i build a firmware from here? The file does not compile and gives an error saying

cd 'C:\Particle\firmware'
C:/Particle/Toolchain/MinGW/msys/1.0/bin/sh.exe -c 'C:/Particle/Toolchain/GCC-ARM/bin/arm-none-eabi-g++.exe' -g -o NUL -c '/C/Particle/firmware/user/applications/new/newmain.cpp'
c:/Particle/firmware/user/applications/new/newmain.cpp:15:25: fatal error: application.h: No such file or directory
 #include "application.h"
                         ^
compilation terminated.

COMPILE FILE FAILED (exit value 1, total time: 454ms)

What’s the build command? You’ll need to add APP=nameofapp to the build command. If I remember right you might need to build in the main or modules directory as well. I find it best to try things out from just the command line, to see if things are working right. Read the build.md file a bunch, it’s got lots of options and details.

I managed to build from the command line with success. And then followed the same commands in the project settings to build myapp. It still shows me error if i hit F9(compile).

cd 'C:\Particle\firmware\main'
C:/Particle/Toolchain/MinGW/msys/1.0/bin/sh.exe -c 'C:/Particle/Toolchain/GCC-ARM/bin/arm-none-eabi-g++.exe' -g -o NUL -c '/C/Particle/firmware/user/applications/myapp/newfile.cpp'
c:/Particle/firmware/user/applications/myapp/newfile.cpp:1:25: fatal error: application.h: No such file or directory
 #include "application.h"
                         ^
compilation terminated.

COMPILE FILE FAILED (exit value 1, total time: 117ms)

Update

Fixed everything !! and figured out why F9 wont work. Thank you @mumblepins! Im flashing OTA using CLI but can i set the run button to do this?

Hi and thanks for the great work @mumblepins!

I got everything installed and fought through a few issues. (One being that NetBeans didn’t like having the project in my Documents folder structure.)

Right now I’m facing a very strange problem where I can build from the commandline but NetBeans is failing.

Here’s a link to the thread I opened in the community under Troubleshooting:
Thread

Hi,

After a clean install of the toolchain, when I run the “make all PLATFORM=electron -s” command, I get this output:

Can't locate Archive/Zip.pm in @INC (you may need to
install the Archive::Zip module) (@INC contains: blib/lib lib 
/usr/lib/perl5/site_perl /usr/share/perl5/site_perl 
/usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl 
/usr/lib/perl5/core_perl /usr/share/perl5/core_perl .) at 
/c/Particle/Toolchain/MinGW/msys/1.0/bin/crc32 line 7.BEGIN failed--compilation aborted at /c/Particle/Toolchain/MinGW/msys/1.0/bin/crc32 line 7.
text    data     bss     dec     hex filename
34676     568    1484   36728    8f78 ../../../build/target/user-part/platform-10-m/user-part.elf

After this I tried installing the toolchain on a laptop with a fresh Windows10 installation. The same thing happened.
The first time, in the setup, I unchecked the “Git”, “Particle Firmware”, and “Netbeans” options. The second time I left the “Git” option checked. Am I having this problem because I didn’t do a full install?

I’m using Visual Studio Code to edit my code and I did a manual clone of the repository.

Thank you!

Same Problem here with Archive/Zip.pm. ANy Helps?