| # Makefile for building the tock kernel for the OpenTitan Matcha platform |
| |
| DEFAULT_BOARD_CONFIGURATION=fpga_nexysvideo |
| TARGET=riscv32imc-unknown-none-elf |
| PLATFORM=opentitan-matcha |
| FLASHID=--dev-id="0403:6010" |
| RISC_PREFIX = riscv64-elf |
| |
| |
| include Makefile.common |
| |
| # Pass OpenTitan board configuration option in `BOARD_CONFIGURATION` through |
| # Cargo `--features`. Please see `Cargo.toml` for available options. |
| ifneq ($(BOARD_CONFIGURATION),) |
| CARGO_FLAGS += --features=$(BOARD_CONFIGURATION) |
| else |
| CARGO_FLAGS += --features=$(DEFAULT_BOARD_CONFIGURATION) |
| endif |
| |
| qemu: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf |
| $(call check_defined, OPENTITAN_BOOT_ROM) |
| qemu-system-riscv32 -M opentitan -kernel $^ -bios $(OPENTITAN_BOOT_ROM) -nographic -serial mon:stdio |
| |
| qemu-app: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf |
| $(call check_defined, OPENTITAN_BOOT_ROM) |
| qemu-system-riscv32 -M opentitan -kernel $^ -bios $(OPENTITAN_BOOT_ROM) -device loader,file=$(APP),addr=0x20030000 -nographic -serial mon:stdio |
| |
| flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin |
| $(OPENTITAN_TREE)/build-out/sw/host/spiflash/spiflash $(FLASHID) --input=$(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin |
| |
| flash-app: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf |
| $(RISC_PREFIX)-objcopy --update-section .apps=$(APP) $^ $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM)-app.elf |
| $(RISC_PREFIX)-objcopy --output-target=binary $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM)-app.elf $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM)-app.bin |
| $(OPENTITAN_TREE)/build-out/sw/host/spiflash/spiflash $(FLASHID) --input=$(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM)-app.bin |