Mercurial > lcfOS
comparison python/codegenarm.py @ 255:7416c923a02a
Added more logging
author | Windel Bouwman |
---|---|
date | Sun, 04 Aug 2013 15:10:10 +0200 |
parents | f5fba5b554d7 |
children | 225f444019b1 |
comparison
equal
deleted
inserted
replaced
254:bd26dc13f270 | 255:7416c923a02a |
---|---|
1 import logging | |
1 import ir | 2 import ir |
2 from target import Label, Comment, Alignment, LabelRef, Imm32, DebugInfo | 3 from target import Label, Comment, Alignment, LabelRef, Imm32, DebugInfo |
3 import cortexm3 as arm | 4 import cortexm3 as arm |
4 from ppci import CompilerError | 5 from ppci import CompilerError |
5 | 6 |
8 Simple code generator | 9 Simple code generator |
9 Ad hoc implementation | 10 Ad hoc implementation |
10 """ | 11 """ |
11 def __init__(self, out): | 12 def __init__(self, out): |
12 self.outs = out | 13 self.outs = out |
14 self.logger = logging.getLogger('cgarm') | |
13 | 15 |
14 def emit(self, item): | 16 def emit(self, item): |
15 self.outs.emit(item) | 17 self.outs.emit(item) |
16 | 18 |
17 def generate(self, ircode): | 19 def generate(self, ircode): |
18 assert isinstance(ircode, ir.Module) | 20 assert isinstance(ircode, ir.Module) |
21 self.logger.info('Generating arm code for {}'.format(ircode.name)) | |
19 # TODO: get these from linker descriptor? | 22 # TODO: get these from linker descriptor? |
20 self.outs.getSection('code').address = 0x08000000 | 23 self.outs.getSection('code').address = 0x08000000 |
21 self.outs.getSection('data').address = 0x20000000 | 24 self.outs.getSection('data').address = 0x20000000 |
22 self.outs.selectSection('data') | 25 self.outs.selectSection('data') |
23 | 26 |