From e394c356893a87403e4544d23a8ef0580483798a Mon Sep 17 00:00:00 2001 From: yangxf Date: Tue, 27 May 2025 17:30:01 +0800 Subject: [PATCH 1/3] fix overflow problem of micropython stack --- core/embed/unix/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/embed/unix/main.c b/core/embed/unix/main.c index 74c0c11786..7d15349675 100644 --- a/core/embed/unix/main.c +++ b/core/embed/unix/main.c @@ -495,7 +495,7 @@ MP_NOINLINE int main_(int argc, char **argv) { #endif #if MICROPY_ENABLE_PYSTACK - static mp_obj_t pystack[1024]; + static mp_obj_t pystack[4096]; mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]); #endif From 3870ff7973668dece1ea4b36b4da6e2e2f3e12ba Mon Sep 17 00:00:00 2001 From: yangxf Date: Wed, 28 May 2025 14:31:27 +0800 Subject: [PATCH 2/3] check path of pyright for nix --- ci/shell.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ci/shell.nix b/ci/shell.nix index 4a38e98795..672becc199 100644 --- a/ci/shell.nix +++ b/ci/shell.nix @@ -19,10 +19,10 @@ let sha256 = "02s3qkb6kz3ndyx7rfndjbvp4vlwiqc42fxypn3g6jnc0v5jyz95"; }) { }; # commit emulator works fine - sdlnixpkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/1882c6b7368fd284ad01b0a5b5601ef136321292.tar.gz"; - sha256 = "0zg7ak2mcmwzi2kg29g4v9fvbvs0viykjsg2pwaphm1fi13s7s0i"; - }) { }; + # sdlnixpkgs = import (builtins.fetchTarball { + # url = "https://github.com/NixOS/nixpkgs/archive/1882c6b7368fd284ad01b0a5b5601ef136321292.tar.gz"; + # sha256 = "0zg7ak2mcmwzi2kg29g4v9fvbvs0viykjsg2pwaphm1fi13s7s0i"; + # }) { }; moneroTests = nixpkgs.fetchurl { url = "https://github.com/ph4r05/monero/releases/download/v0.18.1.1-dev-tests-u18.04-02/trezor_tests"; sha256 = "81424cfc3965abdc24de573274bf631337b52fd25cefc895513214c613fe05c9"; @@ -57,7 +57,11 @@ let }; llvmPackages = nixpkgs.llvmPackages_15; # see pyright/README.md for update procedure - pyright = nixpkgs.callPackage ./pyright {}; + pyrightpath = builtins.pathExists ./pyright; + pyright = if pyrightpath then + nixpkgs.callPackage ./pyright {} + else + nixpkgs.callPackage ./ci/pyright {}; in with nixpkgs; stdenvNoCC.mkDerivation ({ @@ -73,8 +77,8 @@ stdenvNoCC.mkDerivation ({ oldPythonNixpkgs.python37 oldPythonNixpkgs.python36 ] ++ [ - sdlnixpkgs.SDL2 - sdlnixpkgs.SDL2_image + SDL2 + SDL2_image bash check curl # for connect tests From c737444985e3fa7ffcd1fe2ff9536eb589c398a8 Mon Sep 17 00:00:00 2001 From: yangxf Date: Wed, 28 May 2025 15:37:29 +0800 Subject: [PATCH 3/3] add conditional import of SDL --- ci/shell.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ci/shell.nix b/ci/shell.nix index 672becc199..0db7c7e189 100644 --- a/ci/shell.nix +++ b/ci/shell.nix @@ -19,10 +19,10 @@ let sha256 = "02s3qkb6kz3ndyx7rfndjbvp4vlwiqc42fxypn3g6jnc0v5jyz95"; }) { }; # commit emulator works fine - # sdlnixpkgs = import (builtins.fetchTarball { - # url = "https://github.com/NixOS/nixpkgs/archive/1882c6b7368fd284ad01b0a5b5601ef136321292.tar.gz"; - # sha256 = "0zg7ak2mcmwzi2kg29g4v9fvbvs0viykjsg2pwaphm1fi13s7s0i"; - # }) { }; + sdlnixpkgs = import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/1882c6b7368fd284ad01b0a5b5601ef136321292.tar.gz"; + sha256 = "0zg7ak2mcmwzi2kg29g4v9fvbvs0viykjsg2pwaphm1fi13s7s0i"; + }) { }; moneroTests = nixpkgs.fetchurl { url = "https://github.com/ph4r05/monero/releases/download/v0.18.1.1-dev-tests-u18.04-02/trezor_tests"; sha256 = "81424cfc3965abdc24de573274bf631337b52fd25cefc895513214c613fe05c9"; @@ -77,8 +77,6 @@ stdenvNoCC.mkDerivation ({ oldPythonNixpkgs.python37 oldPythonNixpkgs.python36 ] ++ [ - SDL2 - SDL2_image bash check curl # for connect tests @@ -102,11 +100,15 @@ stdenvNoCC.mkDerivation ({ zlib moreutils ] ++ lib.optionals (!stdenv.isDarwin) [ + SDL2 + SDL2_image autoPatchelfHook gcc11 procps valgrind ] ++ lib.optionals (stdenv.isDarwin) [ + sdlnixpkgs.SDL2 + sdlnixpkgs.SDL2_image darwin.apple_sdk.frameworks.CoreAudio darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.ForceFeedback