From 56de7f811a92738ad67d01e99237c593cb93d469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 17 Oct 2025 11:36:09 +0200 Subject: [PATCH 1/2] update submodules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update submodules Signed-off-by: Fin Maaß --- soc_zephyr.py | 1 - third_party/litedram | 2 +- third_party/liteeth | 2 +- third_party/litepcie | 2 +- third_party/litesata | 2 +- third_party/litescope | 2 +- third_party/litex | 2 +- third_party/litex-boards | 2 +- third_party/migen | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) diff --git a/soc_zephyr.py b/soc_zephyr.py index ac008cd..501dcf3 100644 --- a/soc_zephyr.py +++ b/soc_zephyr.py @@ -40,7 +40,6 @@ class _SoCZephyr(soc_cls): "spi": 4, # addr: 0xe0002000 "timer0": 5, # addr: 0xe0002800 "sdram": 6, # addr: 0xe0003000 - "uartphy": 7, # addr: 0xe0004000 "mmcm": 9, # addr: 0xe0004800 "i2c0": 10, # addr: 0xe0005000 "rgb_led_r0": 14, # addr: 0xe0007000 diff --git a/third_party/litedram b/third_party/litedram index b3aef9f..cd5e7f6 160000 --- a/third_party/litedram +++ b/third_party/litedram @@ -1 +1 @@ -Subproject commit b3aef9f0c2d7c520056224581e18f0ac62971c55 +Subproject commit cd5e7f6c0017a515cd20db261a4dbe11ff4bd3f0 diff --git a/third_party/liteeth b/third_party/liteeth index 0eca508..fffcbcc 160000 --- a/third_party/liteeth +++ b/third_party/liteeth @@ -1 +1 @@ -Subproject commit 0eca5086c7b0d803a0aca2c4cfbaaa08e302661d +Subproject commit fffcbcc25e4a82f65685455346c0edf2e2763e69 diff --git a/third_party/litepcie b/third_party/litepcie index 029a578..922d525 160000 --- a/third_party/litepcie +++ b/third_party/litepcie @@ -1 +1 @@ -Subproject commit 029a5784b1bca7b52b63ec9df75b10e9c9873f6a +Subproject commit 922d5255a8509dd0a58b23bab589dfa4fbcec67f diff --git a/third_party/litesata b/third_party/litesata index 9cf5b98..3ed06e6 160000 --- a/third_party/litesata +++ b/third_party/litesata @@ -1 +1 @@ -Subproject commit 9cf5b980ce93c217f73c87f845b9ac0ae4920376 +Subproject commit 3ed06e6818e41335eac6cfa214f374a9e80e5cac diff --git a/third_party/litescope b/third_party/litescope index 3898771..1ed65f6 160000 --- a/third_party/litescope +++ b/third_party/litescope @@ -1 +1 @@ -Subproject commit 3898771a9d1cff274e30fdd81883bb43f837f853 +Subproject commit 1ed65f669a646df2387bce2b46cbfc68a13b2a2f diff --git a/third_party/litex b/third_party/litex index 6c2beee..54b1cf4 160000 --- a/third_party/litex +++ b/third_party/litex @@ -1 +1 @@ -Subproject commit 6c2beeec1df16edb48cbf1188ed869f41f167be7 +Subproject commit 54b1cf4d0eb15cb697e86d0568f1d8877329609c diff --git a/third_party/litex-boards b/third_party/litex-boards index a3b3816..9cd004e 160000 --- a/third_party/litex-boards +++ b/third_party/litex-boards @@ -1 +1 @@ -Subproject commit a3b38163e82c14348fdfbd2adbc0a26b96c70952 +Subproject commit 9cd004e3fe03aad26f8e84c426600538a52c123f diff --git a/third_party/migen b/third_party/migen index 6e3a9e1..147f003 160000 --- a/third_party/migen +++ b/third_party/migen @@ -1 +1 @@ -Subproject commit 6e3a9e150fb006dabc4b55043d3af18dbfecd7e8 +Subproject commit 147f003fb7076ac4c7cf76a9a5ce152dc10e0ca6 From ea041cd17b9d9db9d43d4c78e66995b2d0508050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 17 Oct 2025 11:39:53 +0200 Subject: [PATCH 2/2] add support for litesdcard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add support for litesdcard Signed-off-by: Fin Maaß --- .gitmodules | 3 +++ README.md | 2 ++ init | 2 +- make.py | 7 +++++++ soc_zephyr.py | 2 ++ third_party/litesdcard | 1 + 6 files changed, 16 insertions(+), 1 deletion(-) create mode 160000 third_party/litesdcard diff --git a/.gitmodules b/.gitmodules index 618242b..e29ec0b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,3 +52,6 @@ [submodule "third_party/litei2c"] path = third_party/litei2c url = https://github.com/litex-hub/litei2c +[submodule "third_party/litesdcard"] + path = third_party/litesdcard + url = https://github.com/enjoy-digital/litesdcard.git diff --git a/README.md b/README.md index 712932c..63cb7ca 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ Build options | --sys-clk-freq | System clock frequency | | --with_spi | Enable SPI | | --with_spi_flash | Enable SPI flash | +| --with-sdcard | Enable SD card via [LiteSDCard](https://github.com/enjoy-digital/litesdcard) | +| --sdcard-adapter | Select SD card PMOD adapter | | --with_i2c | Enable I2C (bitbang driver) | | --with_litei2c | Enable I2C via [LiteI2C](https://github.com/litex-hub/litei2c) | | --with_pwm | Enable PWM | diff --git a/init b/init index 3039d53..b9e63fd 100755 --- a/init +++ b/init @@ -1,7 +1,7 @@ export PATH="${PWD}/third_party/litex/litex/tools:$PATH" export PATH="${PWD}/tools/conda/bin:$PATH" -directories=(litedram liteeth litei2c liteiclink litepcie litespi litesata litescope litevideo litex litex-boards litex-renode migen nmigen pythondata-cpu-vexriscv pythondata-software-compiler_rt pythondata-software-picolibc) +directories=(litedram liteeth litei2c liteiclink litepcie litespi litesata litesdcard litescope litevideo litex litex-boards litex-renode migen nmigen pythondata-cpu-vexriscv pythondata-software-compiler_rt pythondata-software-picolibc) for directory in "${directories[@]}"; do diff --git a/make.py b/make.py index de516df..b0ed71b 100755 --- a/make.py +++ b/make.py @@ -84,6 +84,8 @@ def main(): parser.add_argument("--spi-data-width", type=int, default=8, help="SPI data width (maximum transfered bits per xfer, Arty target only)") parser.add_argument("--spi-clk-freq", type=int, default=1e6, help="SPI clock frequency (Arty target only)") parser.add_argument("--spi_flash_rate", default="1:1", help="SPI flash rate, can be 1:1 or 1:2 (Arty target only)") + parser.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.") + parser.add_argument("--sdcard-adapter", default="digilent", help="SDCard PMOD adapter (digilent or numato).") parser.add_argument("--with_mmcm", action="store_true", help="Enable mmcm (Arty target only)") parser.add_argument("--with_watchdog", action="store_true", help="Enable watchdog") parser.add_argument("--watchdog_width", type=int, default=32, help="Watchdog width") @@ -106,6 +108,7 @@ def main(): args.with_pwm = True args.with_mmcm = True args.with_watchdog = True + args.with_sdcard = True if args.board == "all": board_names = list(supported_boards.keys()) @@ -163,6 +166,10 @@ def main(): print("Adding mmcm implicitly, cause i2s core needs special clk signals") soc.add_mmcm(board.mmcm_freq) soc.add_i2s() + if args.with_sdcard: + from litex_boards.platforms import digilent_arty + soc.platform.add_extension(digilent_arty._numato_sdcard_pmod_io if args.sdcard_adapter == "numato" else digilent_arty._sdcard_pmod_io) + soc.add_sdcard() build_dir = os.path.join("build", board.bitstream_name) diff --git a/soc_zephyr.py b/soc_zephyr.py index 501dcf3..4bf5127 100644 --- a/soc_zephyr.py +++ b/soc_zephyr.py @@ -51,12 +51,14 @@ class _SoCZephyr(soc_cls): "spiflash": 24, # addr: 0xe000c000 "watchdog0": 26, # addr: 0xe000d000 "litei2c": 27, # addr: 0xe000d800 + "sdcard": 29, # addr: 0xe000e000 }} interrupt_map = {**soc_cls.interrupt_map, **{ "timer0": 1, "uart": 2, "ethmac": 3, + "sdcard": 5, "i2s_rx": 6, "i2s_tx": 7, "watchdog0": 8, diff --git a/third_party/litesdcard b/third_party/litesdcard new file mode 160000 index 0000000..fba767b --- /dev/null +++ b/third_party/litesdcard @@ -0,0 +1 @@ +Subproject commit fba767b99237ef762f313a22fb431e7817727bd8