Forum Controllers/PLC

Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Reduce SPIFFS partition size in PLC ESP32

Avatar
Eduard

Hi, I've got a PLC ESP32 21.


For my application I'll soon need more than 1.3MB of program space. Theoretically it should be possible to reduce the SPIFFS partition size (which I won't need) to have more program space. See the video "#222 More Memory for the ESP32 without Soldering (How-to adapt partition sizes)" by Andreas Spiess on Youtube for more info.


On barebones ESP32, the Arduino IDE offers a submenu in Tools with different partitioning options (see minute 3:58 in the video). However, when the PLC ESP32 is selected this option is not available. Is there an alternative way to do it?


Even if the submenu is not available, I can see that Industrial Shields does have some partition tables prepared in:  \Users\Eduard\AppData\Local\Arduino15\packages\industrialshields\hardware\esp32\2.2.4\tools\partitions

In my case I would likely need the huge_app.csv.


Thanks for any help.

Avatar
Discard
1 Answer
1
Best Answer

Hello Eduard,

It seems right now the boards package does not specify the menu option to change the partitions. Since it is a useful option, I modified the boards.txt file so the option appears on the IDE, and will be looking to include it in the next release. 

Meanwhile, you can apply the changes manually by editing the boards.txt file. You can find it on:

  • Linux: ~/.arduino15/packages/industrialshields/hardware/esp32/2.2.4/boards.txt
  • Windows: C:\Users\{username}\AppData\Local\Arduino15\packages\industrialshields\hardware\esp32\2.2.4\boards.txt

Since I cannot post files here, I am pasting its content. Replace the default boards.txt with this:

menu.cpu=Model
menu.version=Version
menu.PartitionScheme=PartitionScheme
menu.module1=Extension module 1
menu.module2=Extension module 2

############################################
###### 14iosplc ############################
############################################

plc14ios.name=14 IOS PLC Family
plc14ios.build.tarch=xtensa
plc14ios.build.bootloader_addr=0x1000
plc14ios.build.target=esp32
plc14ios.build.mcu=esp32
plc14ios.build.core=industrialshields
plc14ios.build.board=ESP32_DEV
plc14ios.build.f_cpu=240000000L
plc14ios.build.flash_size=4MB
plc14ios.build.flash_freq=80m
plc14ios.build.flash_mode=dio
plc14ios.build.boot=dio
plc14ios.build.partitions=default
plc14ios.build.defines=
plc14ios.build.loop_core=
plc14ios.build.event_core=
plc14ios.build.defines=
plc14ios.build.code_debug=0
plc14ios.build.variant=14iosplc
plc14ios.upload.tool=esptool_py
plc14ios.upload.tool.default=esptool_py
plc14ios.upload.maximum_size=1310720
plc14ios.upload.maximum_data_size=327680
plc14ios.upload.wait_for_upload_port=true
plc14ios.upload.speed=921600
plc14ios.upload.flags=
plc14ios.upload.extra_flags=
plc14ios.serial.disableDTR=true
plc14ios.serial.disableRTS=true
plc14ios.upload.erase_cmd=

plc14ios.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
plc14ios.menu.PartitionScheme.default.build.partitions=default
plc14ios.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
plc14ios.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
plc14ios.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
plc14ios.menu.PartitionScheme.minimal.build.partitions=minimal
plc14ios.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
plc14ios.menu.PartitionScheme.no_ota.build.partitions=no_ota
plc14ios.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
plc14ios.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
plc14ios.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
plc14ios.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
plc14ios.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
plc14ios.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
plc14ios.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
plc14ios.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
plc14ios.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
plc14ios.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
plc14ios.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
plc14ios.menu.PartitionScheme.huge_app.build.partitions=huge_app
plc14ios.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
plc14ios.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
plc14ios.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
plc14ios.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
plc14ios.menu.PartitionScheme.custom=Custom
plc14ios.menu.PartitionScheme.custom.build.partitions=
plc14ios.menu.PartitionScheme.custom.upload.maximum_size=16777216


######### 14 IOS PLC VERSION ##################
plc14ios.menu.version.v1=v1
plc14ios.menu.version.v1.build.version_flags=-DPLC14IOS_V1

plc14ios.menu.version.v4=v4
plc14ios.menu.version.v4.build.version_flags=-DPLC14IOS_V4


######### 14 IOS PLC MA #######################

plc14ios.menu.cpu.plc14ios=ESP32 PLC 14 (4-20 mA)
plc14ios.menu.cpu.plc14ios.build.extra_flags=-DPLC14IOS -DPLC14IOS_MA

######### 14 IOS PLC V #####################

plc14ios.menu.cpu.plc14iosv=ESP32 PLC 14 (0-10 V)
plc14ios.menu.cpu.plc14iosv.build.extra_flags=-DPLC14IOS -DPLC14IOS_V

######### 14 IOS PLC Smartlight #####################

plc14ios.menu.cpu.plc14ios-smart=ESP32 PLC 14 Smart Light
plc14ios.menu.cpu.plc14ios-smart.build.extra_flags=-DPLC14IOS -DPLC14IOS_SMARTLIGHT

###### EXTENSION MODULE
plc14ios.menu.module1.none=None

plc14ios.menu.module1.nb=NB
plc14ios.menu.module1.nb.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_NB

plc14ios.menu.module1.lte=LTE
plc14ios.menu.module1.lte.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_LTE

plc14ios.menu.module1.dali=DALI
plc14ios.menu.module1.dali.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_DALI

plc14ios.menu.module1.lora-europa=LoRa (EU)
plc14ios.menu.module1.lora-europa.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_LORA_EUROPA

plc14ios.menu.module1.lora-america=LoRa (America)
plc14ios.menu.module1.lora-america.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_LORA_AMERICA

plc14ios.menu.module1.lora-asia=LoRa (Asia)
plc14ios.menu.module1.lora-asia.build.module1_flags=-DEXPANSION_MODULE -DEXPANSION_MODULE_LORA_ASIA

############################################
###### 10iosplc ############################
############################################

plc10ios.name=10 IOS PLC Family
plc10ios.build.tarch=xtensa
plc10ios.build.bootloader_addr=0x1000
plc10ios.build.target=esp32
plc10ios.build.mcu=esp32
plc10ios.build.core=industrialshields
plc10ios.build.board=ESP32_DEV
plc10ios.build.f_cpu=240000000L
plc10ios.build.flash_size=4MB
plc10ios.build.flash_freq=80m
plc10ios.build.flash_mode=dio
plc10ios.build.boot=dio
plc10ios.build.partitions=default
plc10ios.build.defines=
plc10ios.build.loop_core=
plc10ios.build.event_core=
plc10ios.build.defines=
plc10ios.build.code_debug=0
plc10ios.build.variant=10iosplc
plc10ios.upload.tool=esptool_py
plc10ios.upload.tool.default=esptool_py
plc10ios.upload.maximum_size=1310720
plc10ios.upload.maximum_data_size=327680
plc10ios.upload.wait_for_upload_port=true
plc10ios.upload.speed=921600
plc10ios.upload.flags=
plc10ios.upload.extra_flags=
plc10ios.serial.disableDTR=true
plc10ios.serial.disableRTS=true
plc10ios.upload.erase_cmd=

######### 10 IOS PLC DIGITAL #######################

plc10ios.menu.cpu.plc10ios=10 IOS PLC Digital
plc10ios.menu.cpu.plc10ios.build.extra_flags=-DPLC10IOS -DPLC10IOS_DIGITAL

######### 10 IOS PLC RELAY #####################

plc10ios.menu.cpu.plc10iosr=10 IOS PLC Relay
plc10ios.menu.cpu.plc10iosr.build.extra_flags=-DPLC10IOS -DPLC10IOS_RELAY

############################################
###### ESP32 PLC ###########################
############################################

esp32plc.name=ESP32 PLC Family
esp32plc.build.tarch=xtensa
esp32plc.build.bootloader_addr=0x1000
esp32plc.build.target=esp32
esp32plc.build.mcu=esp32
esp32plc.build.core=industrialshields
esp32plc.build.board=ESP32_DEV
esp32plc.build.f_cpu=240000000L
esp32plc.build.flash_size=4MB
esp32plc.build.flash_freq=40m
esp32plc.build.flash_mode=dio
esp32plc.build.boot=dio
esp32plc.build.partitions=default
esp32plc.build.defines=
esp32plc.build.loop_core=
esp32plc.build.event_core=
esp32plc.build.defines=
esp32plc.build.code_debug=0
esp32plc.build.variant=esp32plc
esp32plc.upload.tool=esptool_py
esp32plc.upload.tool.default=esptool_py
esp32plc.upload.maximum_size=1310720
esp32plc.upload.maximum_data_size=327680
esp32plc.upload.wait_for_upload_port=true
esp32plc.upload.speed=921600
esp32plc.upload.flags=
esp32plc.upload.extra_flags=
esp32plc.serial.disableDTR=true
esp32plc.serial.disableRTS=true
esp32plc.upload.erase_cmd=

esp32plc.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
esp32plc.menu.PartitionScheme.default.build.partitions=default
esp32plc.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
esp32plc.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
esp32plc.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
esp32plc.menu.PartitionScheme.minimal.build.partitions=minimal
esp32plc.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
esp32plc.menu.PartitionScheme.no_ota.build.partitions=no_ota
esp32plc.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
esp32plc.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
esp32plc.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
esp32plc.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
esp32plc.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
esp32plc.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
esp32plc.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
esp32plc.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
esp32plc.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
esp32plc.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
esp32plc.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
esp32plc.menu.PartitionScheme.huge_app.build.partitions=huge_app
esp32plc.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
esp32plc.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
esp32plc.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
esp32plc.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
esp32plc.menu.PartitionScheme.custom=Custom
esp32plc.menu.PartitionScheme.custom.build.partitions=
esp32plc.menu.PartitionScheme.custom.upload.maximum_size=16777216

######### ESP32 PLC CPU #######################

esp32plc.menu.cpu.esp32plc=ESP32 PLC
esp32plc.menu.cpu.esp32plc.build.extra_flags=-DESP32PLC -DESP32PLC_CPU

######### ESP32 PLC 19R+ #######################

esp32plc.menu.cpu.esp32plc19r=ESP32 PLC 19R IO+
esp32plc.menu.cpu.esp32plc19r.build.extra_flags=-DESP32PLC -DESP32PLC_19R

######### ESP32 PLC 21R+ #######################

esp32plc.menu.cpu.esp32plc21=ESP32 PLC 21 IO+
esp32plc.menu.cpu.esp32plc21.build.extra_flags=-DESP32PLC -DESP32PLC_21

######### ESP32 PLC 38AR+ #######################

esp32plc.menu.cpu.esp32plc38ar=ESP32 PLC 38AR IO+
esp32plc.menu.cpu.esp32plc38ar.build.extra_flags=-DESP32PLC -DESP32PLC_38AR

######### ESP32 PLC 38R+ #######################

esp32plc.menu.cpu.esp32plc38r=ESP32 PLC 38R IO+
esp32plc.menu.cpu.esp32plc38r.build.extra_flags=-DESP32PLC -DESP32PLC_38R

######### ESP32 PLC 42+ #######################

esp32plc.menu.cpu.esp32plc42=ESP32 PLC 42 IO+
esp32plc.menu.cpu.esp32plc42.build.extra_flags=-DESP32PLC -DESP32PLC_42

######### ESP32 PLC 50RRA+ #######################

esp32plc.menu.cpu.esp32plc50rra=ESP32 PLC 50RRA IO+
esp32plc.menu.cpu.esp32plc50rra.build.extra_flags=-DESP32PLC -DESP32PLC_50RRA

######### ESP32 PLC 53ARR+ #######################

esp32plc.menu.cpu.esp32plc53arr=ESP32 PLC 53ARR IO+
esp32plc.menu.cpu.esp32plc53arr.build.extra_flags=-DESP32PLC -DESP32PLC_53ARR

######### ESP32 PLC 54ARA+ #######################

esp32plc.menu.cpu.esp32plc54ara=ESP32 PLC 54ARA IO+
esp32plc.menu.cpu.esp32plc54ara.build.extra_flags=-DESP32PLC -DESP32PLC_54ARA

######### ESP32 PLC 57AAR+ #######################

esp32plc.menu.cpu.esp32plc57aar=ESP32 PLC 57AAR IO+
esp32plc.menu.cpu.esp32plc57aar.build.extra_flags=-DESP32PLC -DESP32PLC_57AAR

######### ESP32 PLC 57R+ #######################

esp32plc.menu.cpu.esp32plc57r=ESP32 PLC 57R IO+
esp32plc.menu.cpu.esp32plc57r.build.extra_flags=-DESP32PLC -DESP32PLC_57R

######### ESP32 PLC 58+ #######################

esp32plc.menu.cpu.esp32plc58=ESP32 PLC 58 IO+
esp32plc.menu.cpu.esp32plc58.build.extra_flags=-DESP32PLC -DESP32PLC_58

###### BOARD VERSION
esp32plc.menu.version.v3=v3
esp32plc.menu.version.v3.build.version_flags=-DESP32PLC_V3

esp32plc.menu.version.v1=v1 (Legacy)
esp32plc.menu.version.v1.build.version_flags=-DESP32PLC_V1

###### EXTENSION MODULE 1
esp32plc.menu.module1.none=None

esp32plc.menu.module1.gprs=GPRS
esp32plc.menu.module1.gprs.build.module1_flags=-DEXPANSION_MODULE1_GPRS

esp32plc.menu.module1.nb=NB
esp32plc.menu.module1.nb.build.module1_flags=-DEXPANSION_MODULE1_NB

esp32plc.menu.module1.lte=LTE
esp32plc.menu.module1.lte.build.module1_flags=-DEXPANSION_MODULE1_LTE

###### EXTENSION MODULE 2
esp32plc.menu.module2.none=None

esp32plc.menu.module2.gprs=GPRS
esp32plc.menu.module2.gprs.build.module2_flags=-DEXPANSION_MODULE2_GPRS

esp32plc.menu.module2.nb=NB
esp32plc.menu.module2.nb.build.module2_flags=-DEXPANSION_MODULE2_NB

esp32plc.menu.module2.lte=LTE
esp32plc.menu.module2.lte.build.module2_flags=-DEXPANSION_MODULE2_LTE

############################################
###### Wifi Module #########################
############################################

wifimodule.name=WiFi module
wifimodule.build.tarch=xtensa
wifimodule.build.bootloader_addr=0x1000
wifimodule.build.target=esp32
wifimodule.build.mcu=esp32
wifimodule.build.core=industrialshields
wifimodule.build.board=ESP32_DEV
wifimodule.build.f_cpu=240000000L
wifimodule.build.flash_size=4MB
wifimodule.build.flash_freq=80m
wifimodule.build.flash_mode=dio
wifimodule.build.boot=dio
wifimodule.build.partitions=default
wifimodule.build.defines=
wifimodule.build.loop_core=
wifimodule.build.event_core=
wifimodule.build.defines=
wifimodule.build.code_debug=0
wifimodule.build.variant=wifimodule
wifimodule.build.extra_flags=-DWIFI_MODULE
wifimodule.upload.tool=esptool_py
wifimodule.upload.tool.default=esptool_py
wifimodule.upload.maximum_size=1310720
wifimodule.upload.maximum_data_size=327680
wifimodule.upload.wait_for_upload_port=true
wifimodule.upload.speed=921600
wifimodule.upload.flags=
wifimodule.upload.extra_flags=
wifimodule.serial.disableDTR=true
wifimodule.serial.disableRTS=true
wifimodule.upload.erase_cmd=

wifimodule.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
wifimodule.menu.PartitionScheme.default.build.partitions=default
wifimodule.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
wifimodule.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
wifimodule.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
wifimodule.menu.PartitionScheme.minimal.build.partitions=minimal
wifimodule.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
wifimodule.menu.PartitionScheme.no_ota.build.partitions=no_ota
wifimodule.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
wifimodule.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
wifimodule.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
wifimodule.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
wifimodule.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
wifimodule.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
wifimodule.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
wifimodule.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
wifimodule.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
wifimodule.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
wifimodule.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
wifimodule.menu.PartitionScheme.huge_app.build.partitions=huge_app
wifimodule.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
wifimodule.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
wifimodule.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
wifimodule.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
wifimodule.menu.PartitionScheme.custom=Custom
wifimodule.menu.PartitionScheme.custom.build.partitions=
wifimodule.menu.PartitionScheme.custom.upload.maximum_size=16777216

After making the change and restarting the IDE, you should now have a partitions option available.

Let us know what results you get.




3 Comments
Avatar
Discard
Avatar
Eduard
-

Many thanks. I've done as you said and restarted the IDE, but the following line:

esp32plc.menu.PartitionScheme.minimal.build.partitions=minimal

...causes this error on compilation:

Invalid FQBN: getting build properties for board industrialshields:esp32:esp32plc: invalid value 'minimal' for option 'PartitionScheme'

If I delete that line, I can compile successfully. I don't know which partition scheme it uses but it reports that the program storage space is 2097152 bytes.

Moreover, when I choose the board "ESP32 PLC Family", the Partitions menu entry still doesn't appear.

Just in case, I've already checked that the minimal.csv is where it should be (I haven't made any changes in the [...]/industrialshields\hardware\esp32\2.2.4\tools\partitions folder.

Maybe we're not using the same Arduino IDE version? Mine is 2.3.3.

Sorry, there were some missing lines. I have edited the message with all the options. Try it again and see if it works.

Strangely enough, I did not get the error on my IDE, maybe because I am on the 1.8.19.

Avatar
Eduard
-

I confirm that it works correctly on Arduino IDE 1.8.19. Thank you!

Also, I completely missed that you already had this guide that probably would have solved my problem:

https://www.industrialshields.com/es_ES/blog/blog-industrial-open-source-1/como-hacer-un-esquema-de-particion-en-un-plc-industrial-esp32-283