Mercurial > lcfOS
changeset 207:8b2f20aae086
cleaning of files
author | Windel Bouwman |
---|---|
date | Sat, 29 Jun 2013 10:05:42 +0200 |
parents | 6c6bf8890d8a |
children | 4cb47d80fd1f |
files | python/arm_cm3.py python/astviewer.py python/bcanalyzer.py python/build.py python/c3/builder.py python/chip.png python/error.png python/functionicon.png python/hardware.png python/icons.py python/icons/chip.png python/icons/error.png python/icons/functionicon.png python/icons/hardware.png python/icons/logo.png python/icons/variableicon.png python/ide.py python/logo.png python/stm32f4/blink.c3 python/testasm.py python/variableicon.png python/zcc.py |
diffstat | 22 files changed, 51 insertions(+), 95 deletions(-) [+] |
line wrap: on
line diff
--- a/python/arm_cm3.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/arm_cm3.py Sat Jun 29 10:05:42 2013 +0200 @@ -241,6 +241,8 @@ mnemonic = 'pop' def __init__(self, regs): self.regs = regs + def __repr__(self): + return '{0} {{{1}}}'.format(self.mnemonic, self.regs) def encode(self): reg_list = 0 P = 0
--- a/python/astviewer.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/astviewer.py Sat Jun 29 10:05:42 2013 +0200 @@ -4,8 +4,8 @@ class AstModelBuilder: def __init__(self): - self.functionIco = QIcon(QPixmap('functionicon.png').scaled(32, 32)) - self.variableIco = QIcon(QPixmap('variableicon.png').scaled(32, 32)) + self.functionIco = QIcon(QPixmap('icons/functionicon.png').scaled(32, 32)) + self.variableIco = QIcon(QPixmap('icons/variableicon.png').scaled(32, 32)) self.visitor = Visitor(self.p1, self.p2) self.model = QStandardItemModel() self.model.setHorizontalHeaderLabels(['Object', 'Type'])
--- a/python/bcanalyzer.py Fri Jun 28 16:49:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#!/usr/bin/python - -import sys, os, argparse -from ppci.core import BitcodeReader - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Bitcode analyzer') - parser.add_argument('bitcodefile', type=str, help='the bitcode file to analyze') - args = parser.parse_args() - - try: - with open(args.bitcodefile, 'rb') as f: - bcr = BitcodeReader(f) - module = bcr.parseModule() - except IOError: - print('Failed to load {0}'.format(args.bitcodefile)) - sys.exit(3) - print(module) -
--- a/python/build.py Fri Jun 28 16:49:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#!/usr/bin/python - -import sys, os, argparse - -# Compiler imports: -from compiler import Compiler -from project import Project - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Build tool to build projects') - parser.add_argument('project', type=str, help='the project to be build') - args = parser.parse_args() - - try: - project = Project(args.project) - except IOError: - print('Failed to load {0}'.format(args.project)) - sys.exit(3) - pc = Compiler() - pc.compileProject(project) -
--- a/python/c3/builder.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/c3/builder.py Sat Jun 29 10:05:42 2013 +0200 @@ -16,6 +16,7 @@ def build(self, src): """ Create IR-code from sources """ pkg = self.parser.parseSource(src) + self.pkg = pkg if not pkg: return if not self.al.analyzePackage(pkg):
--- a/python/icons.py Fri Jun 28 16:49:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - -saveicon = b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGGklEQVR42s2XeWxURRjAv7d3L9ay\nlJBCbAx/SIIpCWilhNLSFsrR0qUgyCmnnKVFa/xDjNbUKGIUSrlaLhEREWlZaQoC24VymBivoGJB\n/MuEtEpjoNt2z/H7Zt+8fdPdGk2MOu23MzvvzXy/+Y6ZWQX+46L8bwC2vLTlZte9e6MMRiMYjQYY\nPWYsZGXngM1iBkUxoERej1RYayJmYGrF1Dbj/31+P1xtuwQ3vvmaP6M/h8Nx69Xq6kclgDWrn2W3\nbt+G5KQkSE9Ph/E5eTB1xixIQID+yIraEMoVJYLGay4KGNS2ty8Aza4muHqpVZvClmCDHbW1igSw\neuUq1tPTA2EWRohkmJCbD9OLS+Fu14M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JiYqBsA5BcMBgPLC4Q4OTkRt7e3LSaTSRbiCWBwcDAwOTmpOgfQOVSBcHFxIbS0tLB9\nDgH5IGYyGYvZbJZAvAoAOsL4IwTEngGxH9fp2MJnhUJBTKfT5t7e3rAsgMfjYQB4oB4V+OJAuI+A\naGtra6nz8/P3o6OjJQnAwMBAYGpqSjUAh8Aw8JLE3OBqIMTGxgbNZrPE5/MVFQFUe6+A4M5xoWMe\nIg4ASksB+vv761aAG3eKMFwBBFhfX6ebm5sEyl0eAHOgjqvgRSBUA3KAghHouFIAt9vNFNACgIci\nmUxSKEcyNjYmBXC5XK8Wgudvz8OAAJgDigD1lGE155UAsiFwOp2vUgVKzisBZJMQAdR2wlqco62s\nrNBcLkfgzpECOByOuhXg5cc733NLJBIMQLYP2O12BqB0uJrjyk8li8fjdGtri4AfeQAMAUpXayJW\ne2MlANlWbLPZGAB2LPagCoQapZaXl+nOzg6ZmZmRB8CBhANoYTB5U5iQyOzsrDwAjmR4hWpl0WiU\nwpxI5ubmpAAwKLAQ4HWqlUUiEbq/v0/m5+flATAEWiqwtLREDw4OyMLCgjyA1iEIh8P08PCQ+P1+\nKUBPTw8D0DIEi4uL9OjoiASDQSlAd3c3A7i/v9cUAKsgFApJAaxWa2B6etp2e3v71yGlen++X60v\n4EwAAOlUKvUO+oEUoLW19UNfX9/nxsbGhsoOxy+Wl75X2+drdXX1J/zX9AkmI+lU3N7e/hYSxAAT\n0Rs+FdX69rXsA1y5ubn5Vz6fL1Q++w30VO4/0/9IewAAAABJRU5ErkJggg==\n' -
--- a/python/ide.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/ide.py Sat Jun 29 10:05:42 2013 +0200 @@ -16,8 +16,6 @@ import testc3 import c3 -lcfospng = base64.decodestring(b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A\n/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEhMKBk7B678AAAA/SURBVFjD\n7dbBCQAgDATBi9h/y7EFA4Kf2QLCwH1S6XQu6sqoujublc8BAAAAAAAAAAB8B+zXT6YJAAAAAKYd\nWSgFQNUyijIAAAAASUVORK5CYII=\n') - class BuildOutput(QTextEdit): """ Build output component """ def __init__(self, parent=None): @@ -33,7 +31,7 @@ model = QStandardItemModel() self.setModel(model) self.clicked.connect(self.itemSelected) - self.errorIcon = QIcon('error.png') + self.errorIcon = QIcon('icons/error.png') self.model = QStandardItemModel() self.model.setHorizontalHeaderLabels(['Message', 'Row', 'Column']) self.setModel(self.model) @@ -64,9 +62,7 @@ self.treeview.setContextMenuPolicy(Qt.CustomContextMenu) l = QVBoxLayout(self) l.addWidget(self.treeview) - pm = QPixmap() - pm.loadFromData(lcfospng) - self.projectIcon = QIcon(pm) + self.projectIcon = QIcon('icons/logo.png') # Connect signals: self.treeview.activated.connect(self.activate) self.treeview.customContextMenuRequested.connect(self.contextMenu) @@ -126,9 +122,7 @@ def __init__(self, parent=None): super(Ide, self).__init__(parent) self.setWindowTitle('LCFOS IDE') - icon = QPixmap() - icon.loadFromData(lcfospng) - self.setWindowIcon(QIcon(icon)) + self.setWindowIcon(QIcon('icons/logo.png')) # Create menus: mb = self.menuBar() @@ -170,7 +164,7 @@ # About dialog: self.aboutDialog = AboutDialog() - self.aboutDialog.setWindowIcon(QIcon(icon)) + self.aboutDialog.setWindowIcon(QIcon('icons/logo.png')) # Create actions: def addMenuEntry(name, menu, callback, shortcut=None): a = QAction(name, self) @@ -361,7 +355,6 @@ self.buildFile() self.builderrors.setErrorList(self.diag.diags) - #self.astViewer.setAst(mods[0]) for err in self.diag.diags: self.buildOutput.append(str(err)) ce = self.activeMdiChild()
--- a/python/stm32f4/blink.c3 Fri Jun 28 16:49:38 2013 +0200 +++ b/python/stm32f4/blink.c3 Sat Jun 29 10:05:42 2013 +0200 @@ -1,25 +1,30 @@ +// This file blinks a LED on the STM32F4 discovery board. +package blink; -// This file blinks a LED on the STM32F4 discovery board. - -package blink; +// import bla +//type struct TIM2_s { +// uint32_t SR; +//}; // Globals: var int divider; +//const TIM2_s *TIM2; // Functions: function void tim2_handler() { - divider = 0; -/* if (TIM2->SR & TIM_SR_UIF) +// if (TIM2->SR & TIM_SR_UIF) + if (true) { - divider++; + divider = divider + 1; + /* if (divider > 100000) { divider = 0; GPIOD->ODR ^= (1 << 13); } + */ } - */ } function void main()
--- a/python/testasm.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/testasm.py Sat Jun 29 10:05:42 2013 +0200 @@ -183,10 +183,7 @@ self.feed('add r4, r5, 0') self.feed('loop: add r6, r4, 7') self.feed('cmp r6, 5') - #self.a.assemble('ble loop') - #self.assertEqual(bytes.fromhex('0325 2c1c e61d 052e fcdd'), self.a.binout) - self.assertEqual(bytes.fromhex('0325 2c1c e61d 052e'), self.a.binout) # without branch - + self.check('0325 2c1c e61d 052e') if __name__ == '__main__': #cProfile.run('unittest.main()')
--- a/python/zcc.py Fri Jun 28 16:49:38 2013 +0200 +++ b/python/zcc.py Sat Jun 29 10:05:42 2013 +0200 @@ -11,35 +11,41 @@ parser.add_argument('source', type=argparse.FileType('r'), help='the source file to build') parser.add_argument('-d', '--dumpir', action='store_true', help="Dump IR-code") parser.add_argument('-o', '--output', help='Output file', metavar='filename') -args = parser.parse_args() -# Front end: -src = args.source.read() -diag = ppci.DiagnosticsManager() -c3b = c3.Builder(diag) +def main(args): + # Front end: + src = args.source.read() + args.source.close() + diag = ppci.DiagnosticsManager() + c3b = c3.Builder(diag) -ircode = c3b.build(src) -if not ircode: - diag.printErrors(src) - sys.exit(1) + ircode = c3b.build(src) + if not ircode: + diag.printErrors(src) + sys.exit(1) -if args.dumpir: - ircode.dump() + if args.dumpir: + ircode.dump() + + # Code generation: -# Code generation: + #cg = codegen.CodeGenerator(arm_cm3.armtarget) + outs = outstream.TextOutputStream() + cg = codegenarm.ArmCodeGenerator(outs) + obj = cg.generate(ircode) -#cg = codegen.CodeGenerator(arm_cm3.armtarget) -outs = outstream.TextOutputStream() -cg = codegenarm.ArmCodeGenerator(outs) -obj = cg.generate(ircode) + if args.dumpir: + outs.dump() -if args.dumpir: - outs.dump() + if args.output: + output_filename = args.output + else: + output_filename = 'lc.output' -if args.output: - output_filename = args.output -else: - output_filename = 'lc.output' + # TODO: store data -# TODO: store data +if __name__ == '__main__': + args = parser.parse_args() + print(args, type(args)) + main(args)