Mercurial > lcfOS
diff test/testarmasm.py @ 381:6df89163e114
Fix section and ldr pseudo instruction
author | Windel Bouwman |
---|---|
date | Sat, 26 Apr 2014 17:41:56 +0200 |
parents | 19eacf4f7270 |
children | 173e20a47fda |
line wrap: on
line diff
--- a/test/testarmasm.py Fri Apr 18 13:08:45 2014 +0200 +++ b/test/testarmasm.py Sat Apr 26 17:41:56 2014 +0200 @@ -1,13 +1,10 @@ import unittest from ppci.outstream import BinaryOutputStream from ppci.objectfile import ObjectFile -from asm import Assembler from testasm import AsmTestCaseBase from ppci.target.target_list import arm_target -a = Assembler(arm_target) - class ArmAssemblerTestCase(AsmTestCaseBase): """ ARM-mode (not thumb-mode) instruction assembly test case """ def setUp(self): @@ -15,7 +12,7 @@ self.obj = ObjectFile() self.ostream = BinaryOutputStream(self.obj) self.ostream.select_section('.text') - self.a = a + self.assembler = arm_target.assembler def testMovImm(self): self.feed('mov r4, 100') @@ -69,17 +66,17 @@ self.check('3092a0e1 3846a0e1') def testBranches(self): - self.feed('b sjakie') - self.feed('ble sjakie') - self.feed('bgt sjakie') - self.feed('beq sjakie') - self.feed('bl sjakie') - self.feed('sjakie:') - self.feed('b sjakie') - self.feed('ble sjakie') - self.feed('bgt sjakie') - self.feed('beq sjakie') - self.feed('bl sjakie') + self.feed("""b sjakie + ble sjakie + bgt sjakie + beq sjakie + bl sjakie + sjakie: + b sjakie + ble sjakie + bgt sjakie + beq sjakie + bl sjakie""") self.check('030000ea 020000da 010000ca 0000000a ffffffeb feffffea fdffffda fcffffca fbffff0a faffffeb') def testPush(self): @@ -116,12 +113,16 @@ self.feed('adr r1, cval') self.check('04508fe2 00908fe2 04804fe2 08b04fe2 0cc04fe2 10104fe2') - @unittest.skip('Too hard') def testLdrLabelAddress(self): self.feed('ldr r8, =a') self.feed('a:') - self.feed('dcd 6677') - self.check('00801fe5 151a0000 04000000') + self.check('04801fe5 04000000') + + def testLdrLabelAddressAt10000(self): + """ Link code at 0x10000 and check if symbol was correctly patched """ + self.feed('ldr r8, =a') + self.feed('a:') + self.check('04801fe5 04000100', {'.text':0x10000}) def testCmp(self): self.feed('cmp r4, r11')