Skip to content

Commit e97e06d

Browse files
committed
add support for litesdcard
add support for litesdcard Signed-off-by: Fin Maaß <[email protected]>
1 parent 7a6abfb commit e97e06d

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@
5252
[submodule "third_party/litei2c"]
5353
path = third_party/litei2c
5454
url = https://github.com/litex-hub/litei2c
55+
[submodule "third_party/litesdcard"]
56+
path = third_party/litesdcard
57+
url = https://github.com/enjoy-digital/litesdcard.git

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Build options
6363
| --sys-clk-freq | System clock frequency |
6464
| --with_spi | Enable SPI |
6565
| --with_spi_flash | Enable SPI flash |
66+
| --with-sdcard | Enable SD card via [LiteSDCard](https://github.com/enjoy-digital/litesdcard) |
67+
| --sdcard-adapter | Select SD card PMOD adapter |
6668
| --with_i2c | Enable I2C (bitbang driver) |
6769
| --with_litei2c | Enable I2C via [LiteI2C](https://github.com/litex-hub/litei2c) |
6870
| --with_pwm | Enable PWM |

init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export PATH="${PWD}/third_party/litex/litex/tools:$PATH"
22
export PATH="${PWD}/tools/conda/bin:$PATH"
33

4-
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)
4+
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)
55

66
for directory in "${directories[@]}";
77
do

make.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def main():
8484
parser.add_argument("--spi-data-width", type=int, default=8, help="SPI data width (maximum transfered bits per xfer, Arty target only)")
8585
parser.add_argument("--spi-clk-freq", type=int, default=1e6, help="SPI clock frequency (Arty target only)")
8686
parser.add_argument("--spi_flash_rate", default="1:1", help="SPI flash rate, can be 1:1 or 1:2 (Arty target only)")
87+
parser.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
88+
parser.add_argument("--sdcard-adapter", default="digilent", help="SDCard PMOD adapter (digilent or numato).")
8789
parser.add_argument("--with_mmcm", action="store_true", help="Enable mmcm (Arty target only)")
8890
parser.add_argument("--with_watchdog", action="store_true", help="Enable watchdog")
8991
parser.add_argument("--watchdog_width", type=int, default=32, help="Watchdog width")
@@ -106,6 +108,7 @@ def main():
106108
args.with_pwm = True
107109
args.with_mmcm = True
108110
args.with_watchdog = True
111+
args.with_sdcard = True
109112

110113
if args.board == "all":
111114
board_names = list(supported_boards.keys())
@@ -163,6 +166,10 @@ def main():
163166
print("Adding mmcm implicitly, cause i2s core needs special clk signals")
164167
soc.add_mmcm(board.mmcm_freq)
165168
soc.add_i2s()
169+
if args.with_sdcard:
170+
from litex_boards.platforms import digilent_arty
171+
soc.platform.add_extension(digilent_arty._numato_sdcard_pmod_io if args.sdcard_adapter == "numato" else digilent_arty._sdcard_pmod_io)
172+
soc.add_sdcard()
166173

167174
build_dir = os.path.join("build", board.bitstream_name)
168175

soc_zephyr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ class _SoCZephyr(soc_cls):
5252
"spiflash": 24, # addr: 0xe000c000
5353
"watchdog0": 26, # addr: 0xe000d000
5454
"litei2c": 27, # addr: 0xe000d800
55+
"sdcard": 29, # addr: 0xe000e000
5556
}}
5657

5758
interrupt_map = {**soc_cls.interrupt_map, **{
5859
"timer0": 1,
5960
"uart": 2,
6061
"ethmac": 3,
62+
"sdcard": 4,
6163
"i2s_rx": 6,
6264
"i2s_tx": 7,
6365
"watchdog0": 8,

third_party/litesdcard

Submodule litesdcard added at fba767b

0 commit comments

Comments
 (0)