-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.js
28 lines (22 loc) · 1 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Super-simple wrapper around the `arduino-builder` CLI tool
// setting up the neccesary paths
var path = require('path');
var sketch = process.argv[2] || 'build/blink/blink.ino';
var board = process.argv[3] || 'esp8266com:esp8266:nodemcuv2:CpuFrequency=80,UploadSpeed=115200,FlashSize=4M3M'
var arduinoDir = process.env.ARDUINO || process.env.HOME + "/arduino-1.8.1";
var buildDir = path.join(path.dirname(sketch), 'builder');
var builder = path.join(arduinoDir, 'arduino-builder');
var prefs = "";
if (board.indexOf('tivac') != -1) {
var armGcc = path.join(arduinoDir, 'hardware/tools/arm-none-eabi-gcc/4.8.3-2014q1');
prefs = ' -prefs runtime.tools.arm-none-eabi-gcc.path=' + armGcc;
}
var cmd = builder + ' -compile ' + ' -verbose' +
" -hardware " + path.join(arduinoDir, 'hardware') +
' -tools ' + path.join(arduinoDir, 'tools-builder') +
' -tools ' + path.join(arduinoDir, 'hardware', 'tools') +
prefs +
' -libraries ' + './' +
' -fqbn ' + board +
' ' + sketch;
console.log(cmd);