Mercurial > lcfOS
comparison test/testsamples.py @ 381:6df89163e114
Fix section and ldr pseudo instruction
author | Windel Bouwman |
---|---|
date | Sat, 26 Apr 2014 17:41:56 +0200 |
parents | 9667d78ba79e |
children | 173e20a47fda |
comparison
equal
deleted
inserted
replaced
380:67a584582aee | 381:6df89163e114 |
---|---|
8 startercode = """ | 8 startercode = """ |
9 mov sp, 0x30000 ; setup stack pointer | 9 mov sp, 0x30000 ; setup stack pointer |
10 BL sample_start ; Branch to sample start | 10 BL sample_start ; Branch to sample start |
11 local_loop: | 11 local_loop: |
12 B local_loop | 12 B local_loop |
13 """ | |
14 | |
15 modarchcode = """ | |
16 module arch; | |
17 | |
18 function void putc(int c) | |
19 { | |
20 var int *UART0DR; | |
21 UART0DR = cast<int*>(0x10009000); // UART0 DR register | |
22 *UART0DR = c; | |
23 } | |
24 | |
13 """ | 25 """ |
14 | 26 |
15 class Samples: | 27 class Samples: |
16 def testPrint(self): | 28 def testPrint(self): |
17 snippet = """ | 29 snippet = """ |
120 def do(self, src, expected_output): | 132 def do(self, src, expected_output): |
121 # Construct binary file from snippet: | 133 # Construct binary file from snippet: |
122 o1 = assemble(io.StringIO(startercode), 'arm') | 134 o1 = assemble(io.StringIO(startercode), 'arm') |
123 o2 = c3compile([ | 135 o2 = c3compile([ |
124 relpath('..', 'kernel', 'src', 'io.c3'), | 136 relpath('..', 'kernel', 'src', 'io.c3'), |
125 relpath('..', 'kernel', 'arch', 'vexpressA9.c3'), | 137 io.StringIO(modarchcode), |
126 io.StringIO(src)], [], 'arm') | 138 io.StringIO(src)], [], 'arm') |
127 layout = {'code': 0x10000, 'data': 0x20000} | 139 layout = {'code': 0x10000, 'data': 0x20000} |
128 o3 = link([o1, o2], layout) | 140 o3 = link([o1, o2], layout) |
129 | 141 |
130 sample_filename = 'testsample.bin' | 142 sample_filename = 'testsample.bin' |