# ESP32-C6 Flashing Instructions

## Quick Flash (Once Device is Detected)

Run the automated script:
```bash
./flash_esp32c6.sh
```

Or manually specify the port:
```bash
./flash_esp32c6.sh /dev/cu.usbserial-XXXX
```

## Manual Flash Command

If you know the serial port, use this one-liner:

```bash
cd /Users/indianaholmessr/Documents/iamDEV/ai && \
/opt/homebrew/bin/esptool --chip esp32c6 --port /dev/cu.YOUR_PORT_HERE \
  erase-flash && \
/opt/homebrew/bin/esptool --chip esp32c6 --port /dev/cu.YOUR_PORT_HERE \
  write-flash 0x0 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.bin
```

## Steps to Flash

1. **Connect ESP32-C6 via USB** to your Mac

2. **Put device in download mode:**
   - Hold the **BOOT** button
   - Press and release the **RESET** button
   - Release the **BOOT** button

3. **Find the serial port:**
   ```bash
   ls -1 /dev/cu.* | grep -v Bluetooth
   ```
   Look for ports like `/dev/cu.usbserial-XXXX` or `/dev/cu.wchusbserialXXXX`

4. **Run the flash script:**
   ```bash
   ./flash_esp32c6.sh
   ```

## Memory Layout

- Bootloader: `0x0`
- Partition Table: `0x8000`
- Firmware: `0x10000`

## Troubleshooting

- **Device not detected**: Make sure it's in download mode (BOOT button sequence)
- **Port busy**: Close any serial monitor or other programs using the port
- **Permission denied**: You may need to add your user to the `dialout` group or use `sudo` (not recommended)

