annotate test/testmsp430asm.py @ 375:19eacf4f7270

Started on memory manager
author Windel Bouwman
date Sun, 23 Mar 2014 15:44:06 +0100
parents 442fb043d149
children 6df89163e114
rev   line source
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
1 #!/usr/bin/python
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
2
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
3 import unittest
334
6f4753202b9a Added more recipes
Windel Bouwman
parents: 322
diff changeset
4 from ppci.assembler import tokenize, Assembler
335
582a1aaa3983 Added long branch format
Windel Bouwman
parents: 334
diff changeset
5 from ppci.objectfile import ObjectFile
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
6 from ppci.outstream import BinaryOutputStream
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
7 from ppci.target.target_list import msp430target
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
8 from testasm import AsmTestCaseBase
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
9
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 342
diff changeset
10 a = Assembler(msp430target)
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
11
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
12 class Msp430AssemblerTestCase(AsmTestCaseBase):
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
13 def setUp(self):
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
14 self.t = msp430target
335
582a1aaa3983 Added long branch format
Windel Bouwman
parents: 334
diff changeset
15 self.obj = ObjectFile()
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 342
diff changeset
16 self.ostream = BinaryOutputStream(self.obj)
348
442fb043d149 Added log option to zcc
Windel Bouwman
parents: 346
diff changeset
17 self.ostream.select_section('.text')
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 342
diff changeset
18 self.a = a
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
19
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
20 def testMov(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
21 self.feed("mov r14, r15")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
22 self.check('0F4E')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
23
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
24 def testMov1337(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
25 self.feed("mov 0x1337, r12")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
26 self.check('3C403713')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
27
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
28 def testAdd(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
29 self.feed("add r15, r13")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
30 self.check('0D5F')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
31
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
32 def testReti(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
33 self.feed("reti")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
34 self.check('0013')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
35
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
36
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
37 if __name__ == '__main__':
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
38 unittest.main()