山姆的編程實作分享。。。

Sam Blog, Sam Sharing, Sam Studio

2020年8月4日

[Arduino][ESP32] Change Partition - By 懶人改法


下面是 ESP32 Dev Module 在 Boards.txt 的描述
Line 29 ~ 61 就描述了 ESP32 Dev Module 支援那些 Partition CSV

以 Line 29,30 為例,就描述支援的 Partition Scheme ,
名稱為 " Default 4MB with spiffs"
對應的Partition CSV File 為 "default.csv"


  1. esp32.name=ESP32 Dev Module  
  2.   
  3. esp32.upload.tool=esptool_py  
  4. esp32.upload.maximum_size=1310720  
  5. esp32.upload.maximum_data_size=327680  
  6. esp32.upload.wait_for_upload_port=true  
  7.   
  8. esp32.serial.disableDTR=true  
  9. esp32.serial.disableRTS=true  
  10.   
  11. esp32esp32.build.mcu=esp32  
  12. esp32esp32.build.core=esp32  
  13. esp32esp32.build.variant=esp32  
  14. esp32.build.board=ESP32_DEV  
  15.   
  16. esp32.build.f_cpu=240000000L  
  17. esp32.build.flash_size=4MB  
  18. esp32.build.flash_freq=40m  
  19. esp32.build.flash_mode=dio  
  20. esp32.build.boot=dio  
  21. esp32.build.partitions=default  
  22. esp32esp32.build.defines=  
  23.   
  24. esp32.menu.PSRAM.disabled=Disabled  
  25. esp32esp32.menu.PSRAM.disabled.build.defines=  
  26. esp32.menu.PSRAM.enabled=Enabled  
  27. esp32.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue  
  28.   
  29. esp32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)  
  30. esp32.menu.PartitionScheme.default.build.partitions=default  
  31. esp32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)  
  32. esp32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat  
  33. esp32.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)  
  34. esp32.menu.PartitionScheme.default_8MB.build.partitions=default_8MB  
  35. esp32.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336  
  36. esp32.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)  
  37. esp32.menu.PartitionScheme.minimal.build.partitions=minimal  
  38. esp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)  
  39. esp32.menu.PartitionScheme.no_ota.build.partitions=no_ota  
  40. esp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152  
  41. esp32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)  
  42. esp32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g  
  43. esp32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576  
  44. esp32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)  
  45. esp32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat  
  46. esp32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152  
  47. esp32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)  
  48. esp32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat  
  49. esp32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576  
  50. esp32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)  
  51. esp32.menu.PartitionScheme.huge_app.build.partitions=huge_app  
  52. esp32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728  
  53. esp32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)  
  54. esp32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs  
  55. esp32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080  
  56. esp32.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)  
  57. esp32.menu.PartitionScheme.fatflash.build.partitions=ffat  
  58. esp32.menu.PartitionScheme.fatflash.upload.maximum_size=2097152  
  59. esp32.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)  
  60. esp32.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB  
  61. esp32.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728  
  62.   
  63. esp32.menu.CPUFreq.240=240MHz (WiFi/BT)  
  64. esp32.menu.CPUFreq.240.build.f_cpu=240000000L  
  65. esp32.menu.CPUFreq.160=160MHz (WiFi/BT)  
  66. esp32.menu.CPUFreq.160.build.f_cpu=160000000L  
  67. esp32.menu.CPUFreq.80=80MHz (WiFi/BT)  
  68. esp32.menu.CPUFreq.80.build.f_cpu=80000000L  
  69. esp32.menu.CPUFreq.40=40MHz (40MHz XTAL)  
  70. esp32.menu.CPUFreq.40.build.f_cpu=40000000L  
  71. esp32.menu.CPUFreq.26=26MHz (26MHz XTAL)  
  72. esp32.menu.CPUFreq.26.build.f_cpu=26000000L  
  73. esp32.menu.CPUFreq.20=20MHz (40MHz XTAL)  
  74. esp32.menu.CPUFreq.20.build.f_cpu=20000000L  
  75. esp32.menu.CPUFreq.13=13MHz (26MHz XTAL)  
  76. esp32.menu.CPUFreq.13.build.f_cpu=13000000L  
  77. esp32.menu.CPUFreq.10=10MHz (40MHz XTAL)  
  78. esp32.menu.CPUFreq.10.build.f_cpu=10000000L  
  79.   
  80. esp32.menu.FlashMode.qio=QIO  
  81. esp32.menu.FlashMode.qio.build.flash_mode=dio  
  82. esp32.menu.FlashMode.qio.build.boot=qio  
  83. esp32.menu.FlashMode.dio=DIO  
  84. esp32.menu.FlashMode.dio.build.flash_mode=dio  
  85. esp32.menu.FlashMode.dio.build.boot=dio  
  86. esp32.menu.FlashMode.qout=QOUT  
  87. esp32.menu.FlashMode.qout.build.flash_mode=dout  
  88. esp32.menu.FlashMode.qout.build.boot=qout  
  89. esp32.menu.FlashMode.dout=DOUT  
  90. esp32.menu.FlashMode.dout.build.flash_mode=dout  
  91. esp32.menu.FlashMode.dout.build.boot=dout  
  92.   
  93. esp32.menu.FlashFreq.80=80MHz  
  94. esp32.menu.FlashFreq.80.build.flash_freq=80m  
  95. esp32.menu.FlashFreq.40=40MHz  
  96. esp32.menu.FlashFreq.40.build.flash_freq=40m  
  97.   
  98. esp32.menu.FlashSize.4M=4MB (32Mb)  
  99. esp32.menu.FlashSize.4M.build.flash_size=4MB  
  100. esp32.menu.FlashSize.8M=8MB (64Mb)  
  101. esp32.menu.FlashSize.8M.build.flash_size=8MB  
  102. esp32.menu.FlashSize.8M.build.partitions=default_8MB  
  103. esp32.menu.FlashSize.2M=2MB (16Mb)  
  104. esp32.menu.FlashSize.2M.build.flash_size=2MB  
  105. esp32.menu.FlashSize.2M.build.partitions=minimal  
  106. esp32.menu.FlashSize.16M=16MB (128Mb)  
  107. esp32.menu.FlashSize.16M.build.flash_size=16MB  
  108.   
  109. esp32.menu.UploadSpeed.921600=921600  
  110. esp32.menu.UploadSpeed.921600.upload.speed=921600  
  111. esp32.menu.UploadSpeed.115200=115200  
  112. esp32.menu.UploadSpeed.115200.upload.speed=115200  
  113. esp32.menu.UploadSpeed.256000.windows=256000  
  114. esp32.menu.UploadSpeed.256000.upload.speed=256000  
  115. esp32.menu.UploadSpeed.230400.windows.upload.speed=256000  
  116. esp32.menu.UploadSpeed.230400=230400  
  117. esp32.menu.UploadSpeed.230400.upload.speed=230400  
  118. esp32.menu.UploadSpeed.460800.linux=460800  
  119. esp32.menu.UploadSpeed.460800.macosx=460800  
  120. esp32.menu.UploadSpeed.460800.upload.speed=460800  
  121. esp32.menu.UploadSpeed.512000.windows=512000  
  122. esp32.menu.UploadSpeed.512000.upload.speed=512000  
  123.   
  124. esp32.menu.DebugLevel.none=None  
  125. esp32.menu.DebugLevel.none.build.code_debug=0  
  126. esp32.menu.DebugLevel.error=Error  
  127. esp32.menu.DebugLevel.error.build.code_debug=1  
  128. esp32.menu.DebugLevel.warn=Warn  
  129. esp32.menu.DebugLevel.warn.build.code_debug=2  
  130. esp32.menu.DebugLevel.info=Info  
  131. esp32.menu.DebugLevel.info.build.code_debug=3  
  132. esp32.menu.DebugLevel.debug=Debug  
  133. esp32.menu.DebugLevel.debug.build.code_debug=4  
  134. esp32.menu.DebugLevel.verbose=Verbose  
  135. esp32.menu.DebugLevel.verbose.build.code_debug=5  
  136.   
  137. ##############################################################  

這是 NodeMCU-32S  在 Boards.txt 的描述
沒有 Partition Scheme 的描述,只有在 Line 22,說明它使用 default.csv Partition Table


  1. ##############################################################  
  2.   
  3. nodemcu-32s.name=NodeMCU-32S  
  4.   
  5. nodemcu-32s.upload.tool=esptool_py  
  6. nodemcu-32s.upload.maximum_size=1310720  
  7. nodemcu-32s.upload.maximum_data_size=327680  
  8. nodemcu-32s.upload.wait_for_upload_port=true  
  9.   
  10. nodemcu-32s.serial.disableDTR=true  
  11. nodemcu-32s.serial.disableRTS=true  
  12.   
  13. nodemcu-32s.build.mcu=esp32  
  14. nodemcu-32s.build.core=esp32  
  15. nodemcunodemcu-32s.build.variant=nodemcu-32s  
  16. nodemcu-32s.build.board=NodeMCU_32S  
  17.   
  18. nodemcu-32s.build.f_cpu=240000000L  
  19. nodemcu-32s.build.flash_mode=dio  
  20. nodemcu-32s.build.flash_size=4MB  
  21. nodemcu-32s.build.boot=dio  
  22. nodemcu-32s.build.partitions=default  
  23. nodemcunodemcu-32s.build.defines=  
  24.   
  25. nodemcu-32s.menu.FlashFreq.80=80MHz  
  26. nodemcu-32s.menu.FlashFreq.80.build.flash_freq=80m  
  27. nodemcu-32s.menu.FlashFreq.40=40MHz  
  28. nodemcu-32s.menu.FlashFreq.40.build.flash_freq=40m  
  29.   
  30. nodemcu-32s.menu.UploadSpeed.921600=921600  
  31. nodemcu-32s.menu.UploadSpeed.921600.upload.speed=921600  
  32. nodemcu-32s.menu.UploadSpeed.115200=115200  
  33. nodemcu-32s.menu.UploadSpeed.115200.upload.speed=115200  
  34. nodemcu-32s.menu.UploadSpeed.256000.windows=256000  
  35. nodemcu-32s.menu.UploadSpeed.256000.upload.speed=256000  
  36. nodemcu-32s.menu.UploadSpeed.230400.windows.upload.speed=256000  
  37. nodemcu-32s.menu.UploadSpeed.230400=230400  
  38. nodemcu-32s.menu.UploadSpeed.230400.upload.speed=230400  
  39. nodemcu-32s.menu.UploadSpeed.460800.linux=460800  
  40. nodemcu-32s.menu.UploadSpeed.460800.macosx=460800  
  41. nodemcu-32s.menu.UploadSpeed.460800.upload.speed=460800  
  42. nodemcu-32s.menu.UploadSpeed.512000.windows=512000  
  43. nodemcu-32s.menu.UploadSpeed.512000.upload.speed=512000  
  44.   
  45. ############################################################## 


所以,從以上兩段描述,就可以得知為何 NodeMCU-32S 為何在Arduino IDE 選單部會沒有 Partition Scheme 可供你選擇了,而 ESP32 Dev Module 卻有 12 種 Partition Scheme 可供選擇。

暴力懶人改法就如下面截圖,從原有真實正確的 Board Type 轉換到 ESP32 Dev Module,
這樣簡單的一個步驟而已!

以我截圖為例,真實的 Board Type 為 NodeMCU-32S ,在Arduino IDE "Tools" 選單下,改選
ESP32 Dev Module ,這樣我就有 12 種 Partition Scheme 選擇了。


熱門文章