Local toolchain with Windows [SOLVED]

I followed the (not so clear at times) instructions on installing the local toolchain and repositories in a Windows (8.1 in my case) environment. The paths are set correctly and the tools run just fine but I believe the makefiles will not work in windows. First, the rm and mkdir commands have command line arguments not compatible with the Windows version. Second, the rm and mkdir commands will not run correctly in windows due to the “/” versus “” problem. I edited the makefiles and made changes as follows:

rm = del
mkdir = mkdir

So when I run make as instructed, I get:

Building core-common-lib
Building file: ../CC3000_Host_Driver/cc3000_common.c
Invoking: ARM GCC C Compiler
mkdir obj/CC3000_Host_Driver/
The syntax of the command is incorrect.
make[1]: *** [obj/CC3000_Host_Driver/cc3000_common.o] Error 1
make: *** [check_external_deps] Error 2

Make cannot create the necessary directories. First, because Windows mkdir cannot create the entire path in one command. Second because the “/” syntax is wrong. Obviously, the version of MAKE is for Windows so there has to be a way for this to work. Perhaps the makefiles need to be changed to work in Windows?

Is there a gnuWin32 or other version of mkdir that works as expected?

[UPDATE] The Windows version git installed as part of the toolchain has version of rm and mkdir that can be specified in the makefiles. I edited the makefile in each of the three repositories and changed the rm and mkdir entries as follows:

RM = "C:\Program Files (x86)\Git\bin\mkdir.exe" -f
MKDIR = "C:\Program Files (x86)\Git\bin\mkdir.exe" -p

When I ran make from the core-firmware/build directory again, it worked perfectly with no errors. Perhaps this information should be included in your toolchain instructions! :smile:


Another option…

If you install GitHub for Windows, Git-aware shells are pre-configured on your system. In the GitHub Windows app, select tools, then Options… to define the default shell, which can be Cmd, Git Bash, PowerShell or Custom.

To start a Git-aware shell, press the Windows key and type “git” and select Git Shell. Now when you use commands like RM and MKDIR, they “just work”.

1 Like

No dice. Spent about 2 hours on this. I revert to Bdubs firmware until Spark gets it right.

I have been running into the same problem and when I followed https://community.spark.io/t/how-to-video-for-compiling-locally-in-windows/2457 I encountered the problem in net beans. Once in ensured that make and net beans ran with elevated privileges everything worked perfectly. If you are in Windows, it is important to run with Administrator privileges if you doing things from a standard user account.

This is what works for me.

I moved a post to a new topic: Local toolchain on Windows 8.1 Pro x64 error

Edit: False Alarm sorry

Hi @nitred - just a tip on using the makefile on Windows. It’s best to install mingw and the msys and have both in the path. Then mkdir/rm etc… works without needing to modify the makefile.

You can either set this up in your system path, or have a small batch script do it. (I use the same script to also setup the environment before launching netbeans.)

Should that last bit have RM = “C:\Program Files (x86)\Git\bin\rm.exe” -f ?

@greenoutlet, THESE INSTRUCTIONS ARE OLD and do not apply to the latest firmware (from the Spark github)!!!

1 Like

[quote=“peekay123, post:10, topic:2230”]THESE INSTRUCTIONS ARE OLD[/quote]Nevermind! Updated instructions are below.

@naikrovek, I was not trying to make things more difficult. The reality is that as Spark evolves quickly so do affected systems. When I posted that the information was old it is because of large changes to the local toolchain make files that I had not come up to speed with. I have since figured it out and I will post the latest method.

I don’t know why you say it is difficult to compile in Windows however. I have the local toolchain working on both Windows 7 and 8.1 without any issues. The trick is installing the necessary support tools like gcc. I also have Spark CLI and DEV working just fine without any issues either. However, I DO NOT use an environment like Eclipse or Netbeans. Those are well documented in other topics.

I’ll try and post the “latest” instructions later today. :slight_smile:

1 Like

Thanks. Sorry to be a pain. I just HATE C with a passion and these little issues don’t help me much.

Yah, and don’t do it just for me. I just won’t have a local build environment, that’s ok. I dislike C and I’m pretty sure that the people who like C are fully capable of setting up their own environments without help.

@naikrovek, C++ is the backbone of most Arduino “compatible” platforms! So, to use the local toolchain, you need to have the following installed:

  1. GNU Tools for ARM for windows v4.8 2014q3 (or higher)
  2. GnuWin32 Make 3.81
  3. Git v1.94 for windows for cloning the firmware repo
  4. Anything else listed in the Spark Firmware repo readme file

Once you have installed everything, make sure the path includes the programs you installed (for example):

C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q3\bin;C:\Program
Files (x86)\GnuWin32\bin;C:\win32-mingw32

In the latest firmware repos, there is a build directory in each directory:


In each you will find a file “makefile” and in the core-firmware \build you will also find a tools.mk file. I modified these files as follows:

core-firmware\build\tools.mk: Change the last three lines with:

# RM = rm -f
# RMDIR = rm -f -r
# MKDIR = mkdir -p

RM = "C:\Program Files (x86)\Git\bin\rm.exe" -f
RMDIR = "C:\Program Files (x86)\Git\bin\rm.exe" -f -r
MKDIR = "C:\Program Files (x86)\Git\bin\mkdir.exe" -p

In the core-common-lib\build\makefile and core-communication-lib\build\makefile, comment out:

#  RM = rm -f
# MKDIR = mkdir -p

and add:

RM = "C:\Program Files (x86)\Git\bin\mkdir.exe" -f
MKDIR = "C:\Program Files (x86)\Git\bin\mkdir.exe" -p

These changes point to the MAKE compatible programs (rm.exe and mkdir.exe) exec files in the Git BIN directory. If everything went well, running “make” from the core-firmware\build directory should build the default Tinker app (and firmware). :smile:

1 Like

I found that I didn’t have to modify the makefile if I used the Git Shell that comes with GitHub for Windows. In fact, I’m pretty sure I didn’t have to modify anything. Just downloading make, the ARM GCC and some supporting DLLs for make then adding it all to my path was enough.

Compiled and flashed the core from the command line in less than a minute, more or less. Very nice experience.

1 Like

@naikrovek, which github for windows are you using? Do you have a link to the download?

http://windows.github.com/ I believe.

Choose your shell in the options dialog, (I chose “Bash Shell”) then click OK.

After that you can push the backtick/tilde key at just about any time to enter the shell.

@naikrovek, I am using a different tool it seems. Can’t quite remember why I did that. I’ll give that a shot tonight. Thanks! :smile:

I have just installed the toolchain on a new windows 7 PC using all the latest files from the git. I used @mdma 's version of dfu-util as the link in the spark/firmware GitHub is broken.

I get the expected error (that I didn’t get with my old version of the tool chain) when using the windows terminal.

E:\>cd Spark\core-firmware\build

Building core-common-lib
Building file: ../CC3000_Host_Driver/cc3000_common.c
Invoking: ARM GCC C Compiler
mkdir -p obj/CC3000_Host_Driver/
The syntax of the command is incorrect.
make[1]: *** [obj/CC3000_Host_Driver/cc3000_common.o] Error 1
make: *** [check_external_deps] Error 2

When I use Git Bash I get

Pete@Media-PC ~
$ cd /e/Spark/core-firmware/build
$ make
sh: C:\Program: No such file or directory
make: *** [check_external_deps] Error 127

@naikrovek where did you put your various files? Did any of the directories have spaces in the directory name? I think I have the correct path settings and can see them both in Windows and Git bash.

1 Like


you can consider using this feature/hal branch with everything combined and some fixes: https://github.com/spark/firmware/tree/feature/hal

Only that bunch of files will be required for local compilation :smile: