Initial Teensy upload work

This commit is contained in:
Josh Stewart 2020-10-21 13:05:17 +11:00
parent e6f8a751b5
commit f6f1a6b7ce
62 changed files with 348 additions and 11 deletions

1
bin/pacakge_urls Normal file
View File

@ -0,0 +1 @@
http://dl.platformio.org/packages/manifest.json

View File

@ -0,0 +1,12 @@
{
"description": "Teensy Loader",
"name": "tool-teensy",
"system": [
"linux_armv6l",
"linux_armv7l",
"linux_armv8l",
"linux_aarch64"
],
"url": "https://www.pjrc.com/teensy/loader.html",
"version": "1.3.0"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
{
"description": "Teensy Loader",
"name": "tool-teensy",
"system": "darwin_x86_64",
"url": "https://www.pjrc.com/teensy/loader.html",
"version": "1.152.0"
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Documentation for this format is at -->
<!-- http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigFiles.html -->
<key>CFBundleDisplayName</key>
<string>Teensy</string>
<key>CFBundleIdentifier</key>
<string>com.pjrc.teensy</string>
<key>CFBundleName</key>
<string>Teensy</string>
<key>CFBundleShortVersionString</key>
<string>1.52</string>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>All Rights Reserved</string>
<key>NSAppleScriptEnabled</key>
<false/>
<key>CFBundleExecutable</key>
<string>teensy</string>
<key>CFBundleIconFile</key>
<string>teensy.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.52</string>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
<key>LSRequiresNativeExecution</key>
<true/>
<key>LSExecutableArchitectures</key>
<array>
<string>i386</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1 @@
APPL????

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/teensy.icns</key>
<data>
OHsN17Zmb0LjQBs4ge1sD/kdWdE=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/teensy.icns</key>
<dict>
<key>hash</key>
<data>
OHsN17Zmb0LjQBs4ge1sD/kdWdE=
</data>
<key>hash2</key>
<data>
f0PkApyBbBz0QKM/7gc5dRvsthj3zLdUbGSxfZ+XR/U=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
{
"description": "Teensy Loader",
"name": "tool-teensy",
"system": [
"linux_i686"
],
"url": "https://www.pjrc.com/teensy/loader.html",
"version": "1.152.200516"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
{
"description": "Teensy Loader",
"name": "tool-teensy",
"system": [
"linux_x86_64"
],
"url": "https://www.pjrc.com/teensy/loader.html",
"version": "1.152.200516"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,11 @@
{
"description": "Teensy Loader",
"name": "tool-teensy",
"system": [
"windows",
"windows_amd64",
"windows_x86"
],
"url": "https://www.pjrc.com/teensy/loader.html",
"version": "1.152.200516"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

77
main.js
View File

@ -3,6 +3,7 @@ const {download} = require('electron-dl')
const {spawn} = require('child_process');
const {execFile} = require('child_process');
const fs = require('fs');
const path = require('path');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@ -10,6 +11,8 @@ let win
var avrdudeErr = "";
var avrdudeIsRunning = false;
var teensyLoaderIsRunning = false;
var teensyLoaderErr = ""
function createWindow () {
// Create the browser window.
@ -174,20 +177,84 @@ ipcMain.on('uploadFW', (e, args) => {
}
});
});
ipcMain.on('uploadFW_teensy35', (e, args) => {
if(teensyLoaderIsRunning == true) { return; }
teensyLoaderIsRunning = true; //Indicate that an avrdude process has started
var platform;
var burnStarted = false;
var burnPercent = 0;
//All Windows builds use the 32-bit binary
if(process.platform == "win32")
{
platform = "teensy_loader_cli-windows";
}
//All Mac builds use the 64-bit binary
else if(process.platform == "darwin")
{
platform = "teensy_loader_cli-darwin-x86_64";
}
else if(process.platform == "linux")
{
if(process.arch == "x32") { platform = "teensy_loader_cli-linux_i686"; }
else if(process.arch == "x64") { platform = "teensy_loader_cli-linux_x86_64"; }
else if(process.arch == "arm") { platform = "teensy_loader_cli-armhf"; }
else if(process.arch == "arm64") { platform = "teensy_loader_cli-aarch64"; }
}
var executableName = __dirname + "/bin/" + platform + "/teensy_post_compile";
executableName = executableName.replace('app.asar',''); //This is important for allowing the binary to be found once the app is packaed into an asar
var configName = executableName + ".conf";
if(process.platform == "win32") { executableName = executableName + '.exe'; } //This must come after the configName line above
var execArgs = ['-board=TEENSY35', '-reboot', '-file='+path.basename(args.firmwareFile, '.hex'), '-path='+path.dirname(args.firmwareFile), '-tools='+executableName.replace('/teensy_post_compile', "")];
console.log(execArgs);
console.log(executableName);
const child = execFile(executableName, execArgs);
child.stdout.on('data', (data) => {
console.log(`teensy_loader_cli stdout:\n${data}`);
});
child.stderr.on('data', (data) => {
console.log(`teensy_loader_cli stderr: ${data}`);
teensyLoaderErr = teensyLoaderErr + data;
//Check if avrdude has started the actual burn yet, and if so, track the '#' characters that it prints. Each '#' represents 1% of the total burn process (50 for write and 50 for read)
if (burnStarted == true)
{
if(data=="#") { burnPercent += 1; }
e.sender.send( "upload percent", burnPercent );
}
else
{
//This is a hack, but basically watch the output from avrdude for the term 'Writing | ', everything after that is the #s indicating 1% of burn.
if(teensyLoaderErr.substr(teensyLoaderErr.length - 10) == "Writing | ")
{
burnStarted = true;
}
}
});
child.on('error', (err) => {
console.log('Failed to start subprocess.');
console.log(err);
avrdudeIsRunning = false;
teensyLoaderIsRunning = false;
});
child.on('close', (code) => {
avrdudeIsRunning = false;
teensyLoaderIsRunning = false;
if (code !== 0)
{
console.log(`avrdude process exited with code ${code}`);
e.sender.send( "upload error", avrdudeErr )
avrdudeErr = "";
console.log(`teensyLoader process exited with code ${code}`);
e.sender.send( "upload error", teensyLoaderErr )
teensyLoaderErr = "";
}
else
{

View File

@ -4,6 +4,8 @@ const {remote} = require('electron')
const { shell } = require('electron')
var basetuneList = [];
var isMega = false;
var isTeensy = false;
function refreshSerialPorts()
{
@ -34,8 +36,29 @@ function refreshSerialPorts()
var newOption = document.createElement('option');
newOption.value = ports[i].comName;
newOption.innerHTML = ports[i].comName;
if(ports[i].vendorId == "2341")
{
//Arduino device
if(ports[i].productId == "0010" || ports[i].productId == "0042")
{
//Mega2560
newOption.innerHTML = newOption.innerHTML + " (Arduino Mega)";
isMega = true;
}
}
else if(ports[i].vendorId == "16c0")
{
//Teensy
if(ports[i].productId == "0483")
{
//Teensy - Unfortunately all Teensy devices use the same device ID :(
newOption.innerHTML = newOption.innerHTML + " (Teensy)";
}
}
select.add(newOption);
//console.log(ports[i].serialNumber );
}
var button = document.getElementById("btnInstall")
if(ports.length > 0)
{
@ -207,12 +230,23 @@ function refreshBasetunes()
}
}
function downloadHex()
function downloadHex(isTeensy)
{
var e = document.getElementById('versionsSelect');
var DLurl = "http://speeduino.com/fw/bin/" + e.options[e.selectedIndex].value + ".hex";
console.log("Downloading: " + DLurl);
var DLurl;
if(isTeensy)
{
DLurl = "http://speeduino.com/fw/teensy35/" + e.options[e.selectedIndex].value + ".hex";
console.log("Downloading Teensy 35 firmware: " + DLurl);
}
else
{
DLurl = "http://speeduino.com/fw/bin/" + e.options[e.selectedIndex].value + ".hex";
console.log("Downloading AVR firmware: " + DLurl);
}
//Download the Hex file
ipcRenderer.send("download", {
@ -276,6 +310,10 @@ function uploadFW()
spinner.classList.remove('fa-times');
spinner.classList.add('fa-spinner');
//Lookup what platform we're using
var portSelect = document.getElementById('portsSelect');
var isTeensy = portSelect.innerHTML.includes("Teensy");
//Hide the terminal section incase it was there from a previous burn attempt
document.getElementById('terminalSection').style.display = "none";
//Same for the ini location link
@ -296,7 +334,7 @@ function uploadFW()
statusText.innerHTML = "Downloading firmware"
document.getElementById('iniFileText').style.display = "block"
document.getElementById('iniFileLocation').innerHTML = file
downloadHex();
downloadHex(isTeensy);
}
else if(extension == "hex")
{
@ -308,10 +346,20 @@ function uploadFW()
console.log("Using port: " + uploadPort);
//Begin the upload
ipcRenderer.send("uploadFW", {
if(isTeensy)
{
ipcRenderer.send("uploadFW_teensy35", {
port: uploadPort,
firmwareFile: file
});
});
}
else
{
ipcRenderer.send("uploadFW", {
port: uploadPort,
firmwareFile: file
});
}
}
console.log();
});