Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

truner: adding Sparcv8Leon3 target support #334

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maska989
Copy link
Contributor

@maska989 maska989 commented Mar 7, 2024

JIRA: CI-249

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: sparcv8leon3-gr716-mimas.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

trunner/target/sparcv8.py Outdated Show resolved Hide resolved
psh/test.yaml Outdated Show resolved Hide resolved
trunner/target/sparcv8.py Outdated Show resolved Hide resolved
trunner/target/sparcv8.py Outdated Show resolved Hide resolved
trunner/target/sparcv8.py Outdated Show resolved Hide resolved
trunner/target/sparcv8.py Outdated Show resolved Hide resolved
@nalajcie
Copy link
Member

nalajcie commented Mar 7, 2024

please use imperative mood in commit message ("add" instead of "adding")

Copy link
Member

@mateusz-bloch mateusz-bloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trunner instead truner in commit msg

Copy link

Unit Test Results

7 156 tests   - 98   6 454 ✅  - 89   36m 53s ⏱️ - 1m 20s
  408 suites ± 0     701 💤  - 10 
    1 files   ± 0       1 ❌ + 1 

For more details on these failures, see this check.

Results for commit 7cdfd6c. ± Comparison against base commit 609cb06.

This pull request removes 99 and adds 1 tests. Note that renamed tests count towards both.
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype._tolower
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype._toupper
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isalnum
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isalpha
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isascii
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isblank
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.iscntrl
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isdigit
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.isgraph
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc.ctype.islower
…
phoenix-rtos-tests/libc/misc ‑ armv7m4-stm32l4x6-nucleo:phoenix-rtos-tests/libc/misc

return builder.get_harness()


class MimasSparcV8EvkTarget(GR716Target):
Copy link
Member

@mateusz-bloch mateusz-bloch Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if I understand correctly, the target is not Sparcv8Leon3, but GR716, which is based on the Sparcv8Leon3 architecture. So, shouldn't it be the other way around, something like GR716-mimas-EvkTarget(SparcV8Target)

trunner/target/sparcv8.py Show resolved Hide resolved
Comment on lines +74 to +94
while True:
inChar = self.dut.read()
inChar += inChar

if "Bootloader" in inChar:
with open(f"{boot_dir}/{image}", "rb") as fd:
filebuff = fd.read()
time.sleep(1)
self.dut.serial.write(filebuff)

try:
self.dut.expect_exact("(psh)%", timeout=80)
fd.close()
break

except pexpect.TIMEOUT as e:
fd.close()
raise FlashError(
msg=str(e),
output=e.stdout.decode("ascii") if e.stdout else None,
) from e
Copy link
Member

@mateusz-bloch mateusz-bloch Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify this by knowing that dut is a wrapper around pexpect. For example, by expecting the appearance of the Bootloader instead of catching each character.

Example of simplified code that should work:

        with open(f"{boot_dir}/{image}", "rb") as fd:
            try:
                self.dut.expect_exact("Bootloader", timeout=60)
                time.sleep(1)
                self.dut.serial.write(fd.read())
                self.dut.expect_exact("(psh)%", timeout=80)
            except pexpect.TIMEOUT as e:
                raise FlashError(
                    msg="Timeout waiting for boatloader prompt or psh prompt.",
                    output=e.stdout.decode("ascii") if e.stdout else None,
                ) from e

Remember also that when you use a context manager in Python, it automatically handles the closing of resources opened within it, so you don't need to manually close them with fd.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants