Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ _autosave-*
*-save.kicad_pcb
fp-info-cache
*.lck

# Nix files
/.direnv
result
21 changes: 12 additions & 9 deletions docs/tulip_flashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It will ask you if you want to upgrade your firmware and/or your `/sys` folder (

## Flash Tulip from a compiled release

If you've got an unflashed Tulip, just finished a DIY, or somehow messed up the flash / firmware, you can flash the entire Tulip and filesystem with one file from our releases. We aim to release versions of Tulip regularly. You can find the latest in our [releases section](https://github.com/shorepine/tulipcc/releases/latest).
If you've got an unflashed Tulip, just finished a DIY, or somehow messed up the flash / firmware, you can flash the entire Tulip and filesystem with one file from our releases. We aim to release versions of Tulip regularly. You can find the latest in our [releases section](https://github.com/shorepine/tulipcc/releases/latest).

**If you have the [Tulip from Makerfabs](https://tulip.computer/)**, you can directly download the latest full firmware binary here: [TULIP4_R11](https://github.com/shorepine/tulipcc/releases/latest/download/tulip-full-TULIP4_R11.bin).

Expand Down Expand Up @@ -60,7 +60,10 @@ Linux:
sudo apt install cmake ninja-build dfu-util virtualenv
```

For both macOS & Linux, next, download the supported version of ESP-IDF. That is release 5.4.1. You need to get this with `git`, so install that if you don't already have it. Once Espressif updates the release, we can provide a direct download link that's a bit easier.
Nix:
A devshell is provided through `direnv` or through `nix develop`.

For both macOS & Linux, next, download the supported version of ESP-IDF. That is release 5.4.1. You need to get this with `git`, so install that if you don't already have it. Once Espressif updates the release, we can provide a direct download link that's a bit easier.

I like to keep them in `~/esp/`, as you'll likely want to use different versions eventually. So we'll assume it's in `~/esp/esp-idf`.

Expand All @@ -76,17 +79,17 @@ cd esp-idf-v5.4.1
source export.sh

cd ~
git clone https://github.com/shorepine/tulipcc.git
git clone https://github.com/shorepine/tulipcc.git
pip3 install Cython
pip3 install littlefs-python # needed to flash the filesystem
cd ~/tulipcc/tulip/esp32s3
```

### Flash Tulip after compiling

Now connect your Tulip to your computer over USB. See the notes about which USB port to use above.
Now connect your Tulip to your computer over USB. See the notes about which USB port to use above.

Choose the right `MICROPY_BOARD` value for your board.
Choose the right `MICROPY_BOARD` value for your board.

* [Tulip CC](https://tulip.computer/) (our integrated board with display): `TULIP4_R11`
* Any DIY Tulip board based on the N16R8 (16MB flash): `N16R8`
Expand All @@ -101,23 +104,23 @@ For example, for a Tulip4 DIY board based on a N32R8:

```bash
idf.py -DMICROPY_BOARD=N32R8 build
# With a brand new chip or devboard, the first time, you'll want to flash Tulip's filesystem
# With a brand new chip or devboard, the first time, you'll want to flash Tulip's filesystem
# to the flash memory. Run this only once, or each time you modify `fs` if you're developing Tulip itself.
cd ..
python fs_create.py tulip flash
```

You may need to restart Tulip after the flash, but Tulip should now just turn on whenever you connect USB or power it on.
You may need to restart Tulip after the flash, but Tulip should now just turn on whenever you connect USB or power it on.

To build and flash going forward, without modifying the filesystem:

```bash
cd tulip/esp32s3
source ~/esp/esp-idf/export.sh # do this once per terminal window
idf.py -DMICROPY_BOARD=[X] flash
idf.py -DMICROPY_BOARD=[X] flash
idf.py monitor # shows stderr and stdin for controlling Tulip, use control-] to quit

# If you (or we!) make changes to the underlying libraries on AMY or micropython, you want to fully clean the build
# If you (or we!) make changes to the underlying libraries on AMY or micropython, you want to fully clean the build
rm ../../.submodules_ok # this forces the submodules to re-init
idf.py fullclean
idf.py -DMICROPY_BOARD=[X] flash
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
# Import nixpkgs for the specific system
pkgs = import nixpkgs { inherit system; };

littlefs-python =
{
buildPythonPackage,
cython,
setuptools,
setuptools-scm,
...
}:
buildPythonPackage rec {
pname = "littlefs-python";
version = "0.17.0";

src = pkgs.fetchFromGitHub {
owner = "jrast";
repo = pname;
tag = "v${version}";
fetchSubmodules = true;
hash = "sha256-GRMYnnt8E1QNWoynDJyXOIzE1AtzeXOwBv/ZrIDWSGs=";
};

buildInputs = [
cython
setuptools-scm
];

pyproject = true;
build-system = [ setuptools ];
};

python = pkgs.python3.override {
self = python;
packageOverrides = pyfinal: pyprev: {
littlefs-python = pyfinal.callPackage littlefs-python { };
};
};
in
{
devShells.default = pkgs.mkShell {
name = "tulipcc-devshell";

packages = with pkgs; [
esptool
cmake
ninja
dfu-util

(python.withPackages (python-pkgs: [
python-pkgs.littlefs-python
python-pkgs.cython
]))
];
};
}
);
}