# HG changeset patch # User Windel Bouwman # Date 1394965727 -3600 # Node ID 396e5cefba1320abd913b9db706fedefc2f08720 # Parent c05ab629976acb431dd7a4a4dad85f8067dcdc5a Removed debuginfo instruction diff -r c05ab629976a -r 396e5cefba13 kernel/arm.yaml --- 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 diff -r c05ab629976a -r 396e5cefba13 kernel/src/kernel.c3 --- 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) diff -r c05ab629976a -r 396e5cefba13 python/ppci/c3/codegenerator.py --- 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() diff -r c05ab629976a -r 396e5cefba13 python/ppci/ir.py --- 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) diff -r c05ab629976a -r 396e5cefba13 python/ppci/linker.py --- 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: diff -r c05ab629976a -r 396e5cefba13 python/ppci/target/basetarget.py --- 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 diff -r c05ab629976a -r 396e5cefba13 test/testsamples.py --- 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({