Mercurial > lcfOS
diff python/ide/ide.py @ 295:917eab04b8b7
Added disasm
author | Windel Bouwman |
---|---|
date | Thu, 28 Nov 2013 21:10:32 +0100 |
parents | 534b94b40aa8 |
children | b145f8e6050b |
line wrap: on
line diff
--- a/python/ide/ide.py Thu Nov 28 20:39:56 2013 +0100 +++ b/python/ide/ide.py Thu Nov 28 21:10:32 2013 +0100 @@ -18,11 +18,12 @@ from astviewer import AstViewer from codeedit import CodeEdit from logview import LogView as BuildOutput -#from disasm import Disassembly +from disasm import Disassembly stutil = __import__('st-util') import c3 import zcc import outstream +from target import armtarget def handle_exception(tp, v, tb): @@ -79,7 +80,7 @@ l = QVBoxLayout(self) txt = QTextEdit(self) txt.setReadOnly(True) - with open(os.path.join('..', 'readme.rst'), 'r') as f: + with open(os.path.join('..', '..', 'readme.rst'), 'r') as f: aboutText = f.read() txt.append(aboutText) l.addWidget(txt) @@ -275,34 +276,8 @@ # Build recepy: def parseFile(self): self.logger.info('Parsing!') - ce = self.activeMdiChild() - if not ce: - return - self.diag.clear() - pkg = self.c3front.parse(ce.Source) - # Set errors: - self.builderrors.setErrorList(self.diag.diags) - ce.setErrors(self.diag.diags) - self.astViewer.setAst(pkg) - if pkg: - c3.AstPrinter().printAst(pkg) - self.logger.info('Done!') - - def buildFile(self): - ce = self.activeMdiChild() - if not ce: - return - fn = ce.FileName - self.diag.clear() - outs = outstream.TextOutputStream() - if not zcc.zcc([io.StringIO(ce.Source)], [], outs, self.diag): - # Set errors: - self.builderrors.setErrorList(self.diag.diags) - ce.setErrors(self.diag.diags) - return - - def buildFileAndFlash(self): + def doBuild(self): ce = self.activeMdiChild() if not ce: return @@ -310,13 +285,21 @@ self.diag.clear() outs = outstream.TextOutputStream() imps = [open(ce.FileName, 'r') for ce in self.allChildren() if ce.FileName and ce.FileName != fn] - if not zcc.zcc([open(fn, 'r')], imps, outs, self.diag): + if not zcc.zcc([open(fn, 'r')], imps, armtarget, outs, self.diag): # Set errors: self.builderrors.setErrorList(self.diag.diags) ce.setErrors(self.diag.diags) return + return outs - outs.dump() + def buildFile(self): + self.doBuild() + + def buildFileAndFlash(self): + outs = self.doBuild() + if not outs: + return + code_s = outs.getSection('code') self.disasm.dm.setInstructions(code_s.instructions) self.debugInfo = code_s.debugInfos()