Skip to content

Commit

Permalink
Add list of ignoredErrors to openOcdWaitForHalt
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Feb 19, 2025
1 parent 9b307f2 commit 11c6819
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Paths_bittide_instances

import Control.Monad.Catch
import Control.Monad.IO.Class
import Data.List (isPrefixOf)
import Data.List (isPrefixOf, isSubsequenceOf)
import Data.Maybe (fromJust)
import System.IO
import System.Posix.Env (getEnvironment)
Expand Down Expand Up @@ -226,9 +226,16 @@ startPicocomWithLoggingAndEnv devPath stdoutPath stderrPath extraEnv = do

pure (picoHandles', cleanupProcess picoHandles)

-- | List of detectors that match on error messages that can be safely ignored.
ignoredErrors :: [String -> Bool]
ignoredErrors =
[ isSubsequenceOf "DMI operation didn't complete in"
]

-- | Wait until we see "Halting processor", fail if we see an error.
openOcdWaitForHalt :: String -> Filter
openOcdWaitForHalt s
| any ($ s) ignoredErrors = Continue
| "Error:" `isPrefixOf` s = Stop (Error ("Found error in OpenOCD output: " <> s))
| "Halting processor" `isPrefixOf` s = Stop Ok
| otherwise = Continue
Expand Down

0 comments on commit 11c6819

Please sign in to comment.