Skip to content

Commit

Permalink
Add openocd logging to vexRiscvTcpTest
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Jan 23, 2025
1 parent 4094b53 commit a5de09a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions bittide-instances/src/Bittide/Instances/Hitl/Driver/VexRiscvTcp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ driverFunc _name [(hwT, dI)] = do

let
hitlDir = projectDir </> "_build" </> "hitl"
stdoutLog = hitlDir </> "picocom-stdout.log"
stderrLog = hitlDir </> "picocom-stderr.log"
mkLogPath name = (hitlDir </> name <> ".log")
picoOutLog = mkLogPath "picocom-stdout"
picoErrLog = mkLogPath "picocom-stderr"
ocdOutLog = mkLogPath "openocd-stdout"
ocdErrLog = mkLogPath "openocd-stderr"
openocdEnv = [("OPENOCD_STDOUT_LOG", ocdOutLog), ("OPENOCD_STDERR_LOG", ocdErrLog)]

initHwDevice = do
openHardwareTarget hwT
Expand Down Expand Up @@ -142,11 +146,11 @@ driverFunc _name [(hwT, dI)] = do

initHwDevice

withOpenOcd dI.usbAdapterLocation 3333 6666 4444 $ \ocd -> do
withOpenOcdWithEnv openocdEnv dI.usbAdapterLocation 3333 6666 4444 $ \ocd -> do
liftIO $ initOpenOcd ocd

liftIO $ putStrLn "Starting Picocom..."
withPicocomWithLogging dI.serial stdoutLog stderrLog $ \pico -> do
withPicocomWithLogging dI.serial picoOutLog picoErrLog $ \pico -> do
liftIO $ initPicocom pico

liftIO $ putStrLn "Starting GDB..."
Expand Down Expand Up @@ -234,10 +238,10 @@ case_testTcpClient = do
projectDir <- findParentContaining "cabal.project"
let
hitlDir = projectDir </> "_build" </> "hitl"
stdoutLog = hitlDir </> "picocom-stdout.log"
stderrLog = hitlDir </> "picocom-stderr.log"
putStrLn $ "logging stdout to `" <> stdoutLog <> "`"
putStrLn $ "logging stderr to `" <> stderrLog <> "`"
picoOutLog = hitlDir </> "picocom-stdout.log"
picoErrLog = hitlDir </> "picocom-stderr.log"
putStrLn $ "logging stdout to `" <> picoOutLog <> "`"
putStrLn $ "logging stderr to `" <> picoErrLog <> "`"
let
openOcdProc =
(proc startOpenOcdPath [])
Expand All @@ -256,7 +260,7 @@ case_testTcpClient = do
, new_session = True
, env =
Just
(currentEnv <> [("PICOCOM_STDOUT_LOG", stdoutLog), ("PICOCOM_STDERR_LOG", stderrLog)])
(currentEnv <> [("PICOCOM_STDOUT_LOG", picoOutLog), ("PICOCOM_STDERR_LOG", picoErrLog)])
}
putStrLn "Starting OpenOcd..."
Expand Down

0 comments on commit a5de09a

Please sign in to comment.