Python SDK
Boot a simulation of your board with your firmware, and test it from Python: its console, its inputs, the values it reports, and its serial ports.
pip install "hardlabs-sdk[test]"from hardlabs_sdk import Client
with Client().start("company_name/board_name", "build/app.elf") as board:
board.wait_for("app ready", within=5)
board.do("bench-supply.volts", 11.5)
assert board.read("power-monitor.bus-current") < 0.2Two ways to use it
Drive the board from your tests.Change its inputs, read what its panels show, type into the firmware's console and wait for output. Waits count simulated time. Start with the Quickstart.
Keep your existing test framework.If your tests talk to the device over a serial port, the SDK opens the simulated board's port on your computer and your framework opens it with serial_for_url. See Using your own test framework.
Documentation
- InstallationInstall hardlabs-sdk from PyPI and sign in with a HardLabs token.
- QuickstartWrite and run a pytest test against the demo board in five minutes.
- Loading firmwareBoot the board with an ELF, or with a bootloader and application at their flash addresses.
- Console and simulated timeType into the firmware's console, wait for its output, and let simulated time pass.
- Controls and readingsChange the board's inputs, such as a supply voltage, a sensor's value or a button, and read what its panels show.
- PartsAddress the board's parts by schematic reference designator, and find them by bus, address or wiring.
- Using your own test frameworkOpen the simulated board's serial ports on your computer, so a framework built for the real device runs unchanged.
- Testing with pytestUse the pytest plugin's fixtures to boot the board once per session and test against it.
- On-target unit testsRun a Unity or GoogleTest binary on the simulated processor and collect its results as JUnit XML.
- Continuous integrationRun board tests in GitHub Actions or any CI service with a token stored as a secret.
- What the simulation coversHow results on the simulated board relate to your physical board, and how to check before blaming the firmware.
- API referenceEvery class, method, fixture and option in hardlabs-sdk.