예제 #1
0
 def do(self, src, expected_output, lang="c3"):
     base_filename = make_filename(self.id())
     bsp_c3 = relpath("..", "examples", "xtensa", "bsp.c3")
     crt0 = relpath("..", "examples", "xtensa", "glue.asm")
     mmap = relpath("..", "examples", "xtensa", "layout.mmp")
     build(
         base_filename,
         src,
         bsp_c3,
         crt0,
         self.march,
         self.opt_level,
         mmap,
         lang=lang,
         bin_format="elf",
         code_image="flash",
     )
     elf_filename = base_filename + ".elf"
     if has_qemu():
         output = qemu([
             "qemu-system-xtensa",
             "-nographic",
             "-M",
             "lx60",
             "-m",
             "16",
             "-kernel",
             elf_filename,
         ])
         self.assertEqual(expected_output, output)
예제 #2
0
    def do(self, src, expected_output, lang='c3'):
        base_filename = make_filename(self.id())
        bsp_c3 = relpath('..', 'examples', 'or1k', 'bsp.c3')
        crt0 = relpath('..', 'examples', 'or1k', 'crt0.asm')
        mmap = relpath('..', 'examples', 'or1k', 'layout.mmp')
        build(base_filename,
              src,
              bsp_c3,
              crt0,
              self.march,
              self.opt_level,
              mmap,
              lang=lang,
              bin_format='bin',
              code_image='flash')
        binfile = base_filename + '.bin'

        # Create a uboot application file:
        with open(binfile, 'rb') as f:
            bindata = f.read()

        img_filename = base_filename + '.img'
        with open(img_filename, 'wb') as f:
            uboot_image.write_uboot_image(
                f, bindata, arch=uboot_image.Architecture.OPENRISC)

        if has_qemu():
            output = qemu([
                'qemu-system-or1k', '-nographic', '-M', 'or1k-sim', '-m', '16',
                '-kernel', img_filename
            ])
            self.assertEqual(expected_output, output)
예제 #3
0
    def do(self, src, expected_output, lang="c3"):
        # Construct binary file from snippet:
        startercode = io.StringIO(self.startercode)
        base_filename = make_filename(self.id())
        bsp_c3 = io.StringIO(self.bsp_c3_src)

        build(
            base_filename,
            src,
            bsp_c3,
            startercode,
            self.march,
            self.opt_level,
            io.StringIO(self.arch_mmap),
            lang=lang,
            elf_format="elf",
        )

        base_filename = make_filename(self.id())

        elf_filename = base_filename + ".elf"

        if has_qemu():
            output = qemu([
                "qemu-system-riscv32",
                "-nographic",
                "-M",
                "sifive_u",
                "-bios",
                elf_filename,
            ])
            self.assertEqual(expected_output, output)
예제 #4
0
    def do(self, src, expected_output, lang="c3"):
        base_filename = make_filename(self.id())
        bsp_c3 = relpath("..", "examples", "microblaze", "bsp.c3")
        crt0 = relpath("..", "examples", "microblaze", "crt0.asm")
        mmap = relpath("..", "examples", "microblaze", "layout.mmp")
        build(
            base_filename,
            src,
            bsp_c3,
            crt0,
            self.march,
            self.opt_level,
            mmap,
            lang=lang,
            bin_format="bin",
            code_image="flash",
        )
        bin_filename = base_filename + ".bin"

        if has_qemu():
            output = qemu([
                "qemu-system-microblaze",
                "-nographic",
                "-kernel",
                bin_filename,
            ])
            self.assertEqual(expected_output, output)
예제 #5
0
    def do(self, src, expected_output, lang="c3"):
        # Construct binary file from snippet:
        bsp_c3 = relpath("..", "examples", "realview-pb-a8", "arch.c3")
        startercode = io.StringIO(self.startercode)
        base_filename = make_filename(self.id())
        obj = build(
            base_filename,
            src,
            bsp_c3,
            startercode,
            self.march,
            self.opt_level,
            io.StringIO(self.arch_mmap),
            lang=lang,
            bin_format="bin",
        )
        sample_filename = base_filename + ".bin"

        # Run bin file in emulator:
        if has_qemu():
            res = qemu([
                "qemu-system-arm",
                "--machine",
                "realview-pb-a8",
                "-m",
                "16M",
                "-nographic",
                "-kernel",
                sample_filename,
            ])
            self.assertEqual(expected_output, res)
예제 #6
0
    def do(self, src, expected_output, lang="c3"):
        base_filename = make_filename(self.id())
        bsp_c3 = relpath("..", "examples", "or1k", "bsp.c3")
        crt0 = relpath("..", "examples", "or1k", "crt0.asm")
        mmap = relpath("..", "examples", "or1k", "layout.mmp")
        build(
            base_filename,
            src,
            bsp_c3,
            crt0,
            self.march,
            self.opt_level,
            mmap,
            lang=lang,
            bin_format="bin",
            code_image="flash",
        )
        binfile = base_filename + ".bin"

        # Create a uboot application file:
        with open(binfile, "rb") as f:
            bindata = f.read()

        img_filename = base_filename + ".img"
        with open(img_filename, "wb") as f:
            uboot_image.write_uboot_image(
                f, bindata, arch=uboot_image.Architecture.OPENRISC)

        qemu_cmd = [
            "qemu-system-or1k",
            "-nographic",
            "-M",
            "or1k-sim",
            "-m",
            "16",
            "-kernel",
            img_filename,
        ]

        create_qemu_launch_script(base_filename + ".sh", qemu_cmd)
        if has_qemu():
            output = qemu(qemu_cmd)
            self.assertEqual(expected_output, output)
    def do(self, src, expected_output, lang='c3'):
        base_filename = make_filename(self.id())
        bsp_c3 = relpath('..', 'examples', 'microblaze', 'bsp.c3')
        crt0 = relpath('..', 'examples', 'microblaze', 'crt0.asm')
        mmap = relpath('..', 'examples', 'microblaze', 'layout.mmp')
        build(base_filename,
              src,
              bsp_c3,
              crt0,
              self.march,
              self.opt_level,
              mmap,
              lang=lang,
              bin_format='bin',
              code_image='flash')
        bin_filename = base_filename + '.bin'

        if has_qemu():
            output = qemu([
                'qemu-system-microblaze', '-nographic', '-kernel', bin_filename
            ])
            self.assertEqual(expected_output, output)
예제 #8
0
 def do(self, src, expected_output, lang='c3'):
     base_filename = make_filename(self.id())
     bsp_c3 = relpath('..', 'examples', 'xtensa', 'bsp.c3')
     crt0 = relpath('..', 'examples', 'xtensa', 'glue.asm')
     mmap = relpath('..', 'examples', 'xtensa', 'layout.mmp')
     build(base_filename,
           src,
           bsp_c3,
           crt0,
           self.march,
           self.opt_level,
           mmap,
           lang=lang,
           bin_format='elf',
           code_image='flash')
     elf_filename = base_filename + '.elf'
     if has_qemu():
         output = qemu([
             'qemu-system-xtensa', '-nographic', '-M', 'lx60', '-m', '16',
             '-kernel', elf_filename
         ])
         self.assertEqual(expected_output, output)
예제 #9
0
    def do(self, src, expected_output, lang="c3"):
        # Construct binary file from snippet:
        bsp_c3 = relpath('..', 'examples', 'realview-pb-a8', 'arch.c3')
        startercode = io.StringIO(self.startercode)
        base_filename = make_filename(self.id())
        obj = build(base_filename,
                    src,
                    bsp_c3,
                    startercode,
                    self.march,
                    self.opt_level,
                    io.StringIO(self.arch_mmap),
                    lang=lang,
                    bin_format='bin')
        sample_filename = base_filename + '.bin'

        # Run bin file in emulator:
        if has_qemu():
            res = qemu([
                'qemu-system-arm', '--machine', 'realview-pb-a8', '-m', '16M',
                '-nographic', '-kernel', sample_filename
            ])
            self.assertEqual(expected_output, res)
예제 #10
0
 def do(self, src, expected_output, lang='c3'):
     base_filename = make_filename(self.id())
     bsp_c3 = relpath('..', 'examples', 'xtensa', 'bsp.c3')
     crt0 = relpath('..', 'examples', 'xtensa', 'glue.asm')
     mmap = relpath('..', 'examples', 'xtensa', 'layout.mmp')
     build(base_filename,
           src,
           bsp_c3,
           crt0,
           self.march,
           self.opt_level,
           mmap,
           lang=lang,
           bin_format='bin',
           code_image='flash')
     binfile = base_filename + '.bin'
     img_filename = base_filename + '.img'
     self.make_image(binfile, img_filename)
     if has_qemu():
         output = qemu([
             'qemu-system-xtensa', '-nographic', '-M', 'lx60', '-m', '16',
             '-drive', 'if=pflash,format=raw,file={}'.format(img_filename)
         ])
         self.assertEqual(expected_output, output)