# 13. Arduino IDE增加硬件分区配置选项

ESP32板的Flash有16M，用16进制数表示存储地址的范围是：0x0 - 0x01000000 。

这是系统已经配置好的分区表, 如下图：

![](/files/-MchvFIkmIVuYEVWN9ct)

此分区表文件在电脑中的存储位置：

C:\Users\\{YourUserName}\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.\*\tools\partitions\large\_spiffs\_16MB.csv

从上述分区表中可以看出：APP0区和APP1区各4.5M；数据区为SPIFFS，大小为6.9M。

但是在Arduino IDE中，ESP32 Dev Module的硬件分区配置选项中未包含这项配置：

![](/files/-MchxVEJS3sqleqUjB_p)

我们要为ESP32 Dev Module加入这个配置。

打开开发板配置文件：C:\Users\\{YourUserName}\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.\*\boards.txt

定位开发板的名称：esp32.name=ESP32 Dev Module，如下图所示：

![](/files/-Mchz3nNhx0WxXBTBXvr)

在配置文件中ESP32 Dev Module分区配置的此行文字

```
esp32.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
```

下面加入以下3行文字：

```
esp32.menu.PartitionScheme.large_spiffs=BiBoard V0(4.5 MB APP with OTA /6.9 MB SPIFFS)
esp32.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB
esp32.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824
```

下面分别解释一下这3行文字的含义：

```
esp32.menu.PartitionScheme.large_spiffs=BiBoard V0(4.5 MB APP with OTA /6.9 MB SPIFFS)
```

ESP32 分区配置的名称，命名为BiBoard V0(4.5M APP with OTA /6.9 MB SPIFFS)，也可以换成你熟悉的其它名称。

```
esp32.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB
```

分区配置文件信息，就是large\_spiffs\_16MB.csv文件。你也可以自己写一个分区文件调整APP和数据区的文件大小。

```
esp32.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824
```

此行文字指定上传最大的程序大小 4685824 bytes。

下面我们试着编译一个简单的程序，测试以上配置是否设置成功。

重新打开Arduino IDE，我们可以看到刚才配置的BiBoard：

![](/files/kf3d5QH8Q1y6OoMzZoq6)

编译程序后，结果如下图所示：

![](/files/-MciBDzLnc9v63bQr_3E)

编译完成，使用了213KB的Flash（4%）最大可使用4685824 bytes。

其中4685824 bytes就是刚才增加到配置文件的第三行文字中指定的最大程序上传字节数。

至此您已在Arduino IDE中完成了对拥有最大Flash空间的开发板的配置。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/chinese/biboard/li-cheng/13.arduino-ide-zeng-jia-ying-jian-fen-qu-pei-zhi-xuan-xiang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
