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
9from target_objects import target_dir, structs, functions, const_globals
10from target_objects import symbols, sections, rodata, pairings, danger_set
11import target_objects
12
13import syntax
14import pseudo_compile
15import objdump
16import logic
17import re
18
19f = open ('%s/loop-O1.elf.symtab' % target_dir)
20(lsymbs, lsects) = objdump.build_syms (f)
21f.close ()
22symbols.update (lsymbs)
23sections.update (lsects)
24
25f = open ('%s/CFunDump.txt' % target_dir)
26syntax.parse_and_install_all (f, 'C')
27f.close ()
28
29f = open ('%s/ASMO1Funs.txt' % target_dir)
30(astructs, afunctions, aconst_gs) = syntax.parse_and_install_all (f, 'ASM')
31f.close ()
32assert not astructs
33assert not aconst_gs
34
35assert logic.aligned_address_sanity (afunctions, symbols, 4)
36
37print 'Pseudo-Compiling.'
38pseudo_compile.compile_funcs (functions)
39
40print 'Checking.'
41syntax.check_funs (functions)
42
43def asm_split_pairings ():
44	pairs = [(s, 'Loop.' + s) for s in afunctions]
45	target_objects.use_hooks.add ('stack_logic')
46	import stack_logic
47	stack_bounds = '%s/StackBounds.txt' % target_dir
48	new_pairings = stack_logic.mk_stack_pairings (pairs, stack_bounds)
49	pairings.update (new_pairings)
50
51asm_split_pairings ()
52
53
54