| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Fri, 16 Jan 2026 23:48:59 GMT
X-Served-By: cache-dfw-kdfw8210166-DFW, cache-bom-vanm7210034-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768607339.298017,VS0,VE383
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
hocd: OpenOCD Haskell interface
hocd: OpenOCD Haskell interface
Flags
Automatic Flags
| Name | Description | Default |
|---|---|---|
| build-readme | Build README.lhs example | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- hocd-0.1.3.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.1.0.0, 0.1.1.0, 0.1.1.1, 0.1.2.0, 0.1.3.0 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | attoparsec, base (>=4.12 && <5), bytestring, containers, data-default-class, exceptions, hocd, mtl, network, text, transformers [details] |
| License | BSD-3-Clause |
| Copyright | 2023 sorki |
| Author | sorki |
| Maintainer | srk@48.io |
| Uploaded | by srk at 2024-01-18T09:06:31Z |
| Category | Embedded |
| Home page | https://github.com/DistRap/hocd |
| Source repo | head: git clone https://github.com/DistRap/hocd |
| Distributions | NixOS:0.1.3.0 |
| Executables | hocd-readme, hocd-read-mem |
| Downloads | 335 total (17 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2024-01-18 [all 1 reports] |
Readme for hocd-0.1.3.0
[back to package description]hocd
OpenOCD RPC service client.
API
See Haddocks or HOCD.Monad
Example
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
import Data.Word (Word32)
import HOCD
main :: IO ()
main = runOCD example >>= print
-- | For STM32G474
example
:: MonadOCD m
=> m ([Word32], Word32, Word32)
example = do
-- Note that halting a target is not required
-- for writing or reading memory, only for reading
-- CPU registers
halt'
-- Read pc CPU register
pc <- readReg $ regName "pc"
-- Write back same value
writeReg @Word32 (regName "pc") pc
-- Read RCC.CR register
rccCr <- readMemCount @Word32 0x40021000 2
-- Read and increment GPIOA.ODR register
let gpioaOdr = 0x48000014
odr <- readMem32 gpioaOdr
writeMem gpioaOdr [odr+1]
r <- readMem32 gpioaOdr
resume
pure (rccCr, r, pc)
This example is runnable from git repository using:
openocd -f nucleo.cfg
cabal run hocd-readme
Executable
hocd-read-mem can be used to read a single or multiple
addresses:
cabal run hocd-read-mem -- 0x40021000 0x48000014
Outputs:
0x40021000: 0x3030500
0x48000014: 0x9