Skip to content

f469-disco: add missing simulator stubs (LED, SDCard, hard_reset) #15

@Amperstrand

Description

@Amperstrand

Summary

f469-disco/libs/unix/pyb.py is missing several class/function stubs that are available on hardware but not in the simulator:

  1. LED — used by some firmware code for status indication
  2. SDCard — needed if any code references SD card operations
  3. hard_reset()pyb.hard_reset() is called by HIL test code (TEST_RESET command) but not defined in simulator

Proposed additions to libs/unix/pyb.py

class LED:
    def __init__(self, id):
        self.id = id
    def on(self):
        pass
    def off(self):
        pass
    def toggle(self):
        pass

class SDCard:
    def __init__(self, *args, **kwargs):
        pass
    def readblocks(self, *args, **kwargs):
        pass
    def writeblocks(self, *args, **kwargs):
        pass
    def ioctl(self, *args, **kwargs):
        return 0

def hard_reset():
    import sys
    sys.exit()

Impact

Without hard_reset(), importing hil.py on the simulator fails because HILCommandHandler._process_line("TEST_RESET") calls pyb.hard_reset().

Status

  • Changes were made locally but reverted to keep submodule clean
  • Should be submitted as PR to diybitcoinhardware/f469-disco

Metadata

Metadata

Assignees

No one assigned

    Labels

    bootloaderf469-discof469-disco submodule issuepriority: mediumShould be addressed, improves qualityupstreamIssues that should be submitted upstream

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions