> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速开始

## 开始前准备

请先准备：

* 一个终端应用（见下方推荐）
* 一个可用的固件项目（或新建一个）

### 推荐终端

<Tabs>
  <Tab title="macOS / Linux">
    推荐使用 [Ghostty](https://ghostty.org/)。

    **macOS (Homebrew):**

    ```bash theme={"system"}
    brew install --cask ghostty
    ```

    **Linux:**

    ```bash theme={"system"}
    # 各发行版安装方式见 https://ghostty.org/docs/install
    ```
  </Tab>

  <Tab title="Windows">
    推荐使用 [Alacritty](https://alacritty.org/)。

    **winget:**

    ```powershell theme={"system"}
    winget install Alacritty.Alacritty
    ```

    **Scoop:**

    ```powershell theme={"system"}
    scoop install alacritty
    ```
  </Tab>
</Tabs>

## 步骤 1：安装并启动 Embedder

<Tabs>
  <Tab title="macOS / Linux">
    ```bash theme={"system"}
    curl -fsSL https://embedder.com/install | bash
    ```

    <Info>
      原生安装会在后台自动更新，保持最新版本。
    </Info>
  </Tab>

  <Tab title="Windows">
    ```powershell theme={"system"}
    irm https://embedder.com/install | iex
    ```

    <Info>
      原生安装会在后台自动更新，保持最新版本。
    </Info>
  </Tab>
</Tabs>

在项目目录中启动：

```bash theme={"system"}
cd your-project
embedder
```

## 步骤 2：登录账号

首次启动交互会话时，你需要登录：

```bash theme={"system"}
embedder
# 首次使用会提示登录
```

按提示完成登录。如果网页没有自动打开，点击终端里的链接即可。

登录后凭据会保存在本地；如需切换账号，使用 `/logout`。

## 步骤 3：开始第一轮会话

```bash theme={"system"}
cd /path/to/your/project
embedder
```

你会看到项目选择界面。

### 创建项目

<Frame caption="项目选择界面">
  <img src="https://mintcdn.com/embedder/4y2q1agcuRz3fRND/images/select-project.png?fit=max&auto=format&n=4y2q1agcuRz3fRND&q=85&s=a9be00239cea81ce0616f63c85ec8a36" alt="项目选择对话框，包含搜索框、新建项目按钮和历史项目列表" width="1992" height="1656" data-path="images/select-project.png" />
</Frame>

### 选择平台

启动后，Embedder 会让你选择硬件平台。可以用搜索框过滤，方向键选择，`Enter` 确认。

<Frame caption="平台选择界面（Nordic Semiconductor 示例）">
  <img src="https://mintcdn.com/embedder/ujO4-sDifSwa2qo6/images/select-platform.png?fit=max&auto=format&n=ujO4-sDifSwa2qo6&q=85&s=a6c3fc150ba41632be86d7a8f4b7f876" alt="平台选择对话框，显示 Nordic Semiconductor 的 nRF9xxx 平台" width="1980" height="1636" data-path="images/select-platform.png" />
</Frame>

请选择与你硬件匹配的平台。Embedder 会基于平台官方文档进行回答和代码生成。

自定义平台请参考 [常见工作流](/zh-Hans/core-concepts/common-workflows)。

### 选择外设

完成平台选择后，Embedder 会让你配置外设。

<Frame caption="外设选择界面（多厂商组件）">
  <img src="https://mintcdn.com/embedder/ujO4-sDifSwa2qo6/images/select-peripherals.png?fit=max&auto=format&n=ujO4-sDifSwa2qo6&q=85&s=5bf9421145a180e0648c9072b476478c" alt="外设选择对话框，显示 Analog Devices、Nexperia、Allegro MicroSystems 等组件" width="1990" height="1646" data-path="images/select-peripherals.png" />
</Frame>

搜索目标组件后，使用方向键移动，按空格勾选，`Enter` 完成。

自定义外设请参考 [常见工作流](/zh-Hans/core-concepts/common-workflows)。

<Tip>
  你可以稍后用 `/peripherals` 修改外设配置。
</Tip>

## 步骤 4：提出第一条问题

平台和外设配置完成后，你可以直接用自然语言提问。Embedder 会自动参考相关数据手册、参考手册和 errata。若设备已连接，它也会读取实时串口输出。

示例：

```
tell me about the nrf9151 gps capabilities
```

<Frame caption="Embedder 回答 nRF9151 GPS 问题并显示串口输出">
  <img src="https://mintcdn.com/embedder/ujO4-sDifSwa2qo6/images/example-prompt.png?fit=max&auto=format&n=ujO4-sDifSwa2qo6&q=85&s=f358b48eeddddf8005de9f15963b30d0" alt="Embedder 界面展示 nRF9151 GPS 问题、文档检索结果和实时串口信息" width="2862" height="1898" data-path="images/example-prompt.png" />
</Frame>

你也可以问代码层问题：

```
what does this project do?
```

```
where is the main entry point?
```

```
explain the folder structure
```

<Note>
  Embedder 会按需读取项目文件和数据手册，你不需要手动喂大量上下文。
</Note>

## 步骤 5：完成第一处代码修改

先试一个简单任务：

```
add a function to toggle the LED on GPIO pin 13
```

Embedder 会：

1. 找到目标文件
2. 读取相关寄存器定义
3. 给出带引用的修改建议
4. 请求你的确认
5. 应用修改

<Note>
  在你授权前，Embedder 默认不会直接改文件（除非你明确允许）。
</Note>

## 步骤 6：用 Embedder 做 Git 操作

示例：

```
what files have I changed?
```

```
commit my changes with a descriptive message
```

复杂一些的操作也可以：

```
create a new branch called feature/uart-driver
```

```
show me the last 5 commits
```

```
help me resolve merge conflicts
```

## 步骤 7：修 bug 或加功能

你可以直接描述问题：

```
my SPI peripheral isn't responding - help me debug
```

或贴错误：

```
I'm getting a hard fault when I call HAL_UART_Transmit - why?
```

Embedder 通常会：

* 对照数据手册检查代码
* 排查常见配置错误
* 交叉检查 MCU 已知 errata
* 给出并验证修复方案

## 步骤 8：继续探索常见工作流

常见提示词：

**写驱动**

```
write an I2C driver for the BME280 temperature sensor
```

**配置外设**

```
set up PWM on Timer 2 with a 1kHz frequency
```

**生成初始化代码**

```
initialize the ADC for 12-bit resolution on channel 5
```

**迁移平台**

```
help me port this STM32 driver to nRF52
```

更多示例见 [常见工作流](/zh-Hans/core-concepts/common-workflows)。

<Tip>
  把 Embedder 当成“熟悉你硬件的资深固件工程师”来提问，效果通常更好。
</Tip>

## 接下来做什么

继续阅读 [最佳实践](/zh-Hans/core-concepts/best-practices) 或 [常见工作流](/zh-Hans/core-concepts/common-workflows)。

## 获取帮助

* **在 Embedder 内**：输入 `/help`
* **文档**：浏览各主题页面
* **社区**：加入 Discord 获取支持
