annotate test/testmsp430asm.py @ 399:a7c444404df9

Fix hexwrite
author Windel Bouwman
date Fri, 20 Jun 2014 16:36:49 +0200
parents d056b552d3f4
children
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
335
582a1aaa3983 Added long branch format
Windel Bouwman
parents: 334
diff changeset
4 from ppci.objectfile import ObjectFile
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
5 from ppci.outstream import BinaryOutputStream
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
6 from ppci.target.target_list import msp430target
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
7 from testasm import AsmTestCaseBase
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
8
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
9
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
10 class Msp430AssemblerTestCase(AsmTestCaseBase):
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
11 def setUp(self):
385
d056b552d3f4 Made better use of layout
Windel Bouwman
parents: 383
diff changeset
12 self.target = msp430target
335
582a1aaa3983 Added long branch format
Windel Bouwman
parents: 334
diff changeset
13 self.obj = ObjectFile()
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 342
diff changeset
14 self.ostream = BinaryOutputStream(self.obj)
383
173e20a47fda Added linker description loader
Windel Bouwman
parents: 381
diff changeset
15 self.ostream.select_section('code')
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 348
diff changeset
16 self.assembler = msp430target.assembler
290
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
17
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
18 def testMov(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
19 self.feed("mov r14, r15")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
20 self.check('0F4E')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
21
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
22 def testMov1337(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
23 self.feed("mov 0x1337, r12")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
24 self.check('3C403713')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
25
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
26 def testAdd(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
27 self.feed("add r15, r13")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
28 self.check('0D5F')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
29
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
30 def testReti(self):
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
31 self.feed("reti")
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
32 self.check('0013')
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
33
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
34
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
35 if __name__ == '__main__':
7b38782ed496 File moves
Windel Bouwman
parents:
diff changeset
36 unittest.main()