Repository navigation
Home
Yvan Sinues edited this page Aug 19, 2026
·
7 revisions
- Python 3.11+ (3.12 or 3.13 recommended)
- LLM API key — one of: OpenAI, Azure OpenAI, or Anthropic
- Git
-
Optional:
arm-none-eabi-gccfor compilation validation (STM32 plugin) -
Optional:
cppcheckfor static analysis (winget install Cppcheck.Cppcheck) -
Optional:
pyocdfor firmware flashing (uv pip install pyocd) - Optional: Docker for containerized deployment
# Clone
git clone https://github.com/EchoSNS/embedforge.git
cd embedforge
# Option 1: Using uv (recommended)
uv sync
# Option 2: Using pip
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# or: .venv\Scripts\Activate.ps1 # Windows PowerShell
pip install -e .
# Optional: RAG support
uv pip install -e ".[rag]"
# Optional: Firmware flashing
uv pip install -e ".[flash]"
# Optional: Development tools
uv pip install -e ".[dev]"docker build -t embedforge .
docker run -p 8000:8000 --env-file .env embedforge- Copy the environment template:
cp .env.example .env- Edit
.envwith your LLM credentials:
LLM_PROVIDER=openai
OPENAI_API_KEY=sk-your-key-here
OPENAI_MODEL=gpt-4- (Optional) Set your SDK path for compilation:
STM32CUBE_F4_PATH=C:/STM32CubeF4Note:
STM32CUBE_F4_PATHshould point to the root of the cloned STM32CubeF4 repo, not a subdirectory. The system automatically appends the correct HAL and CMSIS include paths.
- (Optional) Set log level for debugging:
LOG_LEVEL=DEBUG- (Optional) Cost control and model routing:
# Set a spending budget (USD)
EMBEDFORGE_BUDGET_USD=5.00
# Route specific stages to cheaper models (JSON)
EMBEDFORGE_STAGE_MODELS={"refiner": "gpt-4o-mini", "chat": "gpt-4o-mini"}
# Override pricing for custom deployments (JSON, per 1M tokens)
EMBEDFORGE_COST_OVERRIDES={"my-model": {"input": 2.0, "output": 8.0}}
# LLM response cache size (default: 100)
EMBEDFORGE_CACHE_SIZE=100
# Restrict SDK scan to specific directories (security)
EMBEDFORGE_SDK_ROOTS=C:/STM32CubeF4;D:/SDKs
# Max user input length before truncation (default: 5000)
# EMBEDFORGE_MAX_INPUT_LENGTH=5000See .env.example for all available options.
# Backend
uv run uvicorn server.main:app --reload
# Or: python app.py
# Frontend (separate terminal)
cd frontend
npm install
npm run devOpen http://localhost:3000 in your browser.
- Select board — Choose "NUCLEO-F446RE" from the sidebar
- Describe requirement — Example: "LED blink on PA5 at 2Hz using TIM2 interrupt"
- Review requirements — The AI refines your input into structured JSON. Edit if needed, then approve.
- Review hardware — Pin and peripheral assignments. Approve.
- Review architecture — Selected HAL drivers. Approve.
- Review detailed design — Function-level specification. Approve.
- Get code — Download the generated .c/.h files.
For a simple LED blink, you'll get:
-
main.c— Initialization and main loop -
main.h— Header with function declarations -
stm32f4xx_it.c— Interrupt handlers (TIM2 ISR) -
stm32f4xx_hal_msp.c— Clock enable and GPIO config -
test_led_blink.c— Unity test file (TDD) -
mock_hal_tim.h/mock_hal_tim.c— Mock stubs for testing
To use a different vendor SDK (not STM32), create a plugin:
- Create
plugins/your_sdk/ - Implement the 5 interfaces (see Plugin Development)
- Set
EMBEDFORGE_PLUGIN=your_sdkin.env - Restart the app
Instead of manually writing plugin code, you can use the SDK Scanner to auto-generate capability profiles:
- Navigate to Settings (gear icon in sidebar)
- Enter the path to your SDK headers (e.g.
C:/STM32CubeF4/Drivers/STM32F4xx_HAL_Driver/Inc) - Click Scan — the system extracts all functions, types, and macros
- Enter vendor/SDK name, then click Generate Profile
- The LLM analyzes the extracted metadata and creates a structured profile
- Review and edit the generated profile in the Profile Editor tab
You can also upload reference .c/.h projects in the Reference Analyzer tab to improve code generation quality.
| Issue | Solution |
|---|---|
| "LLM not configured" | Check .env has valid API key and correct LLM_PROVIDER
|
| "No active plugin" | Set EMBEDFORGE_PLUGIN=stm32_hal in .env
|
| "No module named dotenv" | Run uv pip install python-dotenv or uv sync
|
| Compilation fails | Install arm-none-eabi-gcc and set STM32CUBE_F4_PATH
|
| cppcheck not detected | Install cppcheck and add to PATH |
| pyOCD not detected | Run uv pip install pyocd or uv pip install -e ".[flash]"
|
| Import errors | Run uv sync from project root |
| Slow generation | Use gpt-4o instead of gpt-4 for faster (cheaper) results |
uv add fails |
Ensure [tool.hatch.build.targets.wheel] exists in pyproject.toml |