Skip to content

Commit

Permalink
Add compare-sections to HITL tests that use vexRiscv
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Jan 24, 2025
1 parent cd8a95b commit 29087a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ driverFunc testName targets = do
openHardwareTarget hwT
updateVio "vioHitlt" [("probe_prog_en", "0")]

verifyBinary :: (HwTarget, DeviceInfo) -> ProcessStdIoHandles -> VivadoM ()
verifyBinary (_, d) gdb = do
liftIO $ do
putStrLn $ "Verifying binary on target " <> show d.deviceId
runGdbCommands gdb.stdinHandle [gdbEcho "Compare sections", "compare-sections"]

startBinary :: (HwTarget, DeviceInfo) -> ProcessStdIoHandles -> VivadoM ()
startBinary (hwT, d) gdb = do
liftIO $ putStrLn $ "Starting binary on target " <> show d.deviceId
Expand Down Expand Up @@ -231,6 +237,7 @@ driverFunc testName targets = do
brackets (liftIO <$> initGdbs gdbPorts) (liftIO . snd) $ \initGdbsData -> do
let gdbs = fmap fst initGdbsData
zipWithM_ loadBinary targets gdbs
zipWithM_ verifyBinary targets gdbs
zipWithM_ startBinary targets gdbs

testResults <- getTestResults targets (L.replicate (L.length targets) TestRunning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ driverFunc testName targets = do
, "file \"./_build/cargo/firmware-binaries/riscv32imc-unknown-none-elf/debug/hello\""
, "target extended-remote :" <> show gdbPort
, "load"
, gdbEcho "Compare sections"
, "compare-sections"
]

tryWithTimeout "Waiting for \"load done\"" 120_000_000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ driverFunc testName [(hwT, dI)] = do
, "target extended-remote :3333"
, "load"
, gdbEcho "load done"
, gdbEcho "Compare sections"
, "compare-sections"
, "break core::panicking::panic"
, "break ExceptionHandler"
, "break rust_begin_unwind"
Expand Down

0 comments on commit 29087a6

Please sign in to comment.