@@ -19,9 +19,9 @@ internal class Esp32Firmware : FirmwarePackage
1919 public const int CLRAddress = 0x10000 ;
2020
2121 /// <summary>
22- /// ESP32 nanoCLR is available for 2MB, 4MB, 8MB and 16MB flash sizes
22+ /// ESP32 nanoCLR is available for 2MB, 4MB, 8MB, 16MB, 32MB and 64MB flash sizes if supported.
2323 /// </summary>
24- private List < int > SupportedFlashSizes => [ 0x200000 , 0x400000 , 0x800000 , 0x1000000 ] ;
24+ private List < int > SupportedFlashSizes => [ 0x200000 , 0x400000 , 0x800000 , 0x1000000 , 0x2000000 , 0x4000000 ] ;
2525
2626 internal string BootloaderPath ;
2727
@@ -76,15 +76,26 @@ internal async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync(Es
7676 {
7777 BootloaderPath = "bootloader.bin" ;
7878
79+ // Boot loader goes to 0x1000, except for ESP32_C3/C6/H2/S3, which goes to 0x0
80+ // and ESP32_P4 where it goes at 0x2000
81+ int BootLoaderAddress = 0x1000 ;
82+ if ( deviceInfo . ChipType == "ESP32-C3"
83+ || deviceInfo . ChipType == "ESP32-C6"
84+ || deviceInfo . ChipType == "ESP32-H2"
85+ || deviceInfo . ChipType == "ESP32-S3" )
86+ {
87+ BootLoaderAddress = 0 ;
88+ }
89+ if ( deviceInfo . ChipType == "ESP32-P4" )
90+ {
91+ BootLoaderAddress = 0x2000 ;
92+ }
93+
7994 // get ESP32 partitions
8095 FlashPartitions = new Dictionary < int , string >
8196 {
82- // bootloader goes to 0x1000, except for ESP32_C3/C6/H2/S3, which goes to 0x0
83- {
84- deviceInfo . ChipType == "ESP32-C3"
85- || deviceInfo . ChipType == "ESP32-C6"
86- || deviceInfo . ChipType == "ESP32-H2"
87- || deviceInfo . ChipType == "ESP32-S3" ? 0x0 : 0x1000 , Path . Combine ( LocationPath , BootloaderPath ) } ,
97+ // BootLoader goes to an address depending on chip type
98+ { BootLoaderAddress , Path . Combine ( LocationPath , BootloaderPath ) } ,
8899
89100 // nanoCLR goes to 0x10000
90101 { CLRAddress , Path . Combine ( LocationPath , "nanoCLR.bin" ) } ,
0 commit comments