Mercurial > lcfOS
comparison test/testsamples.py @ 385:d056b552d3f4
Made better use of layout
author | Windel Bouwman |
---|---|
date | Thu, 01 May 2014 14:03:12 +0200 |
parents | 173e20a47fda |
children | c0d9837acde8 |
comparison
equal
deleted
inserted
replaced
384:94f5b719ad0b | 385:d056b552d3f4 |
---|---|
4 from testemulation import runQemu, has_qemu | 4 from testemulation import runQemu, has_qemu |
5 from testzcc import relpath | 5 from testzcc import relpath |
6 from ppci.buildfunctions import assemble, c3compile, link | 6 from ppci.buildfunctions import assemble, c3compile, link |
7 | 7 |
8 startercode = """ | 8 startercode = """ |
9 section reset | |
9 mov sp, 0x30000 ; setup stack pointer | 10 mov sp, 0x30000 ; setup stack pointer |
10 BL sample_start ; Branch to sample start | 11 BL sample_start ; Branch to sample start |
11 local_loop: | 12 local_loop: |
12 B local_loop | 13 B local_loop |
13 """ | 14 """ |
145 o1 = assemble(io.StringIO(startercode), 'arm') | 146 o1 = assemble(io.StringIO(startercode), 'arm') |
146 o2 = c3compile([ | 147 o2 = c3compile([ |
147 relpath('..', 'kernel', 'src', 'io.c3'), | 148 relpath('..', 'kernel', 'src', 'io.c3'), |
148 io.StringIO(modarchcode), | 149 io.StringIO(modarchcode), |
149 io.StringIO(src)], [], 'arm') | 150 io.StringIO(src)], [], 'arm') |
150 o3 = link([o1, o2], io.StringIO(arch_mmap)) | 151 o3 = link([o2, o1], io.StringIO(arch_mmap), 'arm') |
151 | 152 |
153 img_data = o3.get_image('image') | |
152 sample_filename = 'testsample.bin' | 154 sample_filename = 'testsample.bin' |
153 with open(sample_filename, 'wb') as f: | 155 with open(sample_filename, 'wb') as f: |
154 f.write(o3.get_section('code').data) | 156 f.write(img_data) |
155 | 157 |
156 # Check bin file exists: | 158 # Check bin file exists: |
157 self.assertTrue(os.path.isfile(sample_filename)) | 159 self.assertTrue(os.path.isfile(sample_filename)) |
158 | 160 |
159 # Run bin file in emulator: | 161 # Run bin file in emulator: |