Skip to content

Commit 1fa012d

Browse files
greg-ferrlubos
authored andcommitted
doc: bootloader_partitioning: add info about VSC
Edited the structure of bootloader_partitioning page to mention memory reports of the VSC extension alongside partition_manager_report. Fixed some formatting and structure issues and typos. VSC-2712. Signed-off-by: Grzegorz Ferenc <[email protected]> (cherry picked from commit a3a1f46)
1 parent 8e20051 commit 1fa012d

File tree

3 files changed

+57
-18
lines changed

3 files changed

+57
-18
lines changed

doc/nrf/app_dev/bootloaders_dfu/mcuboot_nsib/bootloader_partitioning.rst

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,48 @@ Partitioning device memory is a crucial aspect of managing how a device's storag
1111
By default, the Partition Manager in the system dynamically generates a partition map, which is suitable for most applications that do not use Device Firmware Upgrades (DFU).
1212
For scenarios involving DFU, read the following sections.
1313

14+
.. _bootloader_partitioning_partitions_file:
15+
16+
Partition map file
17+
******************
18+
19+
After you enable the Partition Manager, it will :ref:`start generating <pm_build_system>` the :file:`partitions.yml` file in the build folder directory.
20+
In this file, you will see detailed information about the memory layout used for the build.
21+
22+
The :file:`partitions.yml` file is present also if the Partition Manager generates the partition map dynamically.
23+
You can use this file as a base for your static partition map.
24+
25+
.. _bootloader_partitioning_partitions_file_report:
26+
27+
Partition reports
28+
=================
29+
30+
After building the application, you can print a report of how the partitioning has been handled for a bootloader, or combination of bootloaders, by using partition memory reports.
31+
32+
Depending on your development environment, you can use one of the following options:
33+
34+
.. tabs::
35+
36+
.. group-tab:: nRF Connect for VS Code
37+
38+
Use the extension's `Memory report`_ feature, which shows the size and percentage of memory that each symbol uses on your device for RAM, ROM, and partitions.
39+
Click the :guilabel:`Memory report` button in the :guilabel:`Actions View` to generate the report.
40+
The partition map is available in the :guilabel:`Partitions` tab.
41+
42+
Alternatively, you can also use the `Memory Explorer <How to work with the Memory Explorer_>`_ feature of the extension's nRF Debug to check memory sections for the partitions.
43+
This feature requires `enabling debugging in the build configuration <How to debug_>`_ and providing the partition addresses manually.
44+
45+
.. group-tab:: Command line
46+
47+
Use the Partition Manager's :ref:`pm_partition_reports` feature.
48+
Run the following command:
49+
50+
.. code-block:: console
51+
52+
west build -t partition_manager_report
53+
54+
This command generates an output in ASCII with the addresses and sizes of each partition.
55+
1456
.. _ug_bootloader_flash_static_requirement:
1557

1658
Static partition requirement for DFU
@@ -22,13 +64,6 @@ This is important also when you use a precompiled HEX file as a child image (sub
2264
In such cases, the newly generated application images may no longer use a partition map that is compatible with the partition map used by the bootloader.
2365
As a result, the newly built application image may not be bootable by the bootloader.
2466

25-
.. note::
26-
For detailed information about the memory layout used for the build, see the partition configuration in the :file:`partitions.yml` file, located in the build folder directory, or run ``ninja partition_manager_report``.
27-
You must enable the Partition Manager to make the :file:`partitions.yml` file and the ``partition_manager_report`` target available.
28-
29-
The :file:`partitions.yml` file is present also if the Partition Manager generates the partition map dynamically.
30-
You can use this file as a base for your static partition map.
31-
3267
The memory partitions that must be defined in the static partition map depend on the selected bootloader chain.
3368
For details, see :ref:`ug_bootloader_flash`.
3469

@@ -39,7 +74,7 @@ Flash memory partitions
3974

4075
Each bootloader handles flash memory partitioning differently.
4176

42-
After building the application, you can print a report of how the flash partitioning has been handled for a bootloader, or combination of bootloaders, by using :ref:`pm_partition_reports`.
77+
After building the application, you can print a report of how the flash partitioning has been handled for a bootloader, or combination of bootloaders, by using :ref:`bootloader_partitioning_partitions_file_report`.
4378

4479
.. _ug_bootloader_flash_b0:
4580

@@ -64,7 +99,7 @@ This is particularly useful in memory-constrained devices to avoid providing spa
6499
See the *Image Slots* section in the :doc:`MCUboot documentation <mcuboot:design>` for more information.
65100

66101
The |NCS| variant of MCUboot uses the :ref:`partition_manager` to configure the flash memory partitions for these image slots.
67-
In the default configuration, defined in :file:`bootloader/mcuboot/boot/zephyr/pm.yml`, the partition manager dynamically sets up the partitions as required for MCUboot.
102+
In the default configuration, defined in :file:`bootloader/mcuboot/boot/zephyr/pm.yml`, the Partition Manager dynamically sets up the partitions as required for MCUboot.
68103
For example, the partition layout for :file:`zephyr/samples/hello_world` using MCUboot on the ``nrf52840dk`` board would look like the following:
69104

70105
.. code-block:: console
@@ -82,16 +117,11 @@ For example, the partition layout for :file:`zephyr/samples/hello_world` using M
82117
You can also store secondary slot images in external flash memory when using MCUboot.
83118
See :ref:`ug_bootloader_external_flash` for more information.
84119

85-
86120
.. _ug_bootloader_external_flash:
87121

88122
Using external flash memory partitions
89123
**************************************
90124

91-
.. contents::
92-
:local:
93-
:depth: 2
94-
95125
When using MCUboot, you can store the storage partition for the secondary slot in the external flash memory, using a driver for the external flash memory that supports the following features:
96126

97127
* Single-byte read and write.
@@ -112,7 +142,7 @@ To enable external flash with MCUboot, complete the following steps:
112142

113143
.. note::
114144

115-
The :ref:`partition_manager` will only support run-time access to flash partitions defined in regions placed on external flash devices that have drivers compiled in.
145+
The Partition Manager will only support run-time access to flash partitions defined in regions placed on external flash devices that have drivers compiled in.
116146
The Partition Manager cannot determine which partitions will be used at runtime, but only those that have drivers enabled, and those are included into the partition map.
117147
Lack of partition access will cause MCUboot to fail at runtime.
118148
For more details on configuring and enabling access to external flash devices, see :ref:`pm_external_flash`.
@@ -126,6 +156,11 @@ See also :ref:`ug_multi_image_variables` for more details on how to pass configu
126156
Troubleshooting
127157
***************
128158

159+
This section describes some of the issues you might come across when partitioning device memory.
160+
161+
MCUboot failure
162+
===============
163+
129164
MCUboot could fail, reporting the following error:
130165

131166
.. code-block:: console
@@ -139,7 +174,7 @@ MCUboot could fail, reporting the following error:
139174
140175
This error could be caused by the following issues:
141176

142-
* The external flash driver for the application image partitions used by MCUboot is not enabled or an incorrect Kconfig option has been given to the ``DEFAULT_DRIVER_KCONFIG`` of the partition manager external region definition.
177+
* The external flash driver for the application image partitions used by MCUboot is not enabled or an incorrect Kconfig option has been given to the ``DEFAULT_DRIVER_KCONFIG`` of the Partition Manager external region definition.
143178
See :ref:`pm_external_flash` for details.
144179

145180
* An out-of-tree external flash driver is not selecting :kconfig:option:`CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER`, resulting in partitions for images located in the external flash memory being not accessible.
@@ -148,6 +183,9 @@ This error could be caused by the following issues:
148183
* Insufficient value set for the ``CONFIG_BOOT_MAX_IMG_SECTORS`` Kconfig option, as MCUboot typically increases slot sizes when external flash is enabled.
149184
See `MCUboot's Kconfig options used in Zephyr <https://github.com/nrfconnect/sdk-mcuboot/blob/main/boot/zephyr/Kconfig#L370>`_ for details.
150185

186+
Compilation failure
187+
===================
188+
151189
The compilation could fail, reporting a linker error similar to following:
152190

153191
.. code-block:: console

doc/nrf/links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@
873873
.. _`Debugging overview`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/debug_concepts.html
874874
.. _`How to debug`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/debug_use.html
875875
.. _`How to debug applications for a multi-core System on Chip`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/debug_use.html#how-to-debug-applications-for-a-multi-core-system-on-chip
876+
.. _`How to work with the Memory Explorer`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/debug_mem_explorer.html
876877
.. _`source control with west`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/west_about.html
877878
.. _`west module management`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/west_module_management.html
878879
.. _`Custom launch and debug configurations`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/debug_custom.html

scripts/partition_manager/partition_manager.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ After the ``nordic,pm-ext-flash`` value is set, you can place partitions in the
565565

566566
See :ref:`ug_bootloader_external_flash` for more details on using external flash memory with MCUboot.
567567

568-
.. _pm_build_system:
569-
570568
A partition can be accessible at runtime only if the flash device where it resides has its driver enabled at compile time.
571569
Partition manager ignores partitions that are located in a region without its driver enabled.
572570
To let partition manager know which Kconfig option ensures the existence of the driver, the option ``DEFAULT_DRIVER_KCONFIG`` is used.
@@ -592,6 +590,8 @@ As partition manager does not know if partitions are used at runtime, consider t
592590
When using an application configured with an MCUboot child image, both images use the same partition manager configuration, which means that the app and MCUboot have exactly the same partition maps.
593591
The accessibility at runtime of flash partitions depends on the configurations of both the application and MCUboot and the values they give to the ``DEFAULT_DRIVER_KCONFIG`` option of the partition manager region specification.
594592

593+
.. _pm_build_system:
594+
595595
Build system
596596
************
597597

0 commit comments

Comments
 (0)