Use preferences in build
This commit is contained in:
parent
f26cddf8aa
commit
9512a3a910
|
@ -12,6 +12,7 @@ import Cocoa
|
||||||
class ASApplication: NSObject, NSApplicationDelegate {
|
class ASApplication: NSObject, NSApplicationDelegate {
|
||||||
@IBOutlet weak var themeMenu : NSMenu!
|
@IBOutlet weak var themeMenu : NSMenu!
|
||||||
@IBOutlet weak var keyboardMenu : NSMenu!
|
@IBOutlet weak var keyboardMenu : NSMenu!
|
||||||
|
@IBOutlet weak var preferences : ASPreferences!
|
||||||
|
|
||||||
func applicationWillFinishLaunching(notification: NSNotification) {
|
func applicationWillFinishLaunching(notification: NSNotification) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ASBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildProject(board: String, files: ASFileTree) {
|
func buildProject(board: String, files: ASFileTree) {
|
||||||
|
let toolChain = (NSApplication.sharedApplication().delegate as ASApplication).preferences.toolchainPath
|
||||||
task = NSTask()
|
task = NSTask()
|
||||||
task!.currentDirectoryPath = dir.path!
|
task!.currentDirectoryPath = dir.path!
|
||||||
task!.launchPath = NSBundle.mainBundle().pathForResource("BuildProject", ofType: "")!
|
task!.launchPath = NSBundle.mainBundle().pathForResource("BuildProject", ofType: "")!
|
||||||
|
@ -78,6 +79,7 @@ class ASBuilder {
|
||||||
NSLog("Unable to find core %s\n", boardProp["build.core"]!)
|
NSLog("Unable to find core %s\n", boardProp["build.core"]!)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
args.append("toolchain="+toolChain)
|
||||||
args.append("project="+dir.lastPathComponent)
|
args.append("project="+dir.lastPathComponent)
|
||||||
args.append("board="+board)
|
args.append("board="+board)
|
||||||
args.append("mcu="+boardProp["build.mcu"]!)
|
args.append("mcu="+boardProp["build.mcu"]!)
|
||||||
|
@ -96,9 +98,10 @@ class ASBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func uploadProject(board: String, programmer: String, port: String) {
|
func uploadProject(board: String, programmer: String, port: String) {
|
||||||
|
let toolChain = (NSApplication.sharedApplication().delegate as ASApplication).preferences.toolchainPath
|
||||||
task = NSTask()
|
task = NSTask()
|
||||||
task!.currentDirectoryPath = dir.path!
|
task!.currentDirectoryPath = dir.path!
|
||||||
task!.launchPath = "/usr/local/CrossPack-AVR/bin/avrdude"
|
task!.launchPath = toolChain+"/bin/avrdude"
|
||||||
|
|
||||||
let fileManager = NSFileManager.defaultManager()
|
let fileManager = NSFileManager.defaultManager()
|
||||||
let logURL = dir.URLByAppendingPathComponent("build/upload.log")
|
let logURL = dir.URLByAppendingPathComponent("build/upload.log")
|
||||||
|
@ -112,8 +115,10 @@ class ASBuilder {
|
||||||
let progProp = ASHardware.instance().programmers[programmer]
|
let progProp = ASHardware.instance().programmers[programmer]
|
||||||
let proto = boardProp["upload.protocol"] ?? progProp?["protocol"]
|
let proto = boardProp["upload.protocol"] ?? progProp?["protocol"]
|
||||||
let speed = boardProp["upload.speed"] ?? progProp?["speed"]
|
let speed = boardProp["upload.speed"] ?? progProp?["speed"]
|
||||||
var args = ["-v", "-v", "-v",
|
let verbosity = NSUserDefaults.standardUserDefaults().integerForKey("UploadVerbosity")
|
||||||
"-C", "/usr/local/CrossPack-AVR/etc/avrdude.conf",
|
var args = Array<String>(count: verbosity, repeatedValue: "-v")
|
||||||
|
args += [
|
||||||
|
"-C", toolChain+"/etc/avrdude.conf",
|
||||||
"-p", boardProp["build.mcu"]!, "-c", proto!, "-P", port,
|
"-p", boardProp["build.mcu"]!, "-c", proto!, "-P", port,
|
||||||
"-U", "flash:w:build/"+board+"/"+dir.lastPathComponent+".hex:i"]
|
"-U", "flash:w:build/"+board+"/"+dir.lastPathComponent+".hex:i"]
|
||||||
if speed != nil {
|
if speed != nil {
|
||||||
|
@ -127,9 +132,10 @@ class ASBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func disassembleProject(board: String) {
|
func disassembleProject(board: String) {
|
||||||
|
let toolChain = (NSApplication.sharedApplication().delegate as ASApplication).preferences.toolchainPath
|
||||||
task = NSTask()
|
task = NSTask()
|
||||||
task!.currentDirectoryPath = dir.path!
|
task!.currentDirectoryPath = dir.path!
|
||||||
task!.launchPath = "/usr/local/CrossPack-AVR/bin/avr-objdump"
|
task!.launchPath = toolChain+"/bin/avr-objdump"
|
||||||
|
|
||||||
let fileManager = NSFileManager.defaultManager()
|
let fileManager = NSFileManager.defaultManager()
|
||||||
let logURL = dir.URLByAppendingPathComponent("build/disasm.log")
|
let logURL = dir.URLByAppendingPathComponent("build/disasm.log")
|
||||||
|
@ -138,8 +144,10 @@ class ASBuilder {
|
||||||
task!.standardOutput = logOut
|
task!.standardOutput = logOut
|
||||||
task!.standardError = logOut
|
task!.standardError = logOut
|
||||||
|
|
||||||
var args = ["-d", "-S", "build/"+board+"/"+dir.lastPathComponent+".elf"]
|
let showSource = NSUserDefaults.standardUserDefaults().boolForKey("ShowSourceInDisassembly")
|
||||||
let cmdLine = task!.launchPath+" "+(args as NSArray).componentsJoinedByString(" ")+"\n"
|
var args = showSource ? ["-S"] : []
|
||||||
|
args += ["-d", "build/"+board+"/"+dir.lastPathComponent+".elf"]
|
||||||
|
let cmdLine = task!.launchPath+" "+(args as NSArray).componentsJoinedByString(" ")+"\n"
|
||||||
logOut.writeData(cmdLine.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
logOut.writeData(cmdLine.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
||||||
task!.arguments = args;
|
task!.arguments = args;
|
||||||
task!.launch()
|
task!.launch()
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9aO-EG-pZd">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9aO-EG-pZd">
|
||||||
<rect key="frame" x="14" y="17" width="412" height="17"/>
|
<rect key="frame" x="14" y="17" width="412" height="17"/>
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="lLl-0E-bfa">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Label" id="lLl-0E-bfa">
|
||||||
<font key="font" metaFont="fixedUser" size="11"/>
|
<font key="font" metaFont="fixedUser" size="11"/>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
<outlet property="delegate" destination="Voe-Tx-rLC" id="D1w-t4-cbp"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
<customObject id="Voe-Tx-rLC" customClass="ASApplication" customModule="AVRsack">
|
<customObject id="Voe-Tx-rLC" customClass="ASApplication" customModule="AVRsack">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="keyboardMenu" destination="WWD-TD-lpw" id="Tr8-cg-fXf"/>
|
<outlet property="keyboardMenu" destination="WWD-TD-lpw" id="Tr8-cg-fXf"/>
|
||||||
|
<outlet property="preferences" destination="sor-iB-NZD" id="zad-hM-0R0"/>
|
||||||
<outlet property="themeMenu" destination="uKq-xh-hZD" id="xE2-Kc-819"/>
|
<outlet property="themeMenu" destination="uKq-xh-hZD" id="xE2-Kc-819"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
|
|
|
@ -127,13 +127,15 @@ File.open("Rakefile", 'w') do |rakeFile|
|
||||||
SOURCES = Rake::FileList.new(ARGV).select {|f| f =~ /\.(c|cpp|cp|cxx|S)$/}
|
SOURCES = Rake::FileList.new(ARGV).select {|f| f =~ /\.(c|cpp|cp|cxx|S)$/}
|
||||||
INCLUDES= (CORES+LIBRARIES).map {|l| " +\n \" -I'#{l}'\""}.join('')
|
INCLUDES= (CORES+LIBRARIES).map {|l| " +\n \" -I'#{l}'\""}.join('')
|
||||||
rakeFile.print <<END_RAKE
|
rakeFile.print <<END_RAKE
|
||||||
CC = '/usr/local/CrossPack-AVR/bin/avr-gcc -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
TOOLCHAIN = "#{BUILD['toolchain']}"
|
||||||
CCP = '/usr/local/CrossPack-AVR/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
BIN = TOOLCHAIN+"/bin/"
|
||||||
LD = '/usr/local/CrossPack-AVR/bin/avr-g++ -Os -Wl,--gc-sections -mmcu=#{BUILD['mcu']}'
|
CC = BIN+'avr-gcc -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
||||||
AR = '/usr/local/CrossPack-AVR/bin/avr-ar crs'
|
CCP = BIN+'avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
||||||
EEP = '/usr/local/CrossPack-AVR/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0'
|
LD = BIN+'avr-g++ -Os -Wl,--gc-sections -mmcu=#{BUILD['mcu']}'
|
||||||
HEX = '/usr/local/CrossPack-AVR/bin/avr-objcopy -O ihex -R .eeprom'
|
AR = BIN+'avr-ar crs'
|
||||||
SIZE = '/usr/local/CrossPack-AVR/bin/avr-size'
|
EEP = BIN+'avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0'
|
||||||
|
HEX = BIN+'avr-objcopy -O ihex -R .eeprom'
|
||||||
|
SIZE = BIN+'avr-size'
|
||||||
|
|
||||||
def compile(dest, extrainc, *src)
|
def compile(dest, extrainc, *src)
|
||||||
directory dest
|
directory dest
|
||||||
|
|
Loading…
Reference in New Issue
Block a user