-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for partition-tables. #67
Changes from 3 commits
f8802a2
c54737f
4564f0a
636360d
093360b
b405962
8bf9aca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ on: | |
required: false | ||
type: boolean | ||
default: true | ||
build-tables: | ||
description: Build partition tables | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build partitions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
required: false | ||
type: boolean | ||
default: true | ||
toit-version: | ||
description: Toit SDK version to check out | ||
required: true | ||
|
@@ -192,7 +197,7 @@ jobs: | |
artifacts: | | ||
envelopes/* | ||
body: | | ||
Envelopes for Toit SDK ${{ github.event.inputs.toit-version }} | ||
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Hold on a tick, baby! Let's make the release message more dynamic! The release message mentions partition tables even when Let's make it more shagadelic with a conditional message: - Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }}
+ ${{ github.event.inputs.build-tables == 'true' && 'Envelopes and partition tables' || 'Envelopes' }} for Toit SDK ${{ github.event.inputs.toit-version }} Also applies to: 308-308, 379-379 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. partitions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
allowUpdates: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.event.inputs.toit-version }} | ||
|
@@ -300,7 +305,7 @@ jobs: | |
artifacts: | | ||
envelopes/* | ||
body: | | ||
Envelopes for Toit SDK ${{ github.event.inputs.toit-version }} | ||
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }} | ||
allowUpdates: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.event.inputs.toit-version }} | ||
|
@@ -371,7 +376,47 @@ jobs: | |
artifacts: | | ||
envelopes/* | ||
body: | | ||
Envelopes for Toit SDK ${{ github.event.inputs.toit-version }} | ||
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }} | ||
allowUpdates: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.event.inputs.toit-version }} | ||
commit: main | ||
|
||
release-partition-tables: | ||
name: "Release partition tables - ${{ github.event.inputs.toit-version }}" | ||
if: ${{ github.event.inputs.build-tables == 'true' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Show inputs | ||
run: echo "${{ toJSON(github.event.inputs) }}" | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set the git version | ||
run: | | ||
echo "TOIT_GIT_VERSION=${{ github.event.inputs.toit-version }}" >> $GITHUB_ENV | ||
|
||
- name: Prepare partition tables | ||
shell: bash | ||
run: | | ||
mkdir -p build | ||
shopt -s nullglob | ||
for csv_file in partition-tables/*/partitions.csv; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's put these in partitions//partitions.csv - maybe even esp32/partitions//partitions.cvs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
variant=$(basename $(dirname $csv_file)) | ||
if [ -e "partition-tables/$variant/partitions.csv" ]; then | ||
cp "$csv_file" "build/partition-table-$variant.csv" | ||
fi | ||
done | ||
floitsch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Release | ||
if: ${{ github.event.inputs.upload-release == 'true' }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: | | ||
build/partition-table-*.csv | ||
body: | | ||
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }} | ||
allowUpdates: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.event.inputs.toit-version }} | ||
|
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)). |
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. |
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 |
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. |
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build-partitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.