Permalink
Browse files

Merge pull request #249 from mithro/shenki-minispartan6+

This pull request adds basic support for the minispartan6+ board. The following features work;
 * BaseSoC with support for;
   * SDRAM
   * SPI Flash
   * Serial UART
   * Loading firmware from SPI flash (as FPGA doesn't have enough blockram for embedded ROM).
 * VideoMixerSoC with support for;
  * HDMI Output on J3
  * Potentially HDMI input, but no way to test.
  * It does **not** currently support both HDMI input and output at the same time. See #255 for the reasons.

This support is pretty comparable to the current pipistrello support and should be enough for some basic development and testing.
  • Loading branch information...
mithro committed Apr 17, 2016
2 parents 54d888a + 454f688 commit b50566518c649eec8f79c1b9e4ceecaa5dbf08a9
@@ -13,6 +13,10 @@
[submodule "third_party/litescope"]
path = third_party/litescope
url = https://github.com/enjoy-digital/litescope.git
[submodule "third_party/liteusb"]
path = third_party/liteusb
url = https://github.com/enjoy-digital/liteusb.git
branch = legacy
[submodule "third_party/flash_proxies"]
path = third_party/flash_proxies
url = https://github.com/jordens/bscan_spi_bitstreams
@@ -29,6 +29,8 @@ env:
- BOARD=opsis TARGET=video
- BOARD=opsis TARGET=hdmi2usb
- BOARD=pipistrello TARGET=base
- BOARD=minispartan6 TARGET=base
- BOARD=minispartan6 TARGET=video

install:
- $PWD/.travis/setup.sh
@@ -6,18 +6,30 @@ endif
endif

# Turn off Python's hash randomization
export PYTHONHASHSEED=0
PYTHONHASHSEED := 0
export PYTHONHASHSEED

# Default board
BOARD ?= atlys
MSCDIR ?= third_party/misoc
ifneq ($(BOARD),pipistrello)
PROG ?= openocd
export BOARD
# Default targets for a given board
ifeq ($(BOARD),pipistrello)
TARGET ?= base
else ifeq ($(BOARD),minispartan6)
TARGET ?= video
else
TARGET ?= hdmi2usb
endif
TARGET ?= hdmi2usb
FILTER ?= tee
export TARGET
# Default programmer
PROG ?= openocd
ifneq ($(PROG),)
PROGRAMMER_OPTION ?= --platform-option programmer $(PROG)
endif

FILTER ?= tee

MSCDIR ?= third_party/misoc
HDMI2USBDIR = $(realpath .)
PYTHON = python3
DATE = `date +%Y_%m_%d`
@@ -14,16 +14,23 @@

TARGETS += lm32

RAM_ADDR ?= 0x20000000

ifeq ($(BOARD),atlys)
SERIAL ?= /dev/ttyVIZ0
else
ifeq ($(BOARD),minispartan6)
SERIAL ?= /dev/ttyUSB1
RAM_ADDR = 0x40000000
else
ifeq ($(BOARD),pipistrello)
SERIAL ?= /dev/ttyUSB1
else
# Opsis fall through
SERIAL ?= /dev/ttyACM0
endif
endif
endif

help-lm32:
@echo " Set lm32 serial port with SERIAL=/dev/ttyXXXX"
@@ -51,7 +58,7 @@ firmware-lm32: third_party/misoc/.git $(EXTRA_DEPS)
load-lm32: firmware-lm32
@echo "To load new firmware, reboot the running firmware and then"
@echo "select serialboot at the BIOS prompt."
$(FLTERM) --port $(SERIAL) --kernel=$(HDMI2USBDIR)/firmware/lm32/firmware.bin --kernel-adr=0x20000000 --speed 115200
$(FLTERM) --port $(SERIAL) --kernel=$(HDMI2USBDIR)/firmware/lm32/firmware.bin --kernel-adr=$(RAM_ADDR) --speed 115200

image-lm32: firmware-lm32
$(MAKEIMAGE_CMD) --fbi --output $(HDMI2USBDIR)/firmware/lm32/firmware.fbi $(HDMI2USBDIR)/firmware/lm32/firmware.bin
@@ -2,7 +2,17 @@
MSCDIR=../../third_party/misoc
include $(MSCDIR)/software/common.mak

CFLAGS += -Wno-unused-function
ifeq ($(BOARD),)
$(error BOARD not defined.)
endif
UBOARD = $(shell echo $(BOARD) | tr a-z A-Z)

ifeq ($(TARGET),)
$(error TARGET not defined.)
endif
UTARGET = $(shell echo $(TARGET) | tr a-z A-Z)

CFLAGS += -Wno-unused-function -DBOARD_$(UBOARD) -DTARGET_$(UTARGET)

OBJECTS=isr.o \
processor.o \
@@ -657,9 +657,16 @@ void ci_service(void)
debug_input(3, 3, 3);
else if(strcmp(token, "off") == 0)
debug_input(3, 3, 0);
else if(strcmp(token, "?") != 0)
debug_input(3, 3, (hdmi_in0_debug ? 0 : 1) | (hdmi_in1_debug ? 0 : 2));
else
else if(strcmp(token, "?") != 0) {
unsigned int state = 0;
#if defined(CSR_HDMI_IN0_BASE)
state |= (hdmi_in0_debug ? 0 : 1);
#endif
#if defined(CSR_HDMI_IN1_BASE)
state |= (hdmi_in1_debug ? 0 : 2);
#endif
debug_input(3, 3, state);
} else
debug_input(3, 0, 0);
}
else if(strcmp(token, "on") == 0)
@@ -11,7 +11,11 @@ enum {
CONFIG_KEY_COUNT
};

#ifdef BOARD_MINISPARTAN6
#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
#else
#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }
#endif

void config_init(void);
void config_write_all(void);
@@ -20,7 +20,7 @@ int hdmi_in0_fb_index;
#define FRAMEBUFFER_COUNT 4
#define FRAMEBUFFER_MASK (FRAMEBUFFER_COUNT - 1)

#define HDMI_IN0_FRAMEBUFFERS_BASE 0x00000000
#define HDMI_IN0_FRAMEBUFFERS_BASE 0x01000000
#define HDMI_IN0_FRAMEBUFFERS_SIZE 1920*1080*2

//#define CLEAN_COMMUTATION
@@ -390,4 +390,4 @@ void hdmi_in0_service(void)
hdmi_in0_check_overflow();
}

#endif
#endif
@@ -20,7 +20,7 @@ int hdmi_in1_fb_index;
#define FRAMEBUFFER_COUNT 4
#define FRAMEBUFFER_MASK (FRAMEBUFFER_COUNT - 1)

#define HDMI_IN1_FRAMEBUFFERS_BASE 0x01000000
#define HDMI_IN1_FRAMEBUFFERS_BASE 0x02000000
#define HDMI_IN1_FRAMEBUFFERS_SIZE 1920*1080*2

//#define CLEAN_COMMUTATION
@@ -391,4 +391,4 @@ void hdmi_in1_service(void)
hdmi_in1_check_overflow();
}

#endif
#endif
@@ -10,7 +10,7 @@
#include "pattern.h"
#include "processor.h"

#define PATTERN_FRAMEBUFFER_BASE 0x02000000
#define PATTERN_FRAMEBUFFER_BASE 0x03000000

unsigned int pattern_framebuffer_base(void) {
return PATTERN_FRAMEBUFFER_BASE;
@@ -171,7 +171,10 @@ def __init__(self, word_width, fifo_depth):
self.comb += encoded_pixel.eq(Cat(chroma_downsampler.source.y, chroma_downsampler.source.cb_cr)),
pack_factor = word_width//16
assert(pack_factor & (pack_factor - 1) == 0) # only support powers of 2
pack_counter = Signal(max=pack_factor)
if pack_factor == 1:
pack_counter = Signal(reset=0)
else:
pack_counter = Signal(max=pack_factor)
self.sync.pix += [
cur_word_valid.eq(0),
If(new_frame,
@@ -34,10 +34,16 @@ def __init__(self, pack_factor):
self.busy.eq(0)
]

unpack_counter = Signal(max=pack_factor)
if pack_factor == 1:
unpack_counter = Signal(reset=0)
else:
unpack_counter = Signal(max=pack_factor)
self.sync.pix += [
unpack_counter.eq(unpack_counter + 1),
]

assert(pack_factor & (pack_factor - 1) == 0) # only support powers of 2
self.sync.pix += [
unpack_counter.eq(unpack_counter + 1),
self.pix_hsync.eq(fifo.dout.hsync),
self.pix_vsync.eq(fifo.dout.vsync),
self.pix_de.eq(fifo.dout.de)
Oops, something went wrong.

0 comments on commit b505665

Please sign in to comment.