How to video for compiling locally in Windows


#1

Here is a video link i made showing all the steps needed to compile locally on windows.
The IDE is Netbeans v7.4. You can compile and download to the spark core all within the IDE. You dont need the command line for anything anymore. The IDE even has git installed.


Tutorial: Installing DFU-Driver on Windows [24 Feb 2015]
How do I build manually on OS X? [SOLVED]
Firmware Tips and Tricks
Core connected to wifi but can't find it in APP [SOLVED]
Can anyone supply CooCox CoIDE project file for Spark Core?
Netbeans IDE easy to set up, but how do I configure it for GDB debug?
How can I build apps locally like I do on the WEB IDE?
Trailing whitespace in spark.include file breaks CLI compile [REPORTED]
Debugging with JTAG shield
How to include a library, because I'm failing :(
Can the Spark Core trigger the Reset Pin?
Can the Spark Core trigger the Reset Pin?
#2

Sorry guys, i will be uploading a HQ video shortly .

[EDIT] HQ is up, ensure its HQ by using the gearwheel and then click full screen.


#3

Awexome @seulater! Well spoken nice tutorial… I’m going to give it a watch at lunch time here as soon as the HD version is up :smile:


#4

Cool! Nice tutorial!


#5

Watched the whole thing, great job! I don’t think I would have ever considered NetBeans but it looks nice and straight forward. Does it have auto-complete and method/function definition lookups? Also have you tried to do any debugging with it? Monokai theme? :smile:

I’m almost inclined to wipe my installation and try it your way to avoid the rigged batch files that delete various directories so I can build each time… the result is a full length build every time, vs. 2 seconds like you show in your video.

Only thing I caught in your video that might throw someone off is you delete the whole PATH variable instead of appending your directories to the existing PATH. I realize you were probably using a fresh install of windows, so there might not have been anything extra in the PATH, but usually there is.

Should this thread be in the Tutorials Section? Definitely should link to this video directly from the Core-Firmware readme.md :wink:


#6

Thanks a lot @seulater, I do use NetBeans for all my other development, so this will very helpful.

@BDub It does have autocomplete and method/function definition lookups (at least for PHP, I haven’t tried with arduino to be honest)

There is a dark theme, which you could use with the Monokai theme (avail. download), although the code editor and file/classes/vars browser will be slightly different colors or if you are flexible with the theme, use the built in dark one and everything will match. Like this one: http://i.imgur.com/pAhmFo1.png


#7

Good idea, i updated the video with a note concerning this. Thanks.


#8

Oh very nice! Definitely downloading this tonight.


#9

This is great, thanks @seulater! Mind if we share this on our Resources page?


#10

Feel free to share at will. It was made to help so let it help :wink:


#11

Brilliant. I followed the instructions and everything works. Thank you @seulater
As a newcomer to NetBeans and makefiles I was thrown for a while when I tried to compile my own code instead of just modifying application.cpp and despite apparent success the code on the core didn’t seem to change.
However all that was necessary was to edit build.mk in the src directory and replace application.cpp with my own program name. Blisteringly obvious to those of you who know what you are doing …


#12

I should have added that now that you mention it.
For those unaware. If you want to add your own files simply do this.
Navigate to the core-firmware folder, then src. in there you will find a file called “build.mk”. Double click on it to open it. In there you will notice the start of the following:

C++ source files included in this build.

CPPSRC += $(TARGET_SRC_PATH)/application.cpp
CPPSRC += $(TARGET_SRC_PATH)/main.cpp
CPPSRC += $(TARGET_SRC_PATH)/newlib_stubs.cpp
CPPSRC += $(TARGET_SRC_PATH)/spark_utilities.cpp
CPPSRC += $(TARGET_SRC_PATH)/spark_wiring.cpp

All you need to do from here is create your new file, we will call ours my_test.cpp
and my_test.h

Put the my_test.cpp in the core-firmware/src folder and the my_test.h in the core-firmware/inc folder.
then edit the build.mk file by adding your new file to it. add a new line to the start of the “CPPSRC += …” lines and add this:
CPPSRC += $(TARGET_SRC_PATH)/my_test.cpp
save it and your done.


#13

p.s. now I’ve got that working, can I access the USB port to see Serial.print() output to monitor and debug programs? @BDub has a workable solution using sparkcore.inf but what do I do now I have zadig installed instead? And of course Serial.read() would be a useful bonus. Thanks again.


#14

you sure can.
to access the USB for serial do this.

Serial.begin(115200);  // or other baud rate you desire
Serial.println("Hello World");

To access the second serial pins labeled on the board as TX/RX you would do this:

Serial1.begin(115200);
Serial1.println("Hello World");

#15

The Zadig driver works as a CORE DFU driver and also as a USB SERIAL virtual COM driver :wink:

(EDIT: scratch that, you have to install both the Zadig and Spark_Core.inf drivers)

You may want to do this if you can’t open your port on the computer:

// Have serial monitor closed before you boot the Spark Core
// After it connects to the cloud, serial.begin() is run and the serial driver is loaded
Serial.begin(115200);  // At this point you can open your serial monitor
while(!Serial.available()); // press ENTER
Serial.println("Hello World"); // Your program runs and talks over serial fine now

#16

Your demo software works fine when I plug the Spark into another computer with the sparkcore.ing driver. On the computer with NetBeans, when the yellow LED is flashing the Spark shows up on the device Manager as a CORE DFU.
When running the program and breathing cyan it shows as Other Devices/SparkCore with WiFi and the properties tell me there is no driver. Have I installed the zadig driver wrongly or is there a step I’m missing to get it to run as a virtual COM driver too?


#17

OK Serial communications sorted. I messed around with zadig but couldn’t get it to load a virtual COM port for me. However when I followed @BDub’s instructions for installing the sparkcore.inf driver it worked perfectly happily alongside the zadig installed USB driver.
The process was:
press mode and click reset get yellow flashing LED
run zadig and install USB driver for Spark Core
run BDub’s Serial software so that the spark is waiting for serial input (I dare say listening mode would work too but I’m quitting while I’m ahead) and follow his instructions - briefly
go to control panel/system/device manager and find Spark Core
right click, install driver (delete existing driver first in my case after messing with zadig)

The zadig driver is there when the yellow LED is flashing
The sparkcode.inf driver is there when the cyan LED is breathing

It is a mystery to me but it works so many thanks to Bdub and @seulater

Now if some wise soul can get the Serial communications going through the Netbeans Terminal window that would be awesome.


#18

Hmm, all this time I thought I had deleted the spark_core.inf driver and the zadig was doing both core dfu and serial. I just checked, nope! Thanks for the correction :wink:


#19

@seulater @BDub

Just wanted to thank you very much for the video. It allowed me a guy pretty new to the micro processor world to actually learn how to flash the spark core and how to pull firmware from Git Hub.

The only thing that tripped me up the first time was that when pasting the path = info which I copied from someplace (Not your Youtube Description) that had added a “-” to part of the path description which broke the path description.

So when I tried to type Make into the command prompt it would not run because the path was not setup right due to the dash. I copied the path data directly from the Youtube video description and it solved the problem.

So if your looking to load new firmware on the Spark Core and have no idea how to do it then this video will allow you to get the job done. You’ll learn a few things in the process also.

Thanks for making and sharing the video, without it I don’t think I would have ever figured it out.


#20

I have seen on several threads that people have issues with the Windows folder “Program Files (x86)” and the common cure is to install or copy things to different folders.
Where this does work, there is another even easier work around that keeps things in place and still saves us from having problems with the weird Windows naming.

You can just create a link to the “Program Files (x86)” folder that does not contain any disliked characters, setup your PATH refering to this link instead of “Program Files (x86)” and there you go.
Windows is still happy, anybody who might be looking for a program will find it where it is expected to live and you don’t have to have multiple instances of the same files or programs scatterd over several folders - apart from those two :rage: Windows ones.