Mercurial > lcfOS
changeset 363:396e5cefba13
Removed debuginfo instruction
author | Windel Bouwman |
---|---|
date | Sun, 16 Mar 2014 11:28:47 +0100 |
parents | c05ab629976a |
children | c49459768aaa |
files | kernel/arm.yaml kernel/src/kernel.c3 python/ppci/c3/codegenerator.py python/ppci/ir.py python/ppci/linker.py python/ppci/target/basetarget.py test/testsamples.py |
diffstat | 7 files changed, 30 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/kernel/arm.yaml Sat Mar 15 10:56:34 2014 +0100 +++ b/kernel/arm.yaml Sun Mar 16 11:28:47 2014 +0100 @@ -10,7 +10,7 @@ includes: [] machine: arm layout: - code: 0x60010000 - data: 0x60020000 + code: 0x010000 + data: 0x020000 output: kernel_arm.bin
--- a/kernel/src/kernel.c3 Sat Mar 15 10:56:34 2014 +0100 +++ b/kernel/src/kernel.c3 Sun Mar 16 11:28:47 2014 +0100 @@ -6,16 +6,30 @@ import arch; import io; +var int G; + +function void do() +{ + io.print2("G = ", G); + G = G + 1; +} + // Main entry point of the kernel: function void start() { + G = 0; arch.init(); io.println("Welcome to lcfos!"); + do(); + do(); + do(); + do(); + io.print_int(0x1337); - io.print_int(0x1338); - io.print2("Test: ", 0x13); + //io.print_int(0x1338); + //io.print2("Test: ", 0x13); var int a; for (a = 0; a < 2; a = a + 1)
--- a/python/ppci/c3/codegenerator.py Sat Mar 15 10:56:34 2014 +0100 +++ b/python/ppci/c3/codegenerator.py Sun Mar 16 11:28:47 2014 +0100 @@ -37,17 +37,15 @@ self.boolType = pkg.scope['bool'] self.logger.debug('Generating ir-code for {}'.format(pkg.name), extra={'c3_ast':pkg}) self.varMap = {} # Maps variables to storage locations. - self.funcMap = {} self.m = ir.Module(pkg.name) try: # Only generate function if function contains a body: real_functions = list(filter(lambda f: f.body, pkg.innerScope.Functions)) #real_functions = list(filter(None, pkg.innerScope.Functions)) - for s in real_functions: - f = self.newFunction(s.name) - self.funcMap[s] = f for v in pkg.innerScope.Variables: self.varMap[v] = self.newTemp() + if not v.isLocal: + self.m.add_variable(v.name) for s in real_functions: self.gen_function(s) except SemanticError as e: @@ -61,7 +59,7 @@ def gen_function(self, fn): # TODO: handle arguments - f = self.funcMap[fn] + f = self.newFunction(fn.name) f.return_value = self.newTemp() self.setFunction(f) l2 = self.newBlock()
--- a/python/ppci/ir.py Sat Mar 15 10:56:34 2014 +0100 +++ b/python/ppci/ir.py Sun Mar 16 11:28:47 2014 +0100 @@ -34,10 +34,10 @@ def add_variable(self, v): self.variables.append(v) - def getVariables(self): + def get_variables(self): return self.variables - Variables = property(getVariables) + Variables = property(get_variables) def getFunctions(self): return self.functions @@ -286,6 +286,11 @@ return 'Local {}'.format(self.name) +class GlobalVariable(Variable): + def __repr__(self): + return 'Global {}'.format(self.name) + + class Parameter(Variable): def __repr__(self): return 'Param {}'.format(self.name)
--- a/python/ppci/linker.py Sat Mar 15 10:56:34 2014 +0100 +++ b/python/ppci/linker.py Sun Mar 16 11:28:47 2014 +0100 @@ -152,6 +152,7 @@ out_s = self.dst.get_section(sym.section) value = offsets[sym.section] + out_s.address + sym.value self.dst.add_symbol(sym.name, value, sym.section) + self.logger.debug('{} at 0x{:08X} in section {}'.format(sym.name, value, sym.section)) # Merge relocations: for reloc in iobj.relocations:
--- a/python/ppci/target/basetarget.py Sat Mar 15 10:56:34 2014 +0100 +++ b/python/ppci/target/basetarget.py Sun Mar 16 11:28:47 2014 +0100 @@ -69,14 +69,6 @@ return bytes(pad) -class DebugInfo(PseudoInstruction): - def __init__(self, i): - self.info = i - - def __repr__(self): - return 'DebugInfo: {}'.format(self.info) - - class Register: def __init__(self, name): self.name = name
--- a/test/testsamples.py Sat Mar 15 10:56:34 2014 +0100 +++ b/test/testsamples.py Sun Mar 16 11:28:47 2014 +0100 @@ -37,7 +37,7 @@ def do(self, src, expected_output): runner = TaskRunner() recipe_loader = RecipeLoader(runner) - print(expected_output) + # print(expected_output) return # TODO: improve recipe loading?? recipe_loader.load_dict({