1# * Copyright 2015, NICTA 2# * 3# * This software may be distributed and modified according to the terms of 4# * the BSD 2-Clause license. Note that NO WARRANTY is provided. 5# * See "LICENSE_BSD2.txt" for details. 6# * 7# * @TAG(NICTA_BSD) 8 9 10from target_objects import target_dir, structs, functions, const_globals 11from target_objects import symbols, sections, rodata, pairings, danger_set 12import target_objects 13 14import syntax 15import pseudo_compile 16import objdump 17import logic 18import re 19 20f = open ('%s/loop-O2.elf.symtab' % target_dir) 21(lsymbs, lsects) = objdump.build_syms (f) 22f.close () 23symbols.update (lsymbs) 24sections.update (lsects) 25 26f = open ('%s/CFunDump.txt' % target_dir) 27syntax.parse_and_install_all (f, 'C') 28f.close () 29 30f = open ('%s/ASMO2Funs.txt' % target_dir) 31(astructs, afunctions, aconst_gs) = syntax.parse_and_install_all (f, 'ASM') 32f.close () 33assert not astructs 34assert not aconst_gs 35 36assert logic.aligned_address_sanity (afunctions, symbols, 4) 37 38print 'Pseudo-Compiling.' 39pseudo_compile.compile_funcs (functions) 40 41print 'Checking.' 42syntax.check_funs (functions) 43 44def asm_split_pairings (): 45 pairs = [(s, 'Loop.' + s) for s in afunctions] 46 target_objects.use_hooks.add ('stack_logic') 47 import stack_logic 48 stack_bounds = '%s/StackBounds.txt' % target_dir 49 new_pairings = stack_logic.mk_stack_pairings (pairs, stack_bounds) 50 pairings.update (new_pairings) 51 52asm_split_pairings () 53 54 55