Successfully uploads
This commit is contained in:
parent
cc3033e01e
commit
cd9aae2190
|
@ -71,4 +71,29 @@ class ASBuilder {
|
||||||
task!.arguments = args;
|
task!.arguments = args;
|
||||||
task!.launch()
|
task!.launch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func uploadProject(board: String, programmer: String, port: String) {
|
||||||
|
task = NSTask()
|
||||||
|
task!.currentDirectoryPath = dir.path!
|
||||||
|
task!.launchPath = "/usr/local/CrossPack-AVR/bin/avrdude"
|
||||||
|
|
||||||
|
let fileManager = NSFileManager.defaultManager()
|
||||||
|
let logURL = dir.URLByAppendingPathComponent("build/upload.log")
|
||||||
|
fileManager.createFileAtPath(logURL.path!, contents: NSData(), attributes: nil)
|
||||||
|
let logOut = NSFileHandle(forWritingAtPath: logURL.path!)!
|
||||||
|
task!.standardOutput = logOut
|
||||||
|
task!.standardError = logOut
|
||||||
|
|
||||||
|
let libPath = (ASLibraries.instance().directories as NSArray).componentsJoinedByString(":")
|
||||||
|
let boardProp = ASHardware.instance().boards[board]!
|
||||||
|
let progProp = ASHardware.instance().programmers[programmer]
|
||||||
|
let proto = boardProp["upload.protocol"] ?? progProp?["protocol"]
|
||||||
|
let speed = boardProp["upload.speed"] ?? progProp?["speed"]
|
||||||
|
var args = ["-v", "-v", "-v", "-v", "-D",
|
||||||
|
"-C", "/usr/local/CrossPack-AVR/etc/avrdude.conf",
|
||||||
|
"-p", boardProp["build.mcu"], "-c", proto!, "-P", port, "-b", speed!,
|
||||||
|
"-U", "flash:w:build/"+board+"/"+dir.lastPathComponent+".hex:i"]
|
||||||
|
task!.arguments = args;
|
||||||
|
task!.launch()
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -330,9 +330,6 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
|
|
||||||
// MARK: Build / Upload
|
// MARK: Build / Upload
|
||||||
|
|
||||||
@IBAction func uploadProject(AnyObject) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func buildProject(AnyObject) {
|
@IBAction func buildProject(AnyObject) {
|
||||||
selectNode(files.buildLog)
|
selectNode(files.buildLog)
|
||||||
builder.buildProject(board, files: files)
|
builder.buildProject(board, files: files)
|
||||||
|
@ -429,5 +426,10 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
return ASHardware.instance().boards[board]?["upload.protocol"] != nil
|
return ASHardware.instance().boards[board]?["upload.protocol"] != nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func uploadProject(AnyObject) {
|
||||||
|
selectNode(files.uploadLog)
|
||||||
|
builder.uploadProject(board, programmer:programmer, port:port)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user