Metadata-Version: 2.4
Name: armbuilderx
Version: 0.1.2
Summary: CMake-based build, flash and serial-monitor tooling for Arm Cortex-M Keil/MDK projects, built on CMSIS-Toolbox and pyOCD
Author: ArmBuilderX
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1
Requires-Dist: pyocd>=0.36
Requires-Dist: pyserial>=3.5
Requires-Dist: requests>=2.31
Requires-Dist: tqdm>=4.66
Requires-Dist: PyYAML>=6.0

# ArmBuilderX

Cross-platform CLI that turns a Keil/MDK Arm Cortex-M project into a
CMake project, builds it with the Arm GNU Toolchain, flashes it with
pyOCD, and streams the DAPLink/CMSIS-DAP virtual COM port log.

It is built on top of official tooling rather than a custom project
parser:

- **[CMSIS-Toolbox](https://github.com/Open-CMSIS-Pack/devtools)**
  (`csolution` / `cbuild` / `cbuild2cmake` / `cpackget`) resolves the
  CMSIS-Pack device data (CPU, FPU, memory map, startup/linker files)
  and generates the actual `CMakeLists.txt`.
- **[pyOCD](https://github.com/pyocd/pyOCD)** flashes the target over
  CMSIS-DAP/DAPLink and can also list/open the debug probe's serial
  port.
- **CMake + Arm GNU Toolchain (`arm-none-eabi-gcc`)** builds the
  generated CMake project. `ninja` is used as the CMake generator.

## Install

```bash
pip install armbuilderx
```

## Usage

```bash
# One-time: point ArmBuilderX at the vendor pack(s) that describe your device.
armbuilderx init --pack path/to/Vendor.PackName.x.y.z.pack

# Generate (or refresh) the GCC/CMake project for one example, from its
# existing MDK project.
armbuilderx generate examples/device_support/ns800rt5xxx/examples/gpio/gpio_ex2_output

# Build it (adds arm-none-eabi-gcc/cmake/ninja/git to ~/.armbuilderx/tools
# automatically if they are missing from PATH).
armbuilderx build examples/device_support/ns800rt5xxx/examples/gpio/gpio_ex2_output

# Flash the built ELF over CMSIS-DAP/DAPLink with pyOCD.
# (the build step also emits matching .hex and .bin images alongside the .elf)
armbuilderx flash examples/device_support/ns800rt5xxx/examples/gpio/gpio_ex2_output

# Open the DAPLink virtual COM port and stream log output.
armbuilderx monitor

# All of the above, in one shot.
armbuilderx run examples/device_support/ns800rt5xxx/examples/gpio/gpio_ex2_output
```

## SDK adapters

ArmBuilderX keeps vendor-specific SDK rules behind SDK adapters. The current
`ns800rt5xxx` adapter contains the NS800 project-layout detection, GCC startup
file replacement, linker-script selection, and NS800-only compiler defines.
The command layer remains independent of those details and can select an
adapter explicitly when needed:

```bash
armbuilderx generate <example-dir> --sdk ns800rt5xxx
```

Without `--sdk`, ArmBuilderX detects the adapter from the example layout. To
add another SDK such as GR551x, implement a new adapter under
`src/armbuilderx/sdk/` and register it in `sdk/registry.py`; do not add its
directory rules to the NS800 adapter or the generic generator.

### GR551x

The `gr551x` adapter supports Goodix GR551x projects that ship a `GCC/`
CMSIS-Toolbox project. It verifies the `Goodix::GR5xxx_DFP@1.0.0` pack and
`Goodix::GR551x` device, preserves the SDK's source groups and BLE library,
and resolves the selected GCC toolchain's Cortex-M4 softfp runtime libraries.

```bash
armbuilderx init --pack ../GR551x_SDK_V2.1.1/Goodix.GR5xxx_DFP.1.0.0.pack
armbuilderx build ../GR551x_SDK_V2.1.1/projects/peripheral/gpio/app_gpio --sdk gr551x --clean
```

Each project keeps its generated CMake project under a `GCC/` folder
next to the existing `MDK/`/`IAR/` folders, matching the SDK's own
convention.
