Go to file
2025-12-21 15:10:25 +02:00
ip add Line2x pillarbox option 2025-10-30 21:59:09 +02:00
rtl add Line2x pillarbox option 2025-10-30 21:59:09 +02:00
scripts integrate userdata structure from Ossc Pro 2025-08-27 18:27:19 +03:00
software misc bug fixes 2025-12-21 14:44:12 +02:00
tools fix firmware update functionality 2025-05-03 16:14:58 +03:00
.gitignore update gitignore 2025-04-19 12:10:29 +03:00
.gitmodules first version booting from flash 2025-03-26 23:30:42 +02:00
CREDITS add a list of contributors 2018-05-05 11:29:07 +03:00
LICENSE Initial public release (FW 0.64) 2016-02-23 01:03:50 +02:00
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 integrate userdata structure from Ossc Pro 2025-08-27 18:27:19 +03:00
ossc.qpf Initial public release (FW 0.64) 2016-02-23 01:03:50 +02:00
ossc.qsf fix firmware update functionality 2025-05-03 16:14:58 +03:00
ossc.sdc restore latency tester feature 2025-10-11 00:07:11 +03:00
ossc.workspace integrate new tvp7002 frontend 2023-01-31 20:51:06 +02:00
README.md update README 2025-12-21 15:10:25 +02:00
sys.qsys add support for secondary FW 2025-09-06 13:46:20 +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

Architecture

SW toolchain build procedure

  1. Download, configure, build and install RISC-V toolchain (with RV32EMC support) and Picolibc.

From sources:

git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
git clone --recursive https://github.com/picolibc/picolibc
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

On Debian-style Linux distros:

sudo apt install gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf picolibc-riscv64-unknown-elf
  1. Compile custom binary to IHEX converter:
gcc tools/bin2hex.c -o tools/bin2hex

Building RTL (bitstream)

  1. Initialize project submodules (once after cloning ossc project or when submoduled have been updated)
git submodule update --init --recursive
  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 "patch -p0 <scripts/qsys.patch" to patch generated files to optimize block RAM usage
    • 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 timing violations by looking into Timing Analyzer report

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)

TARGET is typically one of the following:

  • all (Default target. Compiles an ELF file)
  • 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 SW image to flash via JTAG (requires valid FPGA bitstream to be present):
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 alongside SW image where it is automatically loaded every time FPGA is subsequently powered on (nonvolatile method, suitable for long-term use).

To directly program FPGA, open Programmer in Quartus, select your USB Blaster device, add configuration file (output_files/ossc.sof) and press Start. Download SW image if it not present / up to date in flash.

To program flash, a combined FPGA image must be first generated and 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 and ensure that "Initiate configuration after programming" and "Unprotect EPCS/EPCQ devices selected for Erase/Program operation" are checked in Tools->Options. Then clear file list, add generated file (output_files/ossc.jic) and press Start after which flash is programmed. Installed/updated firmware is activated when programming finishes (or after power-cycling the board in case of a fresh flash chip).

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 an image file which can written on FAT32/exFAT-formatted 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> <sw_image> <offset> <version> [version_suffix]

where

  • <rbf> is RBF format bitstream file (typically ../output_files/ossc.rbf)
  • <sw_image> is SW image binary (typically ../output_files/ossc.rbf)
  • <offset> is target offset for the SW image binary (typically 0x50000)
  • <version> is version string (e.g. 1.20)
  • version_suffix

The command creates ossc_<version>-<version_suffix>.bin which can be copied to fw folder of SD card. A secondary FW (identified by specific key in header) gets automatically installed at flash address 0x00080000.

Debugging

  1. Rebuild the software in debug mode:
make clean && make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG"
  1. Flash SW 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.

License

GPL3