From 9a76e0fdb670806039942216a540a00f0f5cf56a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 27 Jul 2021 18:25:35 +0800 Subject: [PATCH] openocd: patch SPI flash snafu. Closes #62 --- artiq-fast/pkgs/openocd-jtagspi.nix | 24 ++++++++++++++++++++++++ artiq-fast/pkgs/openocd.nix | 6 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 artiq-fast/pkgs/openocd-jtagspi.nix diff --git a/artiq-fast/pkgs/openocd-jtagspi.nix b/artiq-fast/pkgs/openocd-jtagspi.nix new file mode 100644 index 0000000..fa41f94 --- /dev/null +++ b/artiq-fast/pkgs/openocd-jtagspi.nix @@ -0,0 +1,24 @@ +diff --git a/src/flash/nor/spi.c b/src/flash/nor/spi.c +index af72ffc4..e5c9a9bd 100644 +--- a/src/flash/nor/spi.c ++++ b/src/flash/nor/spi.c +@@ -90,8 +90,8 @@ const struct flash_device flash_devices[] = { + FLASH_ID("mac 25r6435f", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x001728c2, 0x100, 0x10000, 0x800000), + FLASH_ID("micron n25q064", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0017ba20, 0x100, 0x10000, 0x800000), + FLASH_ID("micron n25q128", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0018ba20, 0x100, 0x10000, 0x1000000), +- FLASH_ID("micron n25q256 3v", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0019ba20, 0x100, 0x10000, 0x2000000), +- FLASH_ID("micron n25q256 1.8v", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0019bb20, 0x100, 0x10000, 0x2000000), ++ FLASH_ID("micron n25q256 3v", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0019ba20, 0x100, 0x10000, 0x2000000), ++ FLASH_ID("micron n25q256 1.8v", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0019bb20, 0x100, 0x10000, 0x2000000), + FLASH_ID("micron mt25ql512", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0020ba20, 0x100, 0x10000, 0x4000000), + FLASH_ID("micron mt25ql01", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0021ba20, 0x100, 0x10000, 0x8000000), + FLASH_ID("micron mt25ql02", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0022ba20, 0x100, 0x10000, 0x10000000), +@@ -124,7 +124,7 @@ const struct flash_device flash_devices[] = { + FLASH_ID("issi is25lp064", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x0017609d, 0x100, 0x10000, 0x800000), + FLASH_ID("issi is25lp128d", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0018609d, 0x100, 0x10000, 0x1000000), + FLASH_ID("issi is25wp128d", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0018709d, 0x100, 0x10000, 0x1000000), +- FLASH_ID("issi is25lp256d", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0019609d, 0x100, 0x10000, 0x2000000), ++ FLASH_ID("issi is25lp256d", 0x03, 0xeb, 0x02, 0xd8, 0xc7, 0x0019609d, 0x100, 0x10000, 0x2000000), + FLASH_ID("issi is25wp256d", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x0019709d, 0x100, 0x10000, 0x2000000), + FLASH_ID("issi is25lp512m", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x001a609d, 0x100, 0x10000, 0x4000000), + FLASH_ID("issi is25wp512m", 0x13, 0xec, 0x12, 0xdc, 0xc7, 0x001a709d, 0x100, 0x10000, 0x4000000), diff --git a/artiq-fast/pkgs/openocd.nix b/artiq-fast/pkgs/openocd.nix index 0549faf..c9b2b11 100644 --- a/artiq-fast/pkgs/openocd.nix +++ b/artiq-fast/pkgs/openocd.nix @@ -15,8 +15,12 @@ let cp $src/*.bit $out/share/bscan-spi-bitstreams ''; }; + # https://docs.lambdaconcept.com/screamer/troubleshooting.html#error-contents-differ + openocd-fixed = openocd.overrideAttrs(oa: { + patches = oa.patches or [] ++ [ ./openocd-jtagspi.nix ]; + }); in buildEnv { name = "openocd-bscanspi"; - paths = [ openocd bscan_spi_bitstreams-pkg ]; + paths = [ openocd-fixed bscan_spi_bitstreams-pkg ]; }