Commit Graph

150 Commits

Author SHA1 Message Date
Mahavir Jain
379d9034eb
partition_table: fix make build for new "--secure [v1/v2]" argument 2023-02-12 21:29:39 +05:30
Mahavir Jain
5002ccd9c3
partition_table: add tests for checking secure boot part size 2023-02-12 18:58:47 +05:30
Mahavir Jain
51a61fb41c
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-12 18:58:21 +05:30
Ivan Grokhotkov
6e9414206a partition_table: add a test for total partition size error 2022-04-19 14:00:11 +00:00
rudi ;-)
04959af635 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-04-19 14:00:11 +00: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
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
Ivan Grokhotkov
754d631247 partition_table: fix generation of signed partition table
Fixes the issue that signed partition table was not generated when
CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES was on, because
partition_table_bin depended on unsigned_partition_bin twice.
Regression from acb7a211.

Also use final_partition_bin variable in esptool_py_flash_target_image
arguments, to avoid issues in the future if final_partition_bin is
changed.
2020-05-31 18:39:30 +02:00
KonstantinKondrashov
e3ea943088 partition_table: Fix parttool.py crashes when retrieving partition info
Closes: IDFGH-3279
Closes: https://github.com/espressif/esp-idf/issues/5271
2020-05-13 16:10:48 +08:00
Ivan Grokhotkov
dafd50934d esptool: don't generate flashing metadata in loadable elf build 2020-05-04 19:11:00 +02:00
Renz Bagaporo
acb7a211dd partition_table: do not always display partition table contents on build 2020-04-08 11:38:43 +08:00
Renz Bagaporo
3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
morris
46ea7d815d parttool: don't print target name 2020-03-09 15:05:04 +08:00
Renz Christian Bagaporo
709d139a25 partition_table: output partition table info for partition_table target 2020-03-05 11:04:09 +08:00
Supreet Deshpande
a9ccc5e5c8 feat/secure_boot_v2: Adding secure boot v2 support for ESP32-ECO3 2020-02-25 01:28:22 +05:30
boarchuz
d0eb6c9701 Fix subtype in PartitionTable.find_by_type
Fix ptype->subtype

Closes https://github.com/espressif/esp-idf/pull/4723
2020-02-06 08:48:35 +01:00
Renz Christian Bagaporo
cc8bff703e esptool_py: create flash target functions 2020-01-15 03:36:47 +00:00
Angus Gratton
8f15664be0 parttool: Fix regression when parsing binary partition data
Regression in a91de43537
2019-12-20 19:09:10 +11:00
Angus Gratton
a91de43537 parttool: Avoid unnecessary exception backtrace for legitimate errors
Previous version used exception handling for program control flow,
which makes for long and confusing backtrace messages if an error
occurs while parsing the CSV (as it also prints the phony error that
occurred while trying to parse as a binary, then prints
"During handling of the above exception, another exception occurred:",
then prints the real error).

Use the same heuristic that is applied in gen_esp32_part, instead.

Also, avoid printing the entire backtrace if the error is a gen_esp32_part
InputError, same as gen_esp32part does.

Found while looking into https://github.com/espressif/esp-idf/issues/4474
2019-12-16 18:24:10 +11:00
Wu Jian Gang
1a29ddbd33 cmake: fix partition_table cmake when using md5 checksum 2019-11-08 02:59:22 +00:00
Roland Dobai
833822c10b Fix Kconfig issues discovered by upstream Kconfiglib 2019-09-23 16:10:57 +02:00
Ivan Grokhotkov
26800ed71e global: update note in the partition tables
The build system automatically determines offsets of partitions from
the partition table, so no manual changes are needed. Instead, add a
note that partition offsets may need to be updated when increasing
the bootloader size.
2019-07-27 10:28:16 +02:00
Søren Christian Madsen
aa0c5f03be Add --baud option to parttool
Closes https://github.com/espressif/esp-idf/pull/3753
2019-07-10 15:09:46 +02:00
Renz Christian Bagaporo
2360d882d9 parttool, otatool: accept esptool args 2019-07-05 02:26:00 +00:00
Renz Christian Bagaporo
9edc867c62 bootloader: fix secure boot issues
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-28 10:54:21 +08:00