FiWiManager/docs/brainstem-sdk.md

73 lines
3.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BrainStem SDK tarball in this repo
The repository vendors **one file** under `brainstem_sdk/`: the Acroname **Linux** SDK archive, for example:
`brainstem_sdk/brainstem_sdk_2.12.2_RHEL_9_x86_64.tgz`
That archive matches **RHEL 9 / compatible distros** on **x86_64**. It is the **driverless** bundle (API, examples, small CLI tools, udev helper). It does **not** replace `pip install brainstem` for Python; it adds headers, examples, and native utilities next to the tree.
## Extract the archive
From the repository root:
```bash
cd brainstem_sdk
tar -xzf brainstem_sdk_2.12.2_RHEL_9_x86_64.tgz
```
The tarball unpacks **into the current directory** (top-level entries: `api/`, `cli/`, `docs/`, `linux_brainstem_driverless/`, plus `license.txt`, `readme.txt`, `version.txt`). To avoid unpacking next to the `.tgz`, use a subdirectory:
```bash
mkdir -p brainstem_sdk/unpacked && cd brainstem_sdk/unpacked
tar -xzf ../brainstem_sdk_2.12.2_RHEL_9_x86_64.tgz
```
If you use `unpacked/`, set `BRAINSTEM2_DEV_ROOT` to the directory that contains `api/` after extract (for example `…/brainstem_sdk/unpacked`). FiWis default repo-local search only looks at `brainstem_sdk/` and `brainstem_sdk/BrainStem2/`, not `unpacked/`, without that variable.
## Device access (udev)
Before talking to hardware over USB, run the script described in `readme.txt` inside the extracted tree:
```bash
./linux_brainstem_driverless/udev.sh
```
That installs udev rules (typically requires `sudo`) and adds the current user to `dialout`. Reboot or re-login as the vendor readme recommends.
## Build C/C++ examples from source
Sample projects live under `api/examples/c_cpp/`. Each example includes `How_To_Build.txt` or `How_to_Build.txt` with Acronames steps (note the full filename — `find -name How` will not match). From the directory that contains `api/`:
```bash
find api/examples/c_cpp -maxdepth 2 -iname 'how*build*.txt' -print
```
Example: `api/examples/c_cpp/BrainStem2-Cpp-Example/How_To_Build.txt`. In general:
1. Open that file in the example directory you care about.
2. Copy the **`lib`** directory from the SDK into the example tree where the readme says (headers and `BrainStem2` shared library).
3. Run `make` (or follow the makefile targets documented there).
You need a normal Linux C/C++ toolchain (`gcc`, `g++`, `make`) and any extra packages the example readme mentions.
## Reflex (`.reflex` → `.map`) and `arc`
FiWi can invoke Acronames **Reflex compiler** `arc` via `python3 fiwi.py reflex compile …`. The **`arc`** binary is **not** shipped in this driverless `.tgz` listing (no `bin/arc` in the archive). Install the **BrainStem Development Kit** build that includes Reflex tooling, or set `FIWI_REFLEX_ARC` to a full path when you have `arc` elsewhere.
Details and download pointer:
```bash
python3 fiwi.py reflex help
python3 fiwi.py reflex which
```
Useful environment variables (also in `fiwi reflex help`):
- `BRAINSTEM2_DEV_ROOT` — root of an extracted kit (FiWi looks for `bin/arc`, `api/lib/BrainStem2`, etc.).
- `FIWI_REFLEX_ARC` — explicit path to `arc`.
- `FIWI_REFLEX_INCLUDE` — extra `-I` directories for `*.reflex` API headers if your layout is nonstandard.
## Qt / HubTool
`readme.txt` in the bundle notes that **HubTool** needs Qt packages on Linux. Install the distro-specific packages listed there if you use HubTool from Acronames full kit.