Created
April 10, 2013 08:28
-
-
Save samvasko/5352830 to your computer and use it in GitHub Desktop.
Helper for compiling keil projects from command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Samuel Vasko | |
| # [email protected] | |
| com = 3 # COM port that you want to use | |
| # End of settings | |
| check = `where UV4` | |
| unless check.to_s =~/\w\:.+/ | |
| raise "\nYou dont have keil UV4 in you path" | |
| else | |
| dir = Dir.glob("*.uvproj") | |
| if dir.length == 1 | |
| check = system("UV4 -b -j0 #{dir[0]} -o log.txt") | |
| log = File.read('log.txt') | |
| File.unlink('log.txt') | |
| puts log | |
| if ARGV[0] == 'magic' && !(/Target not created/ =~ log) | |
| projectName = dir[0].split('.')[0] | |
| path = Dir.pwd + '/' + projectName + '.hex' | |
| path = path.gsub('/', '\\') | |
| puts system('FM.exe COM('+com+', 9600)'\ | |
| 'DEVICE(89V664, 0.000000, 0)'\ | |
| 'HARDWARE(BOOTEXEC, 50, 100)'\ | |
| 'ERASEUSED('+path+', PROTECTISP)'\ | |
| 'HEXFILE('+path+', NOCHECKSUMS, NOFILL, PROTECTISP)'\ | |
| 'EXECUTE(0, 0)') | |
| end | |
| else | |
| raise "\nCan\'t locate you project file" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment