Skip to content

Commit

Permalink
Merge pull request #53 from lecopzer/master
Browse files Browse the repository at this point in the history
Specify GCC/QEMU path and check python version
  • Loading branch information
jserv authored Mar 18, 2018
2 parents e89e68b + d397f22 commit d68fe3d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ include mk/cmsis.mk
prebuild: $(CMSIS)/$(PLAT)

check:
$(PYTHON) -m tests -p $(PLAT)
$(PYTHON) -m tests -p $(PLAT) --qemu $(QEMU_SYSTEM_ARM) --cc $(CC)

clean:
find . -name "*.o" -type f -delete
Expand Down
3 changes: 2 additions & 1 deletion mk/flags.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CROSS_COMPILE = arm-none-eabi-
CROSS_COMPILE ?= arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
AR = $(CROSS_COMPILE)ar
Expand All @@ -8,6 +8,7 @@ HOSTCC = gcc
WGET = wget
# FIXME: check version >= 3.5
PYTHON = python3
QEMU_SYSTEM_ARM ?= qemu-system-arm

# FIXME: configurable via menuconfig or command line
CFLAGS_OPT = -Os # -flto
Expand Down
4 changes: 2 additions & 2 deletions platform/stm32p103/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ifeq ($(shell lsb_release -c -s),trusty)
endif

run: $(NAME).bin
$(Q)qemu-system-arm \
$(Q)$(QEMU_SYSTEM_ARM) \
-semihosting \
$(REDIRECT_SERIAL) \
-nographic \
Expand All @@ -12,7 +12,7 @@ run: $(NAME).bin
-kernel $<

dbg: $(NAME).bin
$(Q)qemu-system-arm \
$(Q)$(QEMU_SYSTEM_ARM) \
-semihosting \
$(REDIRECT_SERIAL) \
-nographic \
Expand Down
7 changes: 7 additions & 0 deletions tests/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import sys
if sys.version_info < (3, 5):
print ("Only support python version >= 3.5")
exit(1)

import argparse
import tests.runner as runner
from tests.runner import PikoTest
Expand All @@ -11,6 +16,8 @@
help='no output unless one or more tests fail')
parser.add_argument('--debug', action='store_true', help='Run test and wait for gdb connect')
parser.add_argument('-p', '--platform', default='stm32p103')
parser.add_argument('--qemu', default='qemu-system-arm')
parser.add_argument('--cc', default='arm-none-eabi-gcc')
parser.add_argument('--timeout', type=int, default=60)
parser.add_argument('--slowest', action='store_true', dest='print_slow',
help='print the slowest 10 tests')
Expand Down
12 changes: 6 additions & 6 deletions tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def display_header(self):
% (locale.getpreferredencoding(False),
sys.getfilesystemencoding()))
print()
print_qemu_version()
print_gcc_version()
print_qemu_version(self.ns)
print_gcc_version(self.ns)

def accumulate_result(self, test, result):
ok, test_time = result
Expand Down Expand Up @@ -212,17 +212,17 @@ def main(self, tests, ns):
sys.exit(0)


def print_qemu_version():
cmd = ["qemu-system-arm", "--version"]
def print_qemu_version(ns):
cmd = [ns.qemu, "--version"]
res = subprocess.run(cmd, universal_newlines=True, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
print()
print("QEMU version\n", res.stdout.strip())
print()


def print_gcc_version():
cmd = ["arm-none-eabi-gcc", "--version"]
def print_gcc_version(ns):
cmd = [ns.cc, "--version"]
res = subprocess.run(cmd, universal_newlines=True, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
print()
Expand Down

0 comments on commit d68fe3d

Please sign in to comment.