1
0
mirror of https://github.com/marqs85/ossc.git synced 2024-11-16 15:10:55 +00:00
Open Source Scan Converter
Go to file
2023-10-29 17:27:10 +02:00
ip add support for shadow masks (up to 4x4) 2023-09-22 22:34:35 +03:00
rtl restore original test pattern 2023-10-24 00:19:46 +03:00
scripts update programming files / scripts 2023-03-11 12:36:18 +02:00
software increase video mode name length to fit null terminator 2023-10-29 17:27:10 +02:00
tools Set fast output on HDMI_TX pins. 2020-06-14 09:54:06 +00:00
.gitignore update project configuration and IP files 2023-02-13 18:55:14 +02:00
.gitmodules
CREDITS
LICENSE
ossc_rtl.project misc tool updates 2020-04-28 18:48:35 +03:00
ossc_sw_bsp.project update epcq_controller_mod to epcq_controller2 2020-11-10 19:46:07 +02:00
ossc.cof update programming files / scripts 2023-03-11 12:36:18 +02:00
ossc.qpf
ossc.qsf restore original test pattern 2023-10-24 00:19:46 +03:00
ossc.sdc add support for v1.8 PCBs 2023-08-05 22:41:58 +03:00
ossc.workspace integrate new tvp7002 frontend 2023-01-31 20:51:06 +02:00
README.md
sys.qsys fix lockup issue due to counter reaching max value 2023-09-19 22:39:21 +03:00
sys.sopcinfo fix lockup issue due to counter reaching max value 2023-09-19 22:39:21 +03:00
tools.project misc tool updates 2020-04-28 18:48:35 +03:00

Open Source Scan Converter

Open Source Scan Converter is a low-latency video digitizer and scan conversion board designed mainly for connecting retro video game consoles and home computers into modern displays. Please check the wikipage for more detailed description and latest features.

Requirements for building and debugging firmware

  • Hardware

    • OSSC board
    • USB Blaster compatible JTAG debugger, e.g. Terasic Blaster (for FW installation and debugging)
    • micro SD/SDHC card (for FW update via SD card)
  • Software

Architecture

SW toolchain build procedure

  1. Download, configure, build and install RISC-V toolchain with Newlib + RV32EMC support:
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
./configure --prefix=/opt/riscv --with-arch=rv32emc --with-abi=ilp32e
sudo make    # sudo needed if installing under default /opt/riscv location
  1. Compile custom binary to IHEX converter:
gcc tools/bin2hex.c -o tools/bin2hex

Building RTL (bitstream)

  1. Initialize pulpino submodules (once after cloning ossc project or when submoduled have been updated)
git submodule update --init --recursive ip/pulpino_qsys
  1. Load the project (ossc.qpf) in Quartus
  2. Generate QSYS output files (only needed before first compilation or when QSYS structure has been modified)
    • Open Platform Designer (Tools -> Platform Designer)
    • Load platform configuration (sys.qsys)
    • Generate output (Generate -> Generate HDL, Generate)
    • Close Platform Designer
    • Run "touch software/sys_controller_bsp/bsp_timestamp" to acknowledge QSYS update
  3. Generate the FPGA bitstream (Processing -> Start Compilation)
  4. Ensure that there are no severe timing violations by looking into Timing Analyzer report

NOTE: If the software image (software/sys_controller/mem_init/sys_onchip_memory2_0.hex) was not up to date at the time of compilation, bitstream can be quickly rebuilt with updated hex by running "Processing->Update Memory Initialization File" and "Processing->Start->Start Assembler" in Quartus.

Building software image

  1. Enter software root directory:
cd software/sys_controller
  1. Build SW for target configuration:
make [OPTIONS] [TARGET]

OPTIONS may include following definitions:

  • OSDLANG=JP (Japanese language menu)
  • ENABLE_AUDIO=y (Includes audio setup code for v1.6 PCB / DIY audio add-on board)

TARGET is typically one of the following:

  • all (Default target. Compiles an ELF file)
  • generate_hex (Generates a memory initialization file required for bitstream and direct download)
  • clean (cleans ELF and intermediate files. Should be invoked every time OPTIONS are changed between compilations, expect with generate_hex where it is done automatically)
  1. Optionally test updated SW by directly downloading memory image to block RAM via JTAG
make rv-reprogram

Installing firmware via JTAG

The bitstream can be either directly programmed into FPGA (volatile method, suitable for quick testing), or into serial flash chip where it is automatically loaded every time FPGA is subsequently powered on (nonvolatile method, suitable for long-term use).

To program FPGA, open Programmer in Quartus, select your USB Blaster device, add configuration file (output_files/ossc.sof) and press Start

To program flash, FPGA configuration file must be first converted into JTAG indirect Configuration file (.jic). Open conversion tool ("File->Convert Programming Files") in Quartus, click "Open Conversion Setup Data", select "ossc.cof" and press Generate. Then open Programmer, add generated file (output_files/ossc.jic) and press Start after which flash is programmed. Installed/updated firmware is activated after power-cycling the board.

Generating SD card image

Bitstream file (Altera propiertary format) must be wrapped with custom header structure (including checksums) so that it can be processed reliably on the CPU. This can be done with included helper application which generates a disk image which can written to a SD card and subsequently loaded on OSSC:

  1. Compile tools/create_fw_img.c
cd tools && gcc create_fw_img.c -o create_fw_img
  1. Generate the firmware image:
./create_fw_img <rbf> <version> [version_suffix]

where

  • <rbf> is RBF format bitstream file (typically ../output_files/ossc.rbf)
  • <version> is version string (e.g. 0.78)
  • version_suffix

Debugging

  1. Rebuild the software in debug mode:
make clean && make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex

NOTE: Fw update functionality via SD card is disabled in debug builds due to code space limitations. If audio support is enabled on debug build, other functionality needs to be disabled as well.

  1. Download memory image via JTAG and open terminal for UART
make rv-reprogram && nios2-terminal

Remember to close nios2-terminal after debug session, otherwise any JTAG transactions will hang/fail.