-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for partition-tables. (#67)
- Loading branch information
Showing
7 changed files
with
201 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Partition tables | ||
|
||
This directory contains partition tables for ESP32 devices and their variants. | ||
|
||
During flashing, users can override the default partition table that comes | ||
with the envelope that they are flashing. | ||
|
||
Here is a list of the most commonly used partition tables: | ||
|
||
## OTA-1C0000 | ||
|
||
A partition table that sets the size of the OTA partitions | ||
to 0x1C0000 (1835008) bytes. This table is typically used for | ||
use-cases where programs are bundled with the firmware (like with | ||
[Artemis](https://github.com/toitware/artemis)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# OTA-1C0000 | ||
|
||
A partition table that sets the size of the OTA partitions | ||
to 0x1C0000 (1835008) bytes. | ||
|
||
As a consequence the size of the programs partition is set to | ||
0x60000 (393216) bytes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (C) 2023 Toitware ApS. | ||
# | ||
# Use of this source code is governed by a BSD0-style license that can be | ||
# found in the LICENSE_BSD0 file. | ||
|
||
# Partition Table for Toit. | ||
|
||
# Name, Type, SubType, Offset, Size | ||
# bootloader,, , 0x001000, 0x007000 | ||
# partitions,, , 0x008000, 0x000c00 | ||
secure, 0x42, 0x00, 0x009000, 0x004000, | ||
otadata, data, ota, 0x00d000, 0x002000, | ||
phy_init, data, phy, 0x00f000, 0x001000, | ||
ota_0, app, ota_0, 0x010000, 0x1c0000, | ||
ota_1, app, ota_1, 0x1d0000, 0x1c0000, | ||
nvs, data, nvs, 0x390000, 0x010000, | ||
programs, 0x40, 0x00, 0x3A0000, 0x060000, encrypted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Contributing | ||
|
||
Feel free to open issues and pull requests with new variants. Make sure | ||
they have a description (README.md) with the purpose and the changes. If | ||
they are generally useful, we will add them to the repository. | ||
|
||
Variants in this repository are automatically built whenever a new Toit | ||
version is released. | ||
|
||
## Creating a variant | ||
|
||
Variants are created by copying an existing variant and making the | ||
necessary changes. These consists of either overwriting existing files | ||
or by applying patches. | ||
|
||
### Partition changes | ||
|
||
For partition changes, simply copy the new `partitions.csv` into the | ||
variant directory. The `esp32-ota-1c0000` is an example of this where | ||
the OTA partition size has been increased. | ||
|
||
### sdkconfig changes | ||
|
||
For `sdkconfig` changes, a patch to the original `sdkconfig.defaults` | ||
file is typically preferred. | ||
|
||
For example, to create a variant `esp32s3-foo`. | ||
* Check out Toit (or use an existing checkout). | ||
* Copy the existing `toolchains/esp32s3` directory to `toolchains/esp32s3-foo`: | ||
`cp -r toolchains/esp32s3 toolchains/esp32s3-foo`. | ||
* Run `make IDF_TARGET=esp32s3 ESP32_CHIP=esp32s3-foo menuconfig` and make the changes you want. | ||
This automatically updates the `sdkconfig.defaults` as well. | ||
* Create patch by running: | ||
``` | ||
diff -aur \ | ||
--label toit/toolchains/esp32s3/sdkconfig.defaults \ | ||
--label synthesized/esp32s3-foo/sdkconfig.defaults \ | ||
toolchains/esp32s3/sdkconfig.defaults \ | ||
toolchains/esp32s3-foo/sdkconfig.defaults \ | ||
> toolchains/esp32s3-foo/sdkconfig.defaults.patch | ||
``` | ||
The labels are not crucial, but make it easier for us to update the | ||
patch at a later time. | ||
* Create a new variant in this (`envelopes`) repository and copy the patch file into it. | ||
|
||
### Main changes | ||
|
||
For changes to the `main` directory (be it the `toit.c` or the `CMakelists.txt` in it), | ||
use a recursive diff to create a patch on the original `main` directory. | ||
|
||
The synthetization tool will use the flag `-p1` when applying the patch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Variants | ||
|
||
Some commonly used variants are featured here. You can also browse this | ||
directory for more variants. | ||
|
||
See the [Contributing](Contributing.md) guide for how to create a new variant. | ||
|
||
|
||
## esp32 | ||
|
||
A generic ESP32 variant. This is the default variant when using Toit. | ||
It is built for maximum compatibility. | ||
|
||
This variant supports Ethernet, but without the clock output. | ||
|
||
## esp32-spiram | ||
|
||
An ESP32 variant for boards with SPIRAM. Otherwise the same as the ESP32 variant. | ||
|
||
## esp32-eth-clk-out0 and esp32-eth-clk-out17 | ||
|
||
A variant for ESP32 boards with Ethernet and a clock output on pin 0/17. | ||
|
||
Olimex boards with Ethernet should use this variant. The WROOM versions need | ||
`esp32-eth-clk-out17` and the WROVER versions need `esp32-eth-clk-out0`. | ||
|
||
## esp32c3 | ||
|
||
A generic [ESP32-C3 variant](esp32c). This is the default variant | ||
when using Toit on ESP32-C3 boards. | ||
|
||
## esp32s2 | ||
|
||
A generic [ESP32-S2 variant](esp32s2). This is the default variant | ||
when using Toit on ESP32-S2 boards. | ||
|
||
## esp32s3 | ||
|
||
A generic [ESP32-S3 variant](esp32s3). This is the default variant | ||
when using Toit on ESP32-S3 boards. | ||
|
||
This variant is configured for external Quad PSRAM. | ||
|
||
## esp32s3-spiram-octo | ||
|
||
A [variant](esp32s3-spiram-octo/) for ESP32-S3 boards with external | ||
octal PSRAM. | ||
|
||
These boards are faster, but often more expensive. | ||
|
||
## esp32-no-ble | ||
|
||
A [variant](esp32-no-ble/) for ESP32 boards. This variant | ||
saves some RAM and flash space by removing the Bluetooth stack. | ||
The saved IRAM enables us to make the Toit interpreter a little faster | ||
and add support for external RAM (PSRAM, aka SPIRAM). |