Skip to content

Commit b5f6620

Browse files
fdcavalcantiacassis
authored andcommitted
documentation: update MCUBoot documentation on ESP32-C3|C6
Adds documentation for flash allocation when MCUBoot is enabled on ESP32C3 and C6. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
1 parent 42254ff commit b5f6620

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed

Documentation/platforms/risc-v/esp32c3/index.rst

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,115 @@ to ``Application image secondary slot``.
600600
**After disabling UART Download Mode you will not be able to flash other images through UART.**
601601

602602

603+
Flash Allocation for MCUBoot
604+
----------------------------
605+
606+
When MCUBoot is enabled on ESP32-C3, the flash memory is organized as follows
607+
based on the default KConfig values:
608+
609+
**Flash Layout (MCUBoot Enabled)**
610+
611+
.. list-table::
612+
:header-rows: 1
613+
:widths: 40 20 20
614+
:align: left
615+
616+
* - Region
617+
- Offset
618+
- Size
619+
* - Bootloader
620+
- 0x000000
621+
- 64KB
622+
* - E-Fuse Virtual (see Note)
623+
- 0x010000
624+
- 64KB
625+
* - Primary Application Slot (/dev/ota0)
626+
- 0x020000
627+
- 1MB
628+
* - Secondary Application Slot (/dev/ota1)
629+
- 0x120000
630+
- 1MB
631+
* - Scratch Partition (/dev/otascratch)
632+
- 0x220000
633+
- 256KB
634+
* - Storage MTD (optional)
635+
- 0x260000
636+
- 1MB
637+
* - Available Flash
638+
- 0x360000+
639+
- Remaining
640+
641+
.. raw:: html
642+
643+
<div style="clear: both"></div>
644+
645+
646+
**Note**: The E-Fuse Virtual region is optional and only used when
647+
``ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH`` is enabled. However, this 64KB
648+
location is always allocated in the memory layout to prevent accidental
649+
erasure during board flashing operations, ensuring data preservation if
650+
virtual E-Fuses are later enabled.
651+
652+
.. code-block:: text
653+
654+
Memory Map (Addresses in hex):
655+
656+
0x000000 ┌─────────────────────────────┐
657+
│ │
658+
│ MCUBoot Bootloader │
659+
│ (64KB) │
660+
│ │
661+
0x010000 ├─────────────────────────────┤
662+
│ E-Fuse Virtual │
663+
│ (64KB) │
664+
0x020000 ├─────────────────────────────┤
665+
│ │
666+
│ Primary App Slot │
667+
│ (1MB) │
668+
│ /dev/ota0 │
669+
│ │
670+
0x120000 ├─────────────────────────────┤
671+
│ │
672+
│ Secondary App Slot │
673+
│ (1MB) │
674+
│ /dev/ota1 │
675+
│ │
676+
0x220000 ├─────────────────────────────┤
677+
│ │
678+
│ Scratch Partition │
679+
│ (256KB) │
680+
│ /dev/otascratch │
681+
│ │
682+
0x260000 ├─────────────────────────────┤
683+
│ │
684+
│ Storage MTD (optional) │
685+
│ (1MB) │
686+
│ │
687+
0x360000 ├─────────────────────────────┤
688+
│ │
689+
│ Available Flash │
690+
│ (Remaining) │
691+
│ │
692+
└─────────────────────────────┘
693+
694+
The key KConfig options that control this layout:
695+
696+
- ``ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET`` (default: 0x20000)
697+
- ``ESPRESSIF_OTA_SECONDARY_SLOT_OFFSET`` (default: 0x120000)
698+
- ``ESPRESSIF_OTA_SLOT_SIZE`` (default: 0x100000)
699+
- ``ESPRESSIF_OTA_SCRATCH_OFFSET`` (default: 0x220000)
700+
- ``ESPRESSIF_OTA_SCRATCH_SIZE`` (default: 0x40000)
701+
- ``ESPRESSIF_STORAGE_MTD_OFFSET`` (default: 0x260000 when MCUBoot enabled)
702+
- ``ESPRESSIF_STORAGE_MTD_SIZE`` (default: 0x100000)
703+
704+
For MCUBoot operation:
705+
706+
- The **Primary Slot** contains the currently running application
707+
- The **Secondary Slot** receives OTA updates
708+
- The **Scratch Partition** is used by MCUBoot for image swapping during updates
709+
- MCUBoot manages image validation, confirmation, and rollback functionality
710+
711+
603712
_`Managing esptool on virtual environment`
604713
==========================================
605714

Documentation/platforms/risc-v/esp32c6/index.rst

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,114 @@ Finally, the image is loaded but not confirmed.
486486
To make sure it won't rollback to the previous image, you must confirm with ``mcuboot_confirm`` and reboot the board.
487487
The OTA is now complete.
488488

489+
Flash Allocation for MCUBoot
490+
----------------------------
491+
492+
When MCUBoot is enabled on ESP32-C6, the flash memory is organized as follows
493+
based on the default KConfig values:
494+
495+
**Flash Layout (MCUBoot Enabled)**
496+
497+
.. list-table::
498+
:header-rows: 1
499+
:widths: 40 20 20
500+
:align: left
501+
502+
* - Region
503+
- Offset
504+
- Size
505+
* - Bootloader
506+
- 0x000000
507+
- 64KB
508+
* - E-Fuse Virtual (see Note)
509+
- 0x010000
510+
- 64KB
511+
* - Primary Application Slot (/dev/ota0)
512+
- 0x020000
513+
- 1MB
514+
* - Secondary Application Slot (/dev/ota1)
515+
- 0x120000
516+
- 1MB
517+
* - Scratch Partition (/dev/otascratch)
518+
- 0x220000
519+
- 256KB
520+
* - Storage MTD (optional)
521+
- 0x260000
522+
- 1MB
523+
* - Available Flash
524+
- 0x360000+
525+
- Remaining
526+
527+
.. raw:: html
528+
529+
<div style="clear: both"></div>
530+
531+
532+
**Note**: The E-Fuse Virtual region is optional and only used when
533+
``ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH`` is enabled. However, this 64KB
534+
location is always allocated in the memory layout to prevent accidental
535+
erasure during board flashing operations, ensuring data preservation if
536+
virtual E-Fuses are later enabled.
537+
538+
.. code-block:: text
539+
540+
Memory Map (Addresses in hex):
541+
542+
0x000000 ┌─────────────────────────────┐
543+
│ │
544+
│ MCUBoot Bootloader │
545+
│ (64KB) │
546+
│ │
547+
0x010000 ├─────────────────────────────┤
548+
│ E-Fuse Virtual │
549+
│ (64KB) │
550+
0x020000 ├─────────────────────────────┤
551+
│ │
552+
│ Primary App Slot │
553+
│ (1MB) │
554+
│ /dev/ota0 │
555+
│ │
556+
0x120000 ├─────────────────────────────┤
557+
│ │
558+
│ Secondary App Slot │
559+
│ (1MB) │
560+
│ /dev/ota1 │
561+
│ │
562+
0x220000 ├─────────────────────────────┤
563+
│ │
564+
│ Scratch Partition │
565+
│ (256KB) │
566+
│ /dev/otascratch │
567+
│ │
568+
0x260000 ├─────────────────────────────┤
569+
│ │
570+
│ Storage MTD (optional) │
571+
│ (1MB) │
572+
│ │
573+
0x360000 ├─────────────────────────────┤
574+
│ │
575+
│ Available Flash │
576+
│ (Remaining) │
577+
│ │
578+
└─────────────────────────────┘
579+
580+
The key KConfig options that control this layout:
581+
582+
- ``ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET`` (default: 0x20000)
583+
- ``ESPRESSIF_OTA_SECONDARY_SLOT_OFFSET`` (default: 0x120000)
584+
- ``ESPRESSIF_OTA_SLOT_SIZE`` (default: 0x100000)
585+
- ``ESPRESSIF_OTA_SCRATCH_OFFSET`` (default: 0x220000)
586+
- ``ESPRESSIF_OTA_SCRATCH_SIZE`` (default: 0x40000)
587+
- ``ESPRESSIF_STORAGE_MTD_OFFSET`` (default: 0x260000 when MCUBoot enabled)
588+
- ``ESPRESSIF_STORAGE_MTD_SIZE`` (default: 0x100000)
589+
590+
For MCUBoot operation:
591+
592+
- The **Primary Slot** contains the currently running application
593+
- The **Secondary Slot** receives OTA updates
594+
- The **Scratch Partition** is used by MCUBoot for image swapping during updates
595+
- MCUBoot manages image validation, confirmation, and rollback functionality
596+
489597
_`Managing esptool on virtual environment`
490598
==========================================
491599

0 commit comments

Comments
 (0)