Browse Source

Merged, yet not integrated ...

master
kaqu 3 months ago
parent
commit
b1eed8126e
9 changed files with 39 additions and 14 deletions
  1. BIN
      libmodules/__pycache__/dramtransfer.cpython-38.pyc
  2. BIN
      libmodules/__pycache__/systime.cpython-38.pyc
  3. +0
    -0
      libmodules/dramtransfer.py
  4. +0
    -0
      libmodules/systime.py
  5. +16
    -4
      neopixelar.py
  6. +1
    -1
      software/include/dramtransfer.h
  7. +8
    -5
      software/ramcreate.sh
  8. +1
    -1
      software/source/illumination.c
  9. +13
    -3
      software/source/main.c

BIN
libmodules/__pycache__/dramtransfer.cpython-38.pyc View File


BIN
libmodules/__pycache__/systime.cpython-38.pyc View File


modules/dramtransfer.py → libmodules/dramtransfer.py View File


modules/systime.py → libmodules/systime.py View File


+ 16
- 4
neopixelar.py View File

@ -56,9 +56,11 @@ from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import *
from litex.soc.interconnect.csr import AutoCSR, CSRStatus, CSRStorage, CSRField
from litex.soc.interconnect.stream import SyncFIFO
from litedram.modules import M12L16161A, M12L64322A
from litedram.phy import GENSDRPHY, HalfRateGENSDRPHY
from litedram.frontend.dma import LiteDRAMDMAReader, LiteDRAMDMAWriter
from liteeth.phy.ecp5rgmii import LiteEthPHYRGMII
@ -67,8 +69,8 @@ from litex.build.generic_platform import *
import litex.soc.doc as lxsocdoc
# KQ's helper modules ...
from modules.systime import SysTime
from modules.dramtransfer import DRAMTransfer
from libmodules.systime import SysTime
from libmodules.dramtransfer import DRAMTransfer
from neopixelengine import NeoPixelEngine
@ -387,9 +389,19 @@ class BaseSoC(SoCCore):
self.submodules.systime = systime = SysTime(comparecount=0x0000EA90)
self.add_csr("systime")
# DRAM test
MAXWORDS = 32 # Transfer length x 32-bit, FIFO depth
self.submodules.mm2s = mm2s = LiteDRAMDMAReader(self.sdram.crossbar.get_port(), fifo_depth=MAXWORDS, fifo_buffered=True)
mm2s.add_csr()
self.add_csr("mm2s")
self.submodules.sync_fifo = sync_fifo = SyncFIFO([("data", 32)], MAXWORDS, True)
self.comb += mm2s.source.connect(sync_fifo.sink) # Connect DMA-Reader.source -> FIFO.sink
self.submodules.dramtransfer = DRAMTransfer(maxwords=MAXWORDS, dma_reader=mm2s, sync_fifo=sync_fifo)
self.add_csr("dramtransfer")
# Adjust no. for your actual project ...
max_TABLES = 3 # 1..16
max_LEDS_per_chain = 27 # 1..256
max_TABLES = 2 # 1..16
max_LEDS_per_chain = MAXWORDS # 1..256
self.submodules.npe = NeoPixelEngine(n_TABLES=max_TABLES, n_LEDs=max_LEDS_per_chain)
self.add_csr("npe")
for i in range(42,56+2): # Example: Do output on J4 (14) & J5 (2)


+ 1
- 1
software/include/dramtransfer.h View File

@ -9,7 +9,7 @@
// 29.12.20/KQ Initial version
//
#define FIFOSIZE 256 //128, 8
#define FIFOSIZE 32 // 256
#define TIMEOUT 100
extern int load_FPGA(uint32_t iBaseAddress, int8_t bLen);
extern int32_t retrieve_FPGA(int iOffset);


+ 8
- 5
software/ramcreate.sh View File

@ -20,10 +20,7 @@ echo "Creating $PROJECTNAME application ..."
# Additional user libs, not project specific
LIBSYSTIME="systime"
LIBPRINTF="my_vsnprintf"
# Additional user libs, not project specific
LIBSYSTIME="systime"
LIBPRINTF="my_vsnprintf"
LIBDRAMTRANSFER="dramtransfer"
# Adjust these paths according to your local installation !!!
MY_LOCAL_LITEX_PATH=$HOME"/fpga/litex"
@ -91,9 +88,15 @@ then
echo "*** gcc for $LIBSYSTIME.c failed!"
exit $?
fi
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc -c $COMMONFLAGS $CFLAGS -Wa,-fPIC source/$LIBDRAMTRANSFER.c -o build/$LIBDRAMTRANSFER.o
if [ $? -ne 0 ];
then
echo "*** gcc for $LIBDRAMTRANSFER.c failed!"
exit $?
fi
echo "Linking ..."
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ld $LDFLAGS -T linker/ram$3.ld -N $CRT0 $OBJECTS $LXR build/$2.o build/$1.o build/$LIBSYSTIME.o build/$LIBPRINTF.o lib/rv32ilibm.a lib/rv32ilibgcc.a -o build/$1.elf
$MY_LOCAL_LITEX_PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ld $LDFLAGS -T linker/ram$3.ld -N $CRT0 $OBJECTS $LXR build/$2.o build/$1.o build/$LIBSYSTIME.o build/$LIBPRINTF.o build/$LIBDRAMTRANSFER.o lib/rv32ilibm.a lib/rv32ilibgcc.a -o build/$1.elf
if [ $? -ne 0 ];
then
echo "*** Link/Loader for build/$1.elf failed!"


+ 1
- 1
software/source/illumination.c View File

@ -105,7 +105,7 @@ int illumination(void)
int32_t blue = 0x000004;
int iTable;
printf("Illumination demo starting ...\n");
printf("----- Illumination demo -----\n");
// Prepare first output
iTable = 0;
load_triple_LEDs(iTable, green, red, blue); // 1st load


+ 13
- 3
software/source/main.c View File

@ -42,6 +42,7 @@
#include <liblitesdcard/sdcard.h>
#include "../include/systime.h"
#include "../include/dramtransfer.h"
#include "../include/illumination.h"
extern void busy_wait(unsigned int ms); // Worx!
@ -71,6 +72,8 @@ int main(int i, char **c)
irq_setmask(0);
irq_setie(1);
#endif
setsystime(14, 30, 00); // Reset to defined value (14:30) ...
// Prepare first output
int32_t green = 0x040201;
int32_t red = 0x010402;
@ -107,9 +110,11 @@ int main(int i, char **c)
printf("\e[1mExecuting within RAM ...\e[0m\n");
printf("Press [w] slower, [s] faster, [x] to exit demo!\n");
while(1)
while(1) {
dramtest(); // Test ...
if(illumination()) // The DEMO !
break;
}
*statept = get_console(); // Make sure, we know what was going on ...
#ifdef FLOAT_TEST
@ -130,8 +135,12 @@ int main(int i, char **c)
float f3add = f1 + f2;
printf1("1.5+3.5 => %8.5f\n", f3add);
#endif
while(1) {
printf("\n%s", PROMPT);
int hh, mm, ss;
while(1) {
getsystime(&hh, &mm, &ss);
printf("\n%02d:%02d:%02d %s", hh, mm, ss, PROMPT);
readline(buffer, CMD_LINE_BUFFER_SIZE);
if (buffer[0] != 0) {
printf("\n");
@ -139,6 +148,7 @@ int main(int i, char **c)
cmd = command_dispatcher(command, nb_params, params);
if (!cmd) {
printf("Command not found?! Executing illumination demo instead ...\n");
dramtest(); // Test ...
illumination(); // more DEMO ...
}
}


Loading…
Cancel
Save