Commit Graph

169 Commits

Author SHA1 Message Date
Sudeep Mohanty
236498b040 feat(partition_table): Allow configuration of absolute path for custom partitions.csv file
This commit allows the configuration of an absolute path for the custom
partitions.csv file via the Kconfig option CONFIG_PARTITION_TABLE_CUSTOM_FILENAME.

Closes https://github.com/espressif/esp-idf/issues/12264
2024-01-11 08:37:02 +01:00
Harshit Malpani
bbbede07d0
fix(partition_table): Check partition size for type APP
The size of partition of type APP should be multiple of 4 KB. Partition
generation tool now make this as a mandatory requirement. This is
minimum flash erase size. If the size of the APP type partition is not
aligned to 4 KB then the last erase operation could go beyond the allocated
partition and hence may fail. This issue would only be observed when the
firmware size grows very close to the allocated partition size, and hence
causing the OTA update to fail.

For already deployed devices on-field with the size of APP partition not
aligned to flash sector boundary, it is best to ensure that firmware
size always remains within the lower 4 KB boundary of the total
allocated space. While migrating to ESP-IDF 5.3 release, partition table
for an existing project can be adjusted accordingly for the build to
succeed.

Found during discussion in https://github.com/espressif/esp-idf/pull/12460
2023-12-11 10:14:57 +05:30
Adam Múdry
ab1eb37fe8 feat(partition_table): Add read-only partition flag and functionality 2023-10-11 00:01:05 +02:00
sonika.rathi
c9b2b03d3d feat(example/storage/littlefs): add LittleFS demo example 2023-07-21 11:08:01 +02:00
Laukik Hase
8efe2f86e9
nvs_flash: Added helper component nvs_sec_provider
- For processing NVS encryption-related security configuration
2023-05-23 13:55:53 +05:30
Mahavir Jain
9628118400 partition_table: add tests for checking secure boot part size 2023-02-08 03:23:46 +00:00
Mahavir Jain
8d05d2511c gen_esp32part: allow secure boot v2 based app partition size 4K aligned
For Secure Boot v2 case, unsigned image is first padded to next 64K
aligned boundary and then a signature block of 4K gets appended. Thus
an app partition whose size is 4K aligned should be allowed here.

For Secure Boot v1 case, app partition size must be 64K aligned as the
signature block lies at the very end of 64K boundary.

Relevant:
57b601ab7f
2023-02-08 03:23:46 +00:00
wuzhenghui
0cbb4227b2 feature: add build framework support 2023-02-01 17:57:25 +08:00
Ivan Grokhotkov
ec8f38c9da
build system: generate the partition table by default for linux target
This fixes the issue that "idf.py partition-table" had to be run
manually in order for the partition table to be generated, when
building for linux target.
2023-01-13 08:14:56 +01:00
Martin Vychodil
c9c7573f71 Storage: Partition APIs moved to the new component 'esp_partition'
All the partition handling API functions and data-types were moved from the 'spi_flash' component to the new one named 'esp_partition'. See Storage 5.x migration guide for more details
2022-11-02 21:54:45 +01:00
KonstantinKondrashov
b5315aec16 partition_table: Improve an error msg and doc
Closes https://github.com/espressif/esp-idf/issues/9846
2022-10-20 17:18:01 +08:00
harshal.patil
aca27c8db2 parttool: fix extra_partition_subtypes attribute parsing 2022-09-20 11:28:52 +05:30
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
Shubham Kulkarni
b6d69840e8 partition_table: Support registering custom subtypes 2022-08-03 05:18:37 +00:00
Marius Vikhammer
0687daf2c8 kconfig: move remaining kconfig options out of target component
The kconfig options are moved to the component where they are used,
mostly esp_hw_support and esp_system.
2022-05-23 17:57:45 +08:00
Mahavir Jain
a0e27a186b Merge branch 'esp32c2/support_secure_boot' into 'master'
ESP32C2: Support Secure Boot V2

Closes IDF-3846 and IDF-4209

See merge request espressif/esp-idf!17442
2022-05-13 19:46:22 +08:00
Djordje Nedic
e09ef86d7c partition_table: Add warning when partitions are nearly full
This adds a warning in cases where the smallest partition is nearly full.
A test with a specially crafted partition table is created for the smallest partition warning.
If the threshold or the template itself change, change the factory app partition size as well.
2022-05-13 07:14:04 +00:00
Sachin Parekh
2c725264f7
esp32c2: Support Secure Boot V2 based on ECDSA scheme 2022-05-11 18:00:03 +05:30
Matus Fabo
6bc7b4b5e2 change: misaligned partitions now raise an exception
change: alignment for data partitions is now 4kB instead of 4B
remove: STRICT_DATA_ALIGNMENT variable
remove: warning tests for misaligned partitions
add: assertion test for misaligned partitions
add: breaking change documentation
2022-03-15 12:54:59 +01:00
Martin Vychodil
9a5f39ec2c spi_flash: Linux target emulation of Partition API
Emulator of Partition API layer for Linux OS
2022-03-04 14:36:46 +00:00
Ivan Grokhotkov
f071558117
partition_table: add a test for total partition size error 2022-02-21 10:28:29 +03:00
rudi ;-)
f242a1705a
add support for Flash 32MB..128MB (S2, S3)
ESP32-S2 and ESP32-S3
supports up to 1 GB of external flash and RAM
add support for
-    32MB
-    64MB
-    128MB ( example NOR spiFLASH 1G-BIT W25Q01JVZEIQ Winbond 0xEF 0x40 0x21 )

Merges https://github.com/espressif/esp-idf/pull/7688

Signed-off-by: Ivan Grokhotkov <ivan@espressif.com>
2022-02-21 10:26:41 +03:00
Ivan Grokhotkov
7830af1eb9 partition_table: allow enabling this component for Linux target
Currently partition_table_bin target is not added as a dependency
when building Linux app, and has to be specified manually
(idf.py partition-table).
2022-01-24 18:51:40 +01:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Marek Fiala
ff18a96f7d tools: replace _ with - in idf.py
Closes https://github.com/espressif/esp-idf/issues/5126
2021-10-13 17:30:38 +08:00
boarchuz
c098dce1e5 check_sizes.py: Fix bootloader size message in build log
Closes https://github.com/espressif/esp-idf/pull/7506
2021-09-02 10:28:34 +05:00
Ivan Grokhotkov
b56c9aafe4 partition_table: warn if data partition offset is not 4kB aligned
If a partition offset is not aligned to 4 kB, erase operations will
fail, even if they are aligned to 4 kB relative to the partition
start. This is because the underlying esp_flash_erase_range function
only works when the address is aligned to 4 kB.

Not making this an error for now, since applications might be using
read-only non-4kB aligned partitions, which still work fine.
Will change this behavior in IDF 5.0, requiring 4 kB alignment for all
partitions.

Closes https://github.com/espressif/esp-idf/issues/7295
Closes https://github.com/espressif/esp-idf/issues/7350
2021-08-23 08:09:28 +02:00
Ivan Grokhotkov
54595887f6 partition_table: gen_esp32part.py --secure applies to app partitions
...only. Previously this check was done for both app and data
partitions. While checking that data partition size is aligned is
a _good thing_, the check would only occur when secure boot was on.
2021-08-23 08:04:53 +02:00
Ivan Grokhotkov
2e83ac5a99 partition_table: don't print warnings to stdout 2021-08-23 08:01:41 +02:00
KonstantinKondrashov
9b654db032 partition_table: Fix case when a few similar to otadata partitions in the table
It was when in the partition table there is a partition with type="data" and suptype=""(empty),
in this case type=1, suptype=0. It is similar to otadata partition.

This commit fixes it, now it will handle it as type=1, suptype=6 (ESP_PARTITION_SUBTYPE_DATA_UNDEFINED).
2021-08-18 09:23:17 +05:00
Angus Gratton
ede477ea65 paritition_table: Verify the partition table md5sum when loading the app
Additionally, always enable the partition MD5 check if flash encryption is on in
Release mode. This ensures the partition table ciphertext has not been modified
(CVE-2021-27926).

The exception is pre-V3.1 ESP-IDF bootloaders and partition tables, which
don't have support for the MD5 entry.
2021-05-18 01:32:59 +00:00
Ivan Grokhotkov
f92e1c45ae esp_partition: add test, docs for ESP_PARTITION_TYPE_ANY 2021-05-05 15:11:29 +02:00
Angus Gratton
920edd4e73 partition_table: Add a "single factory app (large)" option for 1.5MB app size
Needed to build some examples in their default configurations (especially
ESP32-C3). Wasn't noticed until the CI checks for partition size were added.
2021-04-16 16:40:47 +10:00
Angus Gratton
b45b817e6f partition_table: Fix pylint issues in gen_esp32part.py 2021-04-16 16:40:47 +10:00
Angus Gratton
6f6b4c3983 cmake partition_table: Check binaries fit in partition spaces at build time
- Bootloader is checked not to overlap partition table
- Apps are checked not to overlap any app partition regions

Supported for CMake build system only.

Closes https://github.com/espressif/esp-idf/pull/612
Closes https://github.com/espressif/esp-idf/issues/5043
Probable fix for https://github.com/espressif/esp-idf/issues/5456
2021-04-16 16:40:47 +10:00
Matt Arcidy
3942b61a1e partition_table requires esptool_py for esptool_py_flash_target
Closes https://github.com/espressif/esp-idf/pull/6672
Closes https://github.com/espressif/esp-idf/issues/6670
2021-03-08 19:47:38 +11:00
Fu Hanxi
0146f258d7 style: format python files with isort and double-quote-string-fixer 2021-01-26 10:49:01 +08:00
Aditya Patwardhan
a02be97fda nvs_flash: Modify the default NVS initialization API with internal nvs encryption
handling (only when nvs encryption is enabled)
    * NVS Encryption will now be turned on by default with flash encryption
    * Updated the flash encryption example to shocase NVS encryption
    along with information on how to configure and use NVS encryption
    * Updated respective test case
    * Added two partition tables for NVS encryption
     i) Table 1- Single factory app, no OTA, encrypted NVS
     ii) Table 2- Factory app, Two OTA, encrypted NVS
2021-01-20 11:12:14 +00:00
Roland Dobai
548ea1bdd5 tools: Wrap flash binaries into a UF2 file for flashing through USB MSC
@mmoskal This commit adds basic support for UF2 into ESP-IDF.
2020-12-29 18:14:47 +01:00
Angus Gratton
e4407468bc Merge branch 'feature/flash_binary_partition_with_name' into 'master'
buildsystem: flash binary to a named partition

Closes IDF-2387

See merge request espressif/esp-idf!11342
2020-12-10 06:24:15 +08:00
Omar Chebib
956538e364 buildsystem: flash binary to a named partition
- Add the function esptool_py_flash_to_partition to flash a binary
image to a named partition. If encryption is enabled, this function
will also determine if the partition needs to be encrypted or not
according the its type, subtype and flag in the CSV file (if any).
- Use idf.py encrypted-flash will now flash both encrypted and
non-encrypted file if any (spiffs for example) using esptool.py's
--encrypt-files option.

Closes IDF-2387
Relates to IDF-723
Relates to IDF-2231
2020-11-26 10:04:34 +08:00
Roland Dobai
075d3a57ac partition_table: Fix missing argument not present for all parsers 2020-11-25 23:33:57 +01:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Angus Gratton
e82eac4354 cmake: Apply cmakelint fixes 2020-11-11 07:36:35 +00:00
Marius Vikhammer
b3e7b58d04 parttool: make part_list an optional argument
Previous versions of PartitionType only required type and subtype as
arguments for the constructor. Make the new part_list argument optional to
keep backwards compatibilty
2020-10-10 09:46:51 +08:00
Angus Gratton
4b36da3f33 Merge branch 'feature/parttool_add_options_to_info_cmd' into 'master'
partition_table: Extend the get_partition_info command

See merge request espressif/esp-idf!10537
2020-10-06 07:35:32 +08:00
KonstantinKondrashov
55dc1524ee partition_table: Extend the get_partition_info command
A manufactory tool needs to retrieve info about partitions.  With a new flag - "--part_list" we can get a list of partitions with the same type/subtype and easily iterate by it.

- name and flag arguments
- added flag "--part_list" to get a list of partitions with the same type/subtype
- save prev behavior of the get_partition_info command (return the only first item)
- added host test
2020-10-05 17:56:43 +08:00
Mahavir Jain
20af94ff53 Coredump config option rename throughout IDF 2020-09-30 20:22:27 +05:30
martin.gano
da5b582dee add file stream parameter and log stdout and stderr to same stream 2020-09-17 12:54:18 +02:00
Jakob Hasse
aca9ec28b3 NVS: using esp_partition API
* partition api changed from spi_flash* API to
  esp_partition* API and is abstracted as a C++
  interface.
* The old nvs encryption is still possible
* changed default unit test app partition table
* Partitions coming from esp_partition API are
  checked for generic flash encryption. If yes,
  an error is returned since generic flash
  encryption isn't compatible with nvs
  encryption
* esp32, esp32s2 tests don't require nvs_flash
  but mbedtls now

Closes IDF-1340
Closes IDF-858
2020-09-14 10:34:34 +08:00