From 09db972c16bf65ad83cf81236b1b830770f99a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Tue, 9 Jul 2024 13:20:55 +0100 Subject: [PATCH] fix(dma): Add dma_demo makefile target. Add macro for dma_demo. To run DMA demo, type: make dma-demo --- .github/workflows/ci.yml | 17 ++++++++++++++--- Makefile | 10 ++++++++++ iob_soc_opencryptolinux.py | 11 +++++++++++ software/src/iob_soc_opencryptolinux_firmware.c | 10 +++++----- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6417e4be..35e3be73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,8 +100,6 @@ jobs: run: make fpga-run RUN_LINUX=0 BOARD=CYCLONEV-GT-DK - name: test linux run: make test-linux-fpga-connect BOARD=CYCLONEV-GT-DK - - name: test dma - run: make dma-linux-fpga-connect BOARD=CYCLONEV-GT-DK aes-ku040: runs-on: self-hosted @@ -119,8 +117,21 @@ jobs: run: make fpga-run RUN_LINUX=0 BOARD=AES-KU040-DB-G - name: test linux run: make test-linux-fpga-connect BOARD=AES-KU040-DB-G + + dma_demo: + runs-on: self-hosted + timeout-minutes: 90 + # run even if previous job failed + if: ${{ !cancelled() }} + # run after indicated job + needs: [ aes-ku040 ] + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' - name: test dma - run: make dma-linux-fpga-connect BOARD=AES-KU040-DB-G + run: make dma-demo ## doc: ## runs-on: self-hosted diff --git a/Makefile b/Makefile index 20f34655..fe8cf4ff 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,16 @@ dma-linux-fpga-connect: build_dir_name .PHONY: setup sim-run sim-test fpga-test test-all test-linux-fpga-connect dma-linux-fpga-connect +# Run this target to configure system for a DMA data transfer demo in linux and run it on a FPGA. +dma-demo: + # Try to setup, so that it generates correct linux_build_macros.txt (ignore errors as well) + -make setup DMA_DEMO=1 + make build-linux-files DMA_DEMO=1 + make fpga-run RUN_LINUX=0 DMA_DEMO=1 + make dma-linux-fpga-connect + +.PHONY: dma-demo + # # Linux targets # diff --git a/iob_soc_opencryptolinux.py b/iob_soc_opencryptolinux.py index c39a7b52..e3968865 100755 --- a/iob_soc_opencryptolinux.py +++ b/iob_soc_opencryptolinux.py @@ -357,6 +357,17 @@ def _post_setup(cls): @classmethod def _setup_confs(cls, extra_confs=[]): + if DMA_DEMO: + extra_confs += [ + { + "name": "DMA_DEMO", + "type": "M", + "val": True, + "min": "0", + "max": "1", + "descr": "Enable DMA demo", + }, + ] # Append confs or override them if they exist super()._setup_confs( [ diff --git a/software/src/iob_soc_opencryptolinux_firmware.c b/software/src/iob_soc_opencryptolinux_firmware.c index d0f1a0c4..753278d6 100644 --- a/software/src/iob_soc_opencryptolinux_firmware.c +++ b/software/src/iob_soc_opencryptolinux_firmware.c @@ -11,7 +11,7 @@ #include "plic.h" #include "printf.h" #include -#ifdef DMA_DEMO +#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO #include "iob-dma.h" #include "iob-axistream-in.h" #include "iob-axistream-out.h" @@ -123,7 +123,7 @@ int main() { eth_init(ETH0_BASE, &clear_cache); eth_wait_phy_rst(); -#ifdef DMA_DEMO +#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO // init dma dma_init(DMA0_BASE); // init axistream @@ -145,7 +145,7 @@ int main() { printf("\n\n\nHello world!\n\n\n"); -#ifdef DMA_DEMO +#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO send_axistream(); receive_axistream(); #endif @@ -368,7 +368,7 @@ static void irq_entry(void) { #pragma GCC pop_options -#ifdef DMA_DEMO +#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO void send_axistream() { uint8_t i; uint8_t words_in_byte_stream = 4; @@ -419,4 +419,4 @@ void receive_axistream() { free((uint32_t *)byte_stream); } -#endif // DMA_DEMO +#endif // IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO