{"id":2230654,"url":"http://patchwork.ozlabs.org/api/patches/2230654/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429-pic32mk-board-support-v1-2-1dfac14f8e2d@voltumotor.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260429-pic32mk-board-support-v1-2-1dfac14f8e2d@voltumotor.com>","list_archive_url":null,"date":"2026-04-29T21:51:18","name":"[RFC,2/3] tests: add PIC32MK functional and qtest coverage","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bd3303ab07bda0bd08fcb22a5b676b3e04e6900e","submitter":{"id":93284,"url":"http://patchwork.ozlabs.org/api/people/93284/?format=json","name":"Ericson Joseph","email":"ericsonjoseph@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429-pic32mk-board-support-v1-2-1dfac14f8e2d@voltumotor.com/mbox/","series":[{"id":502167,"url":"http://patchwork.ozlabs.org/api/series/502167/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502167","date":"2026-04-29T21:51:18","name":"hw/mips: add Microchip PIC32MK GPK/MCM board emulation","version":1,"mbox":"http://patchwork.ozlabs.org/series/502167/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230654/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230654/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Op6wWrug;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5YZ65cPFz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 09:35:09 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIEQa-0004q7-O8; Wed, 29 Apr 2026 19:34:48 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <ericsonjoseph@gmail.com>)\n id 1wICoi-00010s-Df\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 17:51:36 -0400","from mail-dy1-x1333.google.com ([2607:f8b0:4864:20::1333])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <ericsonjoseph@gmail.com>)\n id 1wICog-0004Hv-7D\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 17:51:36 -0400","by mail-dy1-x1333.google.com with SMTP id\n 5a478bee46e88-2d8fa0fadfeso217141eec.1\n for <qemu-devel@nongnu.org>; Wed, 29 Apr 2026 14:51:31 -0700 (PDT)","from [127.0.1.1] ([2803:9800:9001:c4f0:5d16:7dac:ff8:d8ff])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ed1bf6d315sm4353878eec.1.2026.04.29.14.51.27\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 14:51:29 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777499490; x=1778104290; darn=nongnu.org;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=5PebPglHoe6H/36VNwDhbR2OIGR9F5WehVi5N/W11q8=;\n b=Op6wWrug93x551st9CxQyFGJgaQCkivBI850kDNPEArCZb62DtVZNhfgM0nANGZh0W\n TbfS1oXlFLuF1dJhGWVxO45YR9suafwZzJcP6sYv43x1vzm/3S/G9JghCV2tdHwF5yMa\n fFW+/Pw4AMAlpMwlj5LkNMEasfshe7qbAByiLbAZnzsfPb3tiBxJmCEI9JtIwkYn99ic\n g1j7ZLGmWBpP5BBjIDuRfQRXVoJzy2NuMgsEPOTa+nQO93fw+4zQhib+oeMhcBVXFwCa\n 0m6m/gR038ON3NVXKodMPgWd4TxqC5LwCpC76F7AunCROU6EG7SCXEZj65PWZVIW7qFe\n glPQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777499490; x=1778104290;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=5PebPglHoe6H/36VNwDhbR2OIGR9F5WehVi5N/W11q8=;\n b=YcKOijVP3KkcRnjFy+DGJPAIW9+Wzq53aBg4u7NZFOx1e8V/vXeOpSd9HMy+snOop0\n gRrqa465pWBYiotkOkGWo4WWQz7FgX/Sw6WjgqnqbXHyil2Kpu7MJ9ZPFXxT0tAmqCKK\n 3LgH9uHrb0kf5GO1amSoC2+NSGaJkjLmdg701+L3eCpLI8Hj3b+k4sNyPb9pCWrsHpcj\n IrLqyvl+TQwO40teSlyQCJb6cRYLbgVqD4qcdbVZgaj/+kpu1o0yu+U4fz4XlS5V3nHI\n S8D2mCQ8xQBa3FulkzZvX5Q3OVKeZ0/K69d6MRfOG5wH699JAEV1tAvoj/bBe6Q0Vn6d\n AHow==","X-Gm-Message-State":"AOJu0YwQMzuxn+Ru+XgyWysEqN+etTsaLHthk3wnyRnpv1cNbPvrZ9OH\n aaNY/WluuexcQo3bI4MWcAKj0VmW9kev067TVjWuE5XoKo9NBND+EoNA","X-Gm-Gg":"AeBDievhB2F6kAEUayz/5FNqezrmQJER6DT5Z9j98DHS6+oUvlT4KSh1/IPt508Sa6m\n Usjd2ZZjHReEnpRyRo3kMpA7+H2vtRiz6lZaVyCs0N+nL7nW9l44/sclM7hag/GcNFv1pTd7/Ex\n MOvc4mCCwgZsxYYkhzXfQI8Mpkr8QQGWG3S5Cmlws8rp4zaLrnddrD870UkTaLvgwSDf2DzJU6t\n Au6rvg2qqMB11gI//uLR91XP0f3PjIyxZ3TUjkpftMIn+flZYvrnvEeLRyaM+kGUtep8BNBVum7\n uV2yZ94NzMEpTSJ4/KsoWdVGSS7FQyegz71d85EdOW2TCs57fK/F6SK54FnlNm93OUykESlmgLP\n C8cJ3MtNP4rCj+OxcbluNP5u3w2VVXIel4hQRSpz//80a2vRRZeuolKIBapNwnTwx/CHw0BLGs1\n K4Uz17MdxlGYruYw/81vlRhglRTdOVw5e19vwrd/E4j8oGwwAshiQ=","X-Received":"by 2002:a05:7300:a583:b0:2c6:67b6:3acc with SMTP id\n 5a478bee46e88-2ed1bb3f483mr1902728eec.15.1777499490144;\n Wed, 29 Apr 2026 14:51:30 -0700 (PDT)","From":"Ericson Joseph <ericsonjoseph@gmail.com>","Date":"Wed, 29 Apr 2026 18:51:18 -0300","Subject":"[PATCH RFC 2/3] tests: add PIC32MK functional and qtest coverage","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Message-Id":"<20260429-pic32mk-board-support-v1-2-1dfac14f8e2d@voltumotor.com>","References":"<20260429-pic32mk-board-support-v1-0-1dfac14f8e2d@voltumotor.com>","In-Reply-To":"<20260429-pic32mk-board-support-v1-0-1dfac14f8e2d@voltumotor.com>","To":"qemu-devel@nongnu.org","Cc":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>, Paolo Bonzini <pbonzini@redhat.com>,\n  Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>,\n  Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,\n  Ericson Joseph <ericsonjoseph@gmail.com>","X-Mailer":"b4 0.15.2","Received-SPF":"pass client-ip=2607:f8b0:4864:20::1333;\n envelope-from=ericsonjoseph@gmail.com; helo=mail-dy1-x1333.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-Mailman-Approved-At":"Wed, 29 Apr 2026 19:34:47 -0400","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Wire the PIC32MK tests into the build system:\n\n- tests/functional/mipsel: register pic32mk as a quick test (30s),\n  build pic32mk_test_fw.bin from assembly source using the mipsel-linux-gnu\n  cross toolchain when available, and run test_pic32mk.py which boots the\n  board and waits for \"Hello, PIC32MK!\" on UART1.\n\n- tests/qtest/meson.build: add pic32mk-test and pic32mk-canfd-test to\n  qtests_mipsel (gated on CONFIG_PIC32MK).\n\nSigned-off-by: Ericson Joseph <ericsonjoseph@gmail.com>\n---\n tests/functional/mipsel/meson.build     | 28 ++++++++++\n tests/functional/mipsel/test_pic32mk.py | 99 +++++++++++----------------------\n tests/qtest/meson.build                 |  4 +-\n 3 files changed, 63 insertions(+), 68 deletions(-)","diff":"diff --git a/tests/functional/mipsel/meson.build b/tests/functional/mipsel/meson.build\nindex 8bfdf0649b..62ae73c1db 100644\n--- a/tests/functional/mipsel/meson.build\n+++ b/tests/functional/mipsel/meson.build\n@@ -2,9 +2,37 @@\n \n test_mipsel_timeouts = {\n   'malta' : 420,\n+  'pic32mk' : 30,\n   'replay' : 480,\n }\n \n+# Build the minimal PIC32MK test firmware from assembly source.\n+# Requires the mipsel-linux-gnu cross toolchain; silently skipped if absent.\n+_mipsel_cc = find_program('mipsel-linux-gnu-gcc', required: false)\n+_mipsel_objcopy = find_program('mipsel-linux-gnu-objcopy', required: false)\n+\n+if _mipsel_cc.found() and _mipsel_objcopy.found() and \\\n+   config_all_devices.has_key('CONFIG_PIC32MK')\n+  _fw_ld   = meson.current_source_dir() / 'pic32mk_test_fw.ld'\n+  _fw_src  = meson.current_source_dir() / 'pic32mk_test_fw.S'\n+  _fw_elf  = custom_target('pic32mk_test_fw_elf',\n+    input  : [_fw_src, _fw_ld],\n+    output : 'pic32mk_test_fw.elf',\n+    command: [_mipsel_cc,\n+              '-march=mips32r2', '-EL', '-nostdlib',\n+              '-T', _fw_ld, _fw_src,\n+              '-o', '@OUTPUT@'],\n+  )\n+  _fw_bin = custom_target('pic32mk_test_fw.bin',\n+    input  : _fw_elf,\n+    output : 'pic32mk_test_fw.bin',\n+    command: [_mipsel_objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'],\n+  )\n+  tests_mipsel_system_quick = ['pic32mk']\n+else\n+  tests_mipsel_system_quick = []\n+endif\n+\n tests_mipsel_system_thorough = [\n   'malta',\n   'replay',\ndiff --git a/tests/functional/mipsel/test_pic32mk.py b/tests/functional/mipsel/test_pic32mk.py\nindex 4af91c4f88..ebfc94f388 100644\n--- a/tests/functional/mipsel/test_pic32mk.py\n+++ b/tests/functional/mipsel/test_pic32mk.py\n@@ -1,9 +1,12 @@\n #!/usr/bin/env python3\n+# SPDX-License-Identifier: GPL-2.0-or-later\n #\n-# Functional tests for the PIC32MK board emulation\n+# Functional test for the Microchip PIC32MK GPK/MCM board emulation.\n #\n-# Copyright (c) 2026 QEMU contributors\n-# SPDX-License-Identifier: GPL-2.0-or-later\n+# The test firmware (pic32mk_test_fw.S) is a minimal MIPS assembly program\n+# that initialises UART1 and writes \"Hello, PIC32MK!\\r\\n\" then spins.\n+# This verifies that the board boots, the CPU executes code, and UART1 TX\n+# produces output on the emulated serial console.\n \n import os\n \n@@ -11,81 +14,43 @@\n from qemu_test import wait_for_console_pattern\n \n \n+def _fw_path():\n+    \"\"\"Return the path to the pre-built test firmware binary.\"\"\"\n+    build_dir = os.environ.get('BUILD_DIR', '')\n+    if build_dir:\n+        candidate = os.path.join(build_dir,\n+                                 'tests', 'functional', 'mipsel',\n+                                 'pic32mk_test_fw.bin')\n+        if os.path.isfile(candidate):\n+            return candidate\n+    # Fallback: look next to this file (for out-of-tree runs)\n+    here = os.path.dirname(os.path.abspath(__file__))\n+    return os.path.join(here, 'pic32mk_test_fw.bin')\n+\n+\n class PIC32MKMachine(QemuSystemTest):\n     \"\"\"\n-    Tests for the PIC32MK MCU board (-M pic32mk).\n+    Boot test for the Microchip PIC32MK GPK/MCM board (-M pic32mk).\n \n-    The FreeRTOS firmware is expected to be pre-built at\n-    tests/freertos/hello_freertos.bin relative to the source tree.\n+    Requires pic32mk_test_fw.bin built from pic32mk_test_fw.S by meson.\n+    The binary must be present in the meson build tree under\n+    tests/functional/mipsel/pic32mk_test_fw.bin.\n     \"\"\"\n \n     timeout = 30\n \n-    def get_firmware_path(self):\n-        \"\"\"Locate the pre-built FreeRTOS firmware binary.\"\"\"\n-        # data_file() resolves relative to tests/functional/\n-        # We need to go up two levels to reach the source root\n-        src_root = os.path.join(\n-            os.path.dirname(__file__), '..', '..', '..')\n-        fw_path = os.path.realpath(\n-            os.path.join(src_root, 'tests', 'freertos', 'hello_freertos.bin'))\n-        if not os.path.isfile(fw_path):\n+    def test_uart_boot_message(self):\n+        \"\"\"Board boots and UART1 TX prints the expected banner.\"\"\"\n+        fw = _fw_path()\n+        if not os.path.isfile(fw):\n             self.skipTest(\n-                f'FreeRTOS firmware not built: {fw_path}\\n'\n-                'Run: make -C tests/freertos')\n-        return fw_path\n-\n-    def test_boot_message(self):\n-        \"\"\"PIC32MK boots and prints the FreeRTOS banner.\"\"\"\n-        self.set_machine('pic32mk')\n-        self.vm.set_console()\n-        self.vm.add_args('-bios', self.get_firmware_path(),\n-                         '-nographic')\n-        self.vm.launch()\n-        wait_for_console_pattern(self,\n-                                 'PIC32MK QEMU booting FreeRTOS...')\n-\n-    def test_freertos_hello_task(self):\n-        \"\"\"FreeRTOS scheduler starts and the Hello task fires.\"\"\"\n-        self.set_machine('pic32mk')\n-        self.vm.set_console()\n-        self.vm.add_args('-bios', self.get_firmware_path(),\n-                         '-nographic')\n-        self.vm.launch()\n-        # First: boot banner\n-        wait_for_console_pattern(self,\n-                                 'PIC32MK QEMU booting FreeRTOS...')\n-        # Second: at least one Hello message (proves Timer1 tick + UART TX IRQ)\n-        wait_for_console_pattern(self,\n-                                 'Hello from FreeRTOS!')\n-\n-    def test_freertos_recurring_ticks(self):\n-        \"\"\"Timer1 delivers recurring ticks — multiple Hello messages appear.\"\"\"\n-        self.set_machine('pic32mk')\n-        self.vm.set_console()\n-        self.vm.add_args('-bios', self.get_firmware_path(),\n-                         '-nographic')\n-        self.vm.launch()\n-        wait_for_console_pattern(self,\n-                                 'PIC32MK QEMU booting FreeRTOS...')\n-        # Wait for a second Hello — proves the tick ISR fires repeatedly\n-        # and context switches work (CS0 yield + Timer1 preemption).\n-        wait_for_console_pattern(self,\n-                                 'Hello from FreeRTOS!')\n-        wait_for_console_pattern(self,\n-                                 'Hello from FreeRTOS!')\n-\n-    def test_freertos_ping_task(self):\n-        \"\"\"Second FreeRTOS task (Ping) also runs — proves multitasking.\"\"\"\n+                'pic32mk_test_fw.bin not found — '\n+                'build with: ninja -C <builddir> pic32mk_test_fw.bin')\n         self.set_machine('pic32mk')\n         self.vm.set_console()\n-        self.vm.add_args('-bios', self.get_firmware_path(),\n-                         '-nographic')\n+        self.vm.add_args('-bios', fw, '-nographic')\n         self.vm.launch()\n-        wait_for_console_pattern(self,\n-                                 'PIC32MK QEMU booting FreeRTOS...')\n-        # Ping task fires every 5 seconds\n-        wait_for_console_pattern(self, 'Ping')\n+        wait_for_console_pattern(self, 'Hello, PIC32MK!')\n \n \n if __name__ == '__main__':\ndiff --git a/tests/qtest/meson.build b/tests/qtest/meson.build\nindex b735f55fc4..769de2054f 100644\n--- a/tests/qtest/meson.build\n+++ b/tests/qtest/meson.build\n@@ -164,7 +164,9 @@ qtests_mips = \\\n   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \\\n   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])\n \n-qtests_mipsel = qtests_mips\n+qtests_mipsel = qtests_mips + \\\n+  (config_all_devices.has_key('CONFIG_PIC32MK') ? ['pic32mk-test',\n+                                                    'pic32mk-canfd-test'] : [])\n qtests_mips64 = qtests_mips\n qtests_mips64el = qtests_mips\n \n","prefixes":["RFC","2/3"]}