Compare commits

..

7 Commits

Author SHA1 Message Date
marqs
429b0f7201 update README 2025-03-09 23:07:56 +02:00
marqs
fe3c6fdfa7 add Full VSYNC bypas option 2025-03-01 11:23:24 +02:00
marqs
2725351039 change compiler and libc to optimize size 2025-01-23 20:01:10 +02:00
marqs
9af171947a add missing include 2025-01-23 19:24:15 +02:00
marqs
0c8b85d3f2 restore lower default PLL BW for better compatibility 2025-01-23 00:04:32 +02:00
marqs
fae76ac3e4 add Lumacode support for Atari GTIA & VCS 2025-01-23 00:03:47 +02:00
marqs
e2f4350ab1 fix HDR infoframe repetition 2025-01-16 23:57:50 +02:00
19 changed files with 201 additions and 118 deletions

View File

@ -13,6 +13,7 @@ Requirements for building and debugging firmware
* Software * Software
* [Altera Quartus II + Cyclone IV support](http://dl.altera.com/?edition=lite) (v 16.1 or higher - free Lite Edition suffices) * [Altera Quartus II + Cyclone IV support](http://dl.altera.com/?edition=lite) (v 16.1 or higher - free Lite Edition suffices)
* [RISC-V GNU Compiler Toolchain](https://github.com/riscv/riscv-gnu-toolchain) * [RISC-V GNU Compiler Toolchain](https://github.com/riscv/riscv-gnu-toolchain)
* [Picolibc library for RISC-V](https://github.com/picolibc/picolibc)
* GCC (or another C compiler) for host architecture (for building a SD card image) * GCC (or another C compiler) for host architecture (for building a SD card image)
* Make * Make
* [iconv](https://en.wikipedia.org/wiki/Iconv) (for building with JP lang menu) * [iconv](https://en.wikipedia.org/wiki/Iconv) (for building with JP lang menu)
@ -20,19 +21,14 @@ Requirements for building and debugging firmware
Architecture Architecture
------------------------------ ------------------------------
* [Reference board schematics](https://github.com/marqs85/ossc_pcb/raw/v1.6/ossc_board.pdf) * [Reference board schematics](https://github.com/marqs85/ossc_pcb/raw/v1.8/doc/ossc_board.pdf)
* [Reference PCB project](https://github.com/marqs85/ossc_pcb) * [Reference PCB project](https://github.com/marqs85/ossc_pcb)
SW toolchain build procedure SW toolchain build procedure
-------------------------- --------------------------
1. Download, configure, build and install RISC-V toolchain with Newlib + RV32EMC support: 1. Download and install RISC-V GNU toolchain and Picolibc
~~~~
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
~~~~
2. Compile custom binary to IHEX converter: 2. Compile custom binary to IHEX converter:
~~~~ ~~~~
gcc tools/bin2hex.c -o tools/bin2hex gcc tools/bin2hex.c -o tools/bin2hex
@ -51,9 +47,10 @@ git submodule update --init --recursive ip/pulpino_qsys
* Load platform configuration (sys.qsys) * Load platform configuration (sys.qsys)
* Generate output (Generate -> Generate HDL, Generate) * Generate output (Generate -> Generate HDL, Generate)
* Close Platform Designer * 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 * Run "touch software/sys_controller_bsp/bsp_timestamp" to acknowledge QSYS update
3. Generate the FPGA bitstream (Processing -> Start Compilation) 3. Generate the FPGA bitstream (Processing -> Start Compilation)
4. Ensure that there are no severe timing violations by looking into Timing Analyzer report 4. Ensure that there are no 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. 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.

View File

@ -52,8 +52,9 @@ foreach_in_collection c [get_clocks pclk_*_out] {
} }
set_false_path -to [remove_from_collection [all_outputs] $critoutputs_hdmi] set_false_path -to [remove_from_collection [all_outputs] $critoutputs_hdmi]
# Lumacode # Lumacode (constrained to max. 60MHz sampling)
set_false_path -from [get_clocks pclk_tvp_high] -through [get_cells tvp7002_frontend:u_tvp_frontend|lc_code*] set_max_delay 16.6 -from [get_clocks pclk_tvp_high] -through [get_cells tvp7002_frontend:u_tvp_frontend|lc_code*]
set_max_delay 16.6 -from [get_clocks pclk_tvp_high] -through [get_cells u_tvp_frontend|lc_atari_*]
### CPU/scanconverter clock relations ### ### CPU/scanconverter clock relations ###

View File

@ -100,6 +100,8 @@ reg [1:0] lc_code[1:4];
reg [2:0] lc_ctr; reg [2:0] lc_ctr;
reg [2:0] lc_cnt; reg [2:0] lc_cnt;
reg [2:0] lc_emp_nes; reg [2:0] lc_emp_nes;
reg [3:0] lc_atari_hue, lc_atari_luma;
reg lc_atari_ctr;
// Measurement registers // Measurement registers
reg [20:0] pcnt_frame_ctr; reg [20:0] pcnt_frame_ctr;
@ -145,8 +147,8 @@ wire HSYNC_i_np = (HSYNC_i ^ ~hsync_i_pol);
wire [3:0] H_SKIP = hv_in_config3[27:24]; wire [3:0] H_SKIP = hv_in_config3[27:24];
wire [3:0] H_SAMPLE_SEL = hv_in_config3[31:28]; wire [3:0] H_SAMPLE_SEL = hv_in_config3[31:28];
// Lumacode uses 2 samples for {C64, C128, VIC20, Spectrum, TMS99xxA}, 3 samples for NES, 4 samples for VCS and 6 samples for Atari 8bit // Lumacode uses 2 samples for {C64, C128, VIC20, Spectrum, TMS99xxA}, 3 samples for NES, 6 samples for Atari 8bit (3 per pixel) and 4 samples for VCS (2 per half-pixel)
wire [2:0] LC_SAMPLES = (MISC_LUMACODE_MODE <= 3) ? 2 : ((MISC_LUMACODE_MODE <= 4) ? 3 : ((MISC_LUMACODE_MODE <= 5) ? 4 : 6)); wire [2:0] LC_SAMPLES = (MISC_LUMACODE_MODE <= 3) ? 2 : ((MISC_LUMACODE_MODE <= 5) ? 3 : 2);
wire [2:0] LC_H_SKIP = ((H_SKIP+1) / LC_SAMPLES) - 1; wire [2:0] LC_H_SKIP = ((H_SKIP+1) / LC_SAMPLES) - 1;
// Lumacode palettes for 2-sample index-based sources (C64, Spectrum, Coleco/MSX) // Lumacode palettes for 2-sample index-based sources (C64, Spectrum, Coleco/MSX)
@ -164,6 +166,44 @@ wire [7:0] lumacode_data_3s_R = lumacode_data_3s[{lc_code[1], lc_code[2], lc_cod
wire [7:0] lumacode_data_3s_G = lumacode_data_3s[{lc_code[1], lc_code[2], lc_code[3]}][15:8]; wire [7:0] lumacode_data_3s_G = lumacode_data_3s[{lc_code[1], lc_code[2], lc_code[3]}][15:8];
wire [7:0] lumacode_data_3s_B = lumacode_data_3s[{lc_code[1], lc_code[2], lc_code[3]}][7:0]; wire [7:0] lumacode_data_3s_B = lumacode_data_3s[{lc_code[1], lc_code[2], lc_code[3]}][7:0];
// Lumacode palette Atari GTIA
wire [23:0] lumacode_data_gtia[0:255] = '{
24'h000000, 24'h111111, 24'h222222, 24'h333333, 24'h444444, 24'h555555, 24'h666666, 24'h777777, 24'h888888, 24'h999999, 24'haaaaaa, 24'hbbbbbb, 24'hcccccc, 24'hdddddd, 24'heeeeee, 24'hffffff,
24'h091900, 24'h192806, 24'h29370d, 24'h3a4714, 24'h4a561b, 24'h5a6522, 24'h6b7529, 24'h7b8430, 24'h8c9336, 24'h9ca33d, 24'hacb244, 24'hbdc14b, 24'hcdd152, 24'hdee059, 24'heeef60, 24'hffff67,
24'h300000, 24'h3d1108, 24'h4b2211, 24'h593319, 24'h674422, 24'h75552a, 24'h826633, 24'h90773b, 24'h9e8844, 24'hac994c, 24'hbaaa55, 24'hc7bb5d, 24'hd5cc66, 24'he3dd6e, 24'hf1ee77, 24'hffff80,
24'h4b0000, 24'h570f0c, 24'h631e18, 24'h6f2e24, 24'h7a3d30, 24'h874d3c, 24'h935c49, 24'h9f6b55, 24'hab7b61, 24'hb68a6d, 24'hc39a79, 24'hcfa986, 24'hdbb892, 24'he6c89e, 24'hf3d7aa, 24'hffe7b7,
24'h550000, 24'h600e10, 24'h6b1c21, 24'h772a32, 24'h823843, 24'h8d4654, 24'h995465, 24'ha46276, 24'haf7187, 24'hbb7f98, 24'hc68da9, 24'hd19bba, 24'hdda9cb, 24'he8b7dc, 24'hf3c5ed, 24'hffd4fe,
24'h4c0047, 24'h570d53, 24'h631b5f, 24'h6f286b, 24'h7b3678, 24'h874384, 24'h935190, 24'h9f5e9c, 24'hab6ca9, 24'hb779b5, 24'hc387c1, 24'hcf94cd, 24'hdba2da, 24'he7afe6, 24'hf3bdf2, 24'hffcbff,
24'h30007e, 24'h3b0b85, 24'h49198d, 24'h572796, 24'h65349f, 24'h7242a7, 24'h8050b0, 24'h8e5db8, 24'h9c6bc1, 24'ha979c9, 24'hb786d2, 24'hc594db, 24'hd3a2e3, 24'he0afec, 24'heebdf4, 24'hfccbfd,
24'h0a0097, 24'h1a0e9d, 24'h2a1da4, 24'h3b2cab, 24'h4b3ab2, 24'h5b49b9, 24'h6c58c0, 24'h7c67c7, 24'h8c75ce, 24'h9c84d5, 24'had93dc, 24'hbda2e3, 24'hceb0ea, 24'hdebff1, 24'heecef8, 24'hffddff,
24'h00008e, 24'h0c0d94, 24'h1b1e9c, 24'h2a2ea3, 24'h393eab, 24'h484eb2, 24'h575eba, 24'h666ec1, 24'h747ec9, 24'h838fd0, 24'h929fd8, 24'ha1afdf, 24'hb0bfe6, 24'hbfcfee, 24'hcedff5, 24'hddeffd,
24'h000e64, 24'h0c1e6e, 24'h192e78, 24'h263e83, 24'h324e8d, 24'h3f5e97, 24'h4c6ea2, 24'h587eac, 24'h658eb6, 24'h729ec1, 24'h7eaecb, 24'h8bbed5, 24'h98cee0, 24'ha4deea, 24'hb1eef4, 24'hbeffff,
24'h002422, 24'h09302e, 24'h153f3d, 24'h204d4c, 24'h2c5c5a, 24'h376a69, 24'h427978, 24'h4e8786, 24'h599695, 24'h65a4a4, 24'h70b3b2, 24'h7cc1c1, 24'h87d0d0, 24'h92dfde, 24'h9eeded, 24'ha9fcfc,
24'h003200, 24'h0b3f0e, 24'h164d1c, 24'h225b2b, 24'h2d6839, 24'h397648, 24'h448456, 24'h509164, 24'h5b9f73, 24'h67ad81, 24'h72ba90, 24'h7ec89e, 24'h89d6ac, 24'h95e3bb, 24'ha0f1c9, 24'hacffd8,
24'h003400, 24'h0c410a, 24'h194f14, 24'h265c1e, 24'h336a28, 24'h407732, 24'h4c853c, 24'h599246, 24'h66a050, 24'h73ad5a, 24'h80bb64, 24'h8cc86e, 24'h99d678, 24'ha6e382, 24'hb3f18c, 24'hc0ff97,
24'h002a00, 24'h0f3807, 24'h1e460e, 24'h2d5416, 24'h3c621d, 24'h4b7124, 24'h5a7f2c, 24'h698d33, 24'h799b3b, 24'h88a942, 24'h97b849, 24'ha6c651, 24'hb5d458, 24'hc4e260, 24'hd3f067, 24'he3ff6f,
24'h0d1700, 24'h1d2606, 24'h2d350d, 24'h3d4514, 24'h4d541b, 24'h5d6422, 24'h6d7329, 24'h7d8330, 24'h8e9237, 24'h9ea23e, 24'haeb145, 24'hbec14c, 24'hced053, 24'hdee05a, 24'heeef61, 24'hffff68,
24'h330000, 24'h401008, 24'h4e2111, 24'h5b321a, 24'h694323, 24'h77542c, 24'h846535, 24'h92763e, 24'h9f8646, 24'had974f, 24'hbba858, 24'hc8b961, 24'hd6ca6a, 24'he3db73, 24'hf1ec7c, 24'hfffd85};
// Lumacode palette Atari CTIA/TIA
wire [23:0] lumacode_data_ctia[0:127] = '{
24'h000000, 24'h404040, 24'h6C6C6C, 24'h909090, 24'hB0B0B0, 24'hC8C8C8, 24'hDCDCDC, 24'hECECEC,
24'h444400, 24'h646410, 24'h848424, 24'hA0A034, 24'hB8B840, 24'hD0D050, 24'hE8E85C, 24'hFCFC68,
24'h702800, 24'h844414, 24'h985C28, 24'hAC783C, 24'hBC8C4C, 24'hCCA05C, 24'hDCB468, 24'hECC878,
24'h841800, 24'h983418, 24'hAC5030, 24'hC06848, 24'hD0805C, 24'hE09470, 24'hECA880, 24'hFCBC94,
24'h880000, 24'h9C2020, 24'hB03C3C, 24'hC05858, 24'hD07070, 24'hE08888, 24'hECA0A0, 24'hFCB4B4,
24'h78005C, 24'h8C2074, 24'hA03C88, 24'hB0589C, 24'hC070B0, 24'hD084C0, 24'hDC9CD0, 24'hECB0E0,
24'h480078, 24'h602090, 24'h783CA4, 24'h8C58B8, 24'hA070CC, 24'hB484DC, 24'hC49CEC, 24'hD4B0FC,
24'h140084, 24'h302098, 24'h4C3CAC, 24'h6858C0, 24'h7C70D0, 24'h9488E0, 24'hA8A0EC, 24'hBCB4FC,
24'h000088, 24'h1C209C, 24'h3840B0, 24'h505CC0, 24'h6874D0, 24'h7C8CE0, 24'h90A4EC, 24'hA4B8FC,
24'h00187C, 24'h1C3890, 24'h3854A8, 24'h5070BC, 24'h6888CC, 24'h7C9CDC, 24'h90B4EC, 24'hA4C8FC,
24'h002C5C, 24'h1C4C78, 24'h386890, 24'h5084AC, 24'h689CC0, 24'h7CB4D4, 24'h90CCE8, 24'hA4E0FC,
24'h003C2C, 24'h1C5C48, 24'h387C64, 24'h509C80, 24'h68B494, 24'h7CD0AC, 24'h90E4C0, 24'hA4FCD4,
24'h003C00, 24'h205C20, 24'h407C40, 24'h5C9C5C, 24'h74B474, 24'h8CD08C, 24'hA4E4A4, 24'hB8FCB8,
24'h143800, 24'h345C1C, 24'h507C38, 24'h6C9850, 24'h84B468, 24'h9CCC7C, 24'hB4E490, 24'hC8FCA4,
24'h2C3000, 24'h4C501C, 24'h687034, 24'h848C4C, 24'h9CA864, 24'hB4C078, 24'hCCD488, 24'hE0EC9C,
24'h442800, 24'h644818, 24'h846830, 24'hA08444, 24'hB89C58, 24'hD0B46C, 24'hE8CC7C, 24'hFCE08C};
// SOF position for scaler // SOF position for scaler
wire [10:0] V_SOF_LINE = hv_in_config3[23:13]; wire [10:0] V_SOF_LINE = hv_in_config3[23:13];
@ -263,6 +303,7 @@ always @(posedge PCLK_i) begin
lc_code[1] <= G_pp[1][7:6]; lc_code[1] <= G_pp[1][7:6];
lc_cnt <= 0; lc_cnt <= 0;
lc_ctr <= 0; lc_ctr <= 0;
lc_atari_ctr <= (h_cnt == 0) ? 0 : lc_atari_ctr ^ 1'b1;
end else if (lc_ctr == LC_H_SKIP) begin end else if (lc_ctr == LC_H_SKIP) begin
lc_code[2+lc_cnt] <= G_pp[1][7:6]; lc_code[2+lc_cnt] <= G_pp[1][7:6];
lc_cnt <= lc_cnt + 1; lc_cnt <= lc_cnt + 1;
@ -302,12 +343,31 @@ always @(posedge PCLK_i) begin
if ((h_ctr == H_SAMPLE_SEL) & ({lc_code[1], lc_code[2], lc_code[3]} < 8)) if ((h_ctr == H_SAMPLE_SEL) & ({lc_code[1], lc_code[2], lc_code[3]} < 8))
lc_emp_nes <= {lc_code[2][0], lc_code[3]}; lc_emp_nes <= {lc_code[2][0], lc_code[3]};
// TODO: Lumacode VCS // Lumacode Atari GTIA
end else if (MISC_LUMACODE_MODE == 5) begin end else if (MISC_LUMACODE_MODE == 5) begin
{R_pp[2], G_pp[2], B_pp[2]} <= '0; if (h_ctr == H_SAMPLE_SEL) begin
// TODO: Lumacode Atari 8-bit if (lc_atari_ctr) begin
// Store hue and luma (high bits) for 1st pixel, and display last pixel of previous pair
lc_atari_hue <= {lc_code[1], lc_code[2]};
lc_atari_luma[3:2] <= lc_code[3];
{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_gtia[{lc_atari_hue, lc_atari_luma}];
end else begin
// Store luma for 2nd pixel, and display first pixel of current pair
lc_atari_luma <= {lc_code[2], lc_code[3]};
{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_gtia[{lc_atari_hue, lc_atari_luma[3:2], lc_code[1]}];
end
end
// Lumacode Atari VCS
end else begin end else begin
{R_pp[2], G_pp[2], B_pp[2]} <= '0; if (h_ctr == H_SAMPLE_SEL) begin
if (lc_atari_ctr) begin
// Store first 2 lumacode samples (hue) from double-sampled input (160col->320col)
lc_atari_hue <= {lc_code[1], lc_code[2]};
end else begin
// Display pixel after receiving remaining 2 lumacode samples (luma)
{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_ctia[{lc_atari_hue, lc_code[1], lc_code[2][1]}];
end
end
end end
HSYNC_pp[2] <= HSYNC_pp[1]; HSYNC_pp[2] <= HSYNC_pp[1];

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
jtagconfig
make rv-reprogram make rv-reprogram
if [ $# -eq 1 ] && [ $1 = "jtag_uart" ] && [ $(pgrep -c nios2-terminal) = 0 ]; then if [ $# -eq 1 ] && [ $1 = "jtag_uart" ] && [ $(pgrep -c nios2-terminal) = 0 ]; then

View File

@ -190,7 +190,7 @@ CREATE_ELF_DERIVED_FILES := 0
CREATE_LINKER_MAP := 1 CREATE_LINKER_MAP := 1
# Common arguments for ALT_CFLAGSs # Common arguments for ALT_CFLAGSs
APP_CFLAGS_DEFINED_SYMBOLS := APP_CFLAGS_DEFINED_SYMBOLS := -DPICOLIBC_INTEGER_PRINTF_SCANF
ifeq ($(ENABLE_AUDIO),y) ifeq ($(ENABLE_AUDIO),y)
APP_CFLAGS_DEFINED_SYMBOLS += -DENABLE_AUDIO APP_CFLAGS_DEFINED_SYMBOLS += -DENABLE_AUDIO
endif endif
@ -216,6 +216,7 @@ SYS_LIB :=
BSP_ROOT_DIR := ../sys_controller_bsp/ BSP_ROOT_DIR := ../sys_controller_bsp/
# List of application specific include directories, library directories and library names # List of application specific include directories, library directories and library names
APP_INCLUDE_DIRS += /usr/lib/picolibc/riscv64-unknown-elf/include
APP_INCLUDE_DIRS += it6613 APP_INCLUDE_DIRS += it6613
APP_INCLUDE_DIRS += tvp7002 APP_INCLUDE_DIRS += tvp7002
APP_INCLUDE_DIRS += ths7353 APP_INCLUDE_DIRS += ths7353
@ -396,7 +397,7 @@ APP_ASFLAGS := $(APP_ASM_INC_DIRS) \
$(ASFLAGS) $(ASFLAGS)
# Arguments only for the linker. # Arguments only for the linker.
APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=nano.specs -nostartfiles APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=picolibc.specs -nostartfiles
ifneq ($(LINKER_SCRIPT),) ifneq ($(LINKER_SCRIPT),)
APP_LDFLAGS += -T'$(LINKER_SCRIPT)' APP_LDFLAGS += -T'$(LINKER_SCRIPT)'
@ -657,11 +658,11 @@ build_post_process :
# included makefile fragment. # included makefile fragment.
# #
ifeq ($(DEFAULT_CROSS_COMPILE),) ifeq ($(DEFAULT_CROSS_COMPILE),)
DEFAULT_CROSS_COMPILE := riscv32-unknown-elf- DEFAULT_CROSS_COMPILE := riscv64-unknown-elf-
endif endif
ifeq ($(DEFAULT_STACKREPORT),) ifeq ($(DEFAULT_STACKREPORT),)
DEFAULT_STACKREPORT := riscv32-unknown-elf-size DEFAULT_STACKREPORT := riscv64-unknown-elf-size
endif endif
ifeq ($(DEFAULT_DOWNLOAD),) ifeq ($(DEFAULT_DOWNLOAD),)
@ -715,7 +716,7 @@ AR := $(CROSS_COMPILE)ar
endif endif
ifeq ($(origin LD),default) ifeq ($(origin LD),default)
LD := $(CROSS_COMPILE)g++ LD := $(CROSS_COMPILE)gcc
endif endif
ifeq ($(origin RM),default) ifeq ($(origin RM),default)
@ -760,7 +761,7 @@ ifeq ($(MKDIR),)
MKDIR := $(DEFAULT_MKDIR) MKDIR := $(DEFAULT_MKDIR)
endif endif
RV_OBJCOPY = riscv32-unknown-elf-objcopy RV_OBJCOPY = riscv64-unknown-elf-objcopy
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# PATTERN RULES TO BUILD OBJECTS # PATTERN RULES TO BUILD OBJECTS

View File

@ -3401,6 +3401,8 @@ SetGPInfoFrame(BYTE *pInfoFrameData)
return ER_FAIL ; return ER_FAIL ;
} }
DISABLE_NULL_PKT();
Switch_HDMITX_Bank(1) ; Switch_HDMITX_Bank(1) ;
HDMITX_WriteI2C_Byte(REG_TX_PKT_HB00, (0x80+pInfoFrame->info.Type)); HDMITX_WriteI2C_Byte(REG_TX_PKT_HB00, (0x80+pInfoFrame->info.Type));

View File

@ -2,6 +2,6 @@
OUTPUT_ARCH(riscv) OUTPUT_ARCH(riscv)
/* required to correctly link newlib */ /* required to correctly link newlib */
GROUP( -lc -lgloss -lgcc -lsupc++ ) GROUP( -lc -lgcc )
INCLUDE link.common.ld INCLUDE link.common.ld

View File

@ -185,6 +185,7 @@ inline void TX_enable(tx_mode_t mode)
SetAVMute(TRUE); SetAVMute(TRUE);
DisableVideoOutput(); DisableVideoOutput();
EnableAVIInfoFrame(FALSE, NULL); EnableAVIInfoFrame(FALSE, NULL);
EnableGPInfoFrame(FALSE, NULL);
//Setup TX configuration //Setup TX configuration
//TODO: set pclk target and VIC dynamically //TODO: set pclk target and VIC dynamically
@ -192,8 +193,10 @@ inline void TX_enable(tx_mode_t mode)
if (mode != TX_DVI) { if (mode != TX_DVI) {
HDMITX_SetAVIInfoFrame(vmode_out.vic, (mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr); HDMITX_SetAVIInfoFrame(vmode_out.vic, (mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr);
HDMITX_SetHDRInfoFrame(tc.hdmi_hdr ? 3 : 0); if (tc.hdmi_vrr)
HDMITX_SetVRRInfoFrame(tc.hdmi_vrr); HDMITX_SetVRRInfoFrame(tc.hdmi_vrr);
if (tc.hdmi_hdr)
HDMITX_SetHDRInfoFrame(tc.hdmi_hdr ? 3 : 0);
cm.cc.hdmi_itc = tc.hdmi_itc; cm.cc.hdmi_itc = tc.hdmi_itc;
cm.cc.hdmi_hdr = tc.hdmi_hdr; cm.cc.hdmi_hdr = tc.hdmi_hdr;
cm.cc.hdmi_vrr = tc.hdmi_vrr; cm.cc.hdmi_vrr = tc.hdmi_vrr;
@ -412,6 +415,9 @@ status_t get_status(tvp_sync_input_t syncinput)
if (memcmp(&tc.col, &cm.cc.col, sizeof(color_setup_t))) if (memcmp(&tc.col, &cm.cc.col, sizeof(color_setup_t)))
tvp_set_gain_offset(&tc.col); tvp_set_gain_offset(&tc.col);
if (tc.full_vs_bypass != cm.cc.full_vs_bypass)
tvp_set_full_vs_bypass(tc.full_vs_bypass);
#ifdef ENABLE_AUDIO #ifdef ENABLE_AUDIO
if ((tc.audio_dw_sampl != cm.cc.audio_dw_sampl) || if ((tc.audio_dw_sampl != cm.cc.audio_dw_sampl) ||
#ifdef MANUAL_CTS #ifdef MANUAL_CTS
@ -961,7 +967,7 @@ int main()
printf("### DIY VIDEO DIGITIZER / SCANCONVERTER INIT OK ###\n\n"); printf("### DIY VIDEO DIGITIZER / SCANCONVERTER INIT OK ###\n\n");
sniprintf(row1, LCD_ROW_LEN+1, "OSSC fw. %u.%.2u" FW_SUFFIX1 FW_SUFFIX2, FW_VER_MAJOR, FW_VER_MINOR); sniprintf(row1, LCD_ROW_LEN+1, "OSSC fw. %u.%.2u" FW_SUFFIX1 FW_SUFFIX2, FW_VER_MAJOR, FW_VER_MINOR);
#ifndef DEBUG #ifndef DEBUG
strncpy(row2, "2014-2024 marqs", LCD_ROW_LEN+1); strncpy(row2, "2014-2025 marqs", LCD_ROW_LEN+1);
#else #else
strncpy(row2, "** DEBUG BUILD *", LCD_ROW_LEN+1); strncpy(row2, "** DEBUG BUILD *", LCD_ROW_LEN+1);
#endif #endif
@ -1162,16 +1168,16 @@ int main()
HDMITX_SetAVIInfoFrame(vmode_out.vic, (tc.tx_mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr); HDMITX_SetAVIInfoFrame(vmode_out.vic, (tc.tx_mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr);
cm.cc.hdmi_itc = tc.hdmi_itc; cm.cc.hdmi_itc = tc.hdmi_itc;
} }
if (tc.hdmi_hdr != cm.cc.hdmi_hdr) {
printf("setting HDR flag to %d\n", tc.hdmi_hdr);
HDMITX_SetHDRInfoFrame(tc.hdmi_hdr ? 3 : 0);
cm.cc.hdmi_hdr = tc.hdmi_hdr;
}
if (tc.hdmi_vrr != cm.cc.hdmi_vrr) { if (tc.hdmi_vrr != cm.cc.hdmi_vrr) {
printf("setting VRR flag to %d\n", tc.hdmi_vrr); printf("setting VRR flag to %d\n", tc.hdmi_vrr);
HDMITX_SetVRRInfoFrame(tc.hdmi_vrr); HDMITX_SetVRRInfoFrame(tc.hdmi_vrr);
cm.cc.hdmi_vrr = tc.hdmi_vrr; cm.cc.hdmi_vrr = tc.hdmi_vrr;
} }
if (tc.hdmi_hdr != cm.cc.hdmi_hdr) {
printf("setting HDR flag to %d\n", tc.hdmi_hdr);
HDMITX_SetHDRInfoFrame(tc.hdmi_hdr ? 3 : 0);
cm.cc.hdmi_hdr = tc.hdmi_hdr;
}
} }
if (tc.av3_alt_rgb != cm.cc.av3_alt_rgb) { if (tc.av3_alt_rgb != cm.cc.av3_alt_rgb) {
printf("Changing AV3 RGB source\n"); printf("Changing AV3 RGB source\n");

View File

@ -45,6 +45,7 @@ const avconfig_t tc_default = {
.vsync_thold = DEFAULT_VSYNC_THOLD, .vsync_thold = DEFAULT_VSYNC_THOLD,
.pre_coast = DEFAULT_PRE_COAST, .pre_coast = DEFAULT_PRE_COAST,
.post_coast = DEFAULT_POST_COAST, .post_coast = DEFAULT_POST_COAST,
.adc_pll_bw = 1,
.sync_lpf = DEFAULT_SYNC_LPF, .sync_lpf = DEFAULT_SYNC_LPF,
.alc_h_filter = DEFAULT_ALC_H_FILTER, .alc_h_filter = DEFAULT_ALC_H_FILTER,
.alc_v_filter = DEFAULT_ALC_V_FILTER, .alc_v_filter = DEFAULT_ALC_V_FILTER,

View File

@ -137,6 +137,7 @@ typedef struct {
alt_u8 alc_h_filter; alt_u8 alc_h_filter;
alt_u8 alc_v_filter; alt_u8 alc_v_filter;
color_setup_t col; color_setup_t col;
alt_u8 full_vs_bypass;
/* Audio settings */ /* Audio settings */
alt_u8 audio_dw_sampl; alt_u8 audio_dw_sampl;

View File

@ -24,10 +24,10 @@
#include "sysconfig.h" #include "sysconfig.h"
#define FW_VER_MAJOR 1 #define FW_VER_MAJOR 1
#define FW_VER_MINOR 11 #define FW_VER_MINOR 12
#define PROFILE_VER_MAJOR 1 #define PROFILE_VER_MAJOR 1
#define PROFILE_VER_MINOR 11 #define PROFILE_VER_MINOR 12
#define INITCFG_VER_MAJOR 1 #define INITCFG_VER_MAJOR 1
#define INITCFG_VER_MINOR 0 #define INITCFG_VER_MINOR 0

View File

@ -80,7 +80,7 @@ static const char *auto_input_desc[] = { "Off", "Current input", "All inputs" };
static const char *mask_color_desc[] = { "Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Yellow", "White" }; static const char *mask_color_desc[] = { "Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Yellow", "White" };
static const char *av3_alt_rgb_desc[] = { "Off", "AV1", "AV2" }; static const char *av3_alt_rgb_desc[] = { "Off", "AV1", "AV2" };
static const char *shmask_mode_desc[] = { "Off", "A-Grille", "TV", "PVM" }; static const char *shmask_mode_desc[] = { "Off", "A-Grille", "TV", "PVM" };
static const char *lumacode_mode_desc[] = { "Off", "C64", "Spectrum", "Coleco/MSX", "NES" }; static const char *lumacode_mode_desc[] = { "Off", "C64", "Spectrum", "Coleco/MSX", "NES", "Atari GTIA", "Atari VCS" };
static const char *adc_pll_bw_desc[] = { "High", "Medium", "Low", "Ultra low" }; static const char *adc_pll_bw_desc[] = { "High", "Medium", "Low", "Ultra low" };
static const char *fpga_pll_bw_desc[] = { "High", "Low" }; static const char *fpga_pll_bw_desc[] = { "High", "Low" };
@ -223,6 +223,7 @@ MENU(menu_compatibility, P99_PROTECT({ \
{ LNG("Full TX setup","フルTXセットアップ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.full_tx_setup, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Full TX setup","フルTXセットアップ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.full_tx_setup, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ LNG("Allow TVP HPLL2x","TVP HPLL2xキョヨウ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.tvp_hpll2x, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Allow TVP HPLL2x","TVP HPLL2xキョヨウ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.tvp_hpll2x, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "AV3 use alt. RGB", OPT_AVCONFIG_SELECTION, { .sel = { &tc.av3_alt_rgb, OPT_WRAP, SETTING_ITEM(av3_alt_rgb_desc) } } }, { "AV3 use alt. RGB", OPT_AVCONFIG_SELECTION, { .sel = { &tc.av3_alt_rgb, OPT_WRAP, SETTING_ITEM(av3_alt_rgb_desc) } } },
{ "Full VSYNC bypas", OPT_AVCONFIG_SELECTION, { .sel = { &tc.full_vs_bypass, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } }, { "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } },
})) }))

View File

@ -25,6 +25,7 @@
#define SD_SPI_BASE I2C_OPENCORES_1_BASE #define SD_SPI_BASE I2C_OPENCORES_1_BASE
#ifndef DEBUG #ifndef DEBUG
#include <stdio.h>
#define OS_PRINTF(...) #define OS_PRINTF(...)
#define ErrorF(...) #define ErrorF(...)
#define printf(...) #define printf(...)
@ -38,6 +39,8 @@
#define printf dd_printf #define printf dd_printf
#endif #endif
#define sniprintf snprintf
#define WAITLOOP_SLEEP_US 10000 #define WAITLOOP_SLEEP_US 10000
#endif /* SYSCONFIG_H_ */ #endif /* SYSCONFIG_H_ */

View File

@ -18,6 +18,7 @@
// //
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include "system.h" #include "system.h"
#include "i2c_opencores.h" #include "i2c_opencores.h"

View File

@ -38,7 +38,8 @@ const ypbpr_to_rgb_csc_t csc_coeffs[] = {
}; };
static const alt_u8 Kvco[] = {75, 85, 150, 200}; static const alt_u8 Kvco[] = {75, 85, 150, 200};
static const char *Kvco_str[] = { "Ultra low", "Low", "Medium", "High" }; static const char* const Kvco_str[] = { "Ultra low", "Low", "Medium", "High" };
static alt_u8 full_vs_bypass;
static void tvp_set_clamp_type(video_format fmt) static void tvp_set_clamp_type(video_format fmt)
{ {
@ -201,6 +202,7 @@ void tvp_init()
}; };
// Set default configuration (skip those which match register reset values) // Set default configuration (skip those which match register reset values)
full_vs_bypass = 0;
// Configure external refclk, HPLL generated pclk // Configure external refclk, HPLL generated pclk
tvp_sel_clk(REFCLK_EXT27, 0); tvp_sel_clk(REFCLK_EXT27, 0);
@ -267,6 +269,10 @@ void tvp_set_gain_offset(color_setup_t *col) {
tvp_writereg(TVP_B_FOFFSET_MSB, col->b_f_off); tvp_writereg(TVP_B_FOFFSET_MSB, col->b_f_off);
} }
void tvp_set_full_vs_bypass(alt_u8 enable) {
full_vs_bypass = enable;
}
// Configure H-PLL (sampling rate, VCO gain and charge pump current) // Configure H-PLL (sampling rate, VCO gain and charge pump current)
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2) void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2)
{ {
@ -447,11 +453,10 @@ void tvp_source_sel(tvp_input_t input, tvp_sync_input_t syncinput, video_format
else else
tvp_writereg(TVP_MISCCTRL3, 0x00); tvp_writereg(TVP_MISCCTRL3, 0x00);
#ifdef SYNCBYPASS if ((syncinput > TVP_SOG3) && (syncinput < TVP_CS_A))
tvp_writereg(TVP_SYNCBYPASS, 0x03); tvp_writereg(TVP_SYNCBYPASS, full_vs_bypass ? 0x02 : 0x00);
#else else
tvp_writereg(TVP_SYNCBYPASS, 0x00); tvp_writereg(TVP_SYNCBYPASS, 0x00);
#endif
//TODO: //TODO:
//TVP_ADCSETUP //TVP_ADCSETUP

View File

@ -98,6 +98,8 @@ void tvp_init();
void tvp_set_gain_offset(color_setup_t *col); void tvp_set_gain_offset(color_setup_t *col);
void tvp_set_full_vs_bypass(alt_u8 enable);
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2); void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2);
void tvp_sel_csc(const ypbpr_to_rgb_csc_t *csc); void tvp_sel_csc(const ypbpr_to_rgb_csc_t *csc);

View File

@ -40,28 +40,28 @@
******************************************************************************/ ******************************************************************************/
/* /*
* errno is defined in <errno.h> so that it uses the thread local version * errno is defined in <errno.h> so that it uses the thread local version
* stored in the location pointed to by "_impure_ptr". This means that the * stored in the location pointed to by "_impure_ptr". This means that the
* accesses to errno within the HAL library can cause the entirety of * accesses to errno within the HAL library can cause the entirety of
* of the structure pointed to by "_impure_ptr" to be added to the * of the structure pointed to by "_impure_ptr" to be added to the
* users application. This can be undesirable in very small footprint systems. * users application. This can be undesirable in very small footprint systems.
* *
* To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below, * To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below,
* to access errno, rather than accessing it directly. This macro will only * to access errno, rather than accessing it directly. This macro will only
* use the thread local version if some other code has already caused it to be * use the thread local version if some other code has already caused it to be
* included into the system, otherwise it will use the global errno value. * included into the system, otherwise it will use the global errno value.
* *
* This causes a slight increases in code size where errno is accessed, but * This causes a slight increases in code size where errno is accessed, but
* can lead to significant overall benefits in very small systems. The * can lead to significant overall benefits in very small systems. The
* increase is inconsequential when compared to the size of the structure * increase is inconsequential when compared to the size of the structure
* pointed to by _impure_ptr. * pointed to by _impure_ptr.
* *
* Note that this macro accesses __errno() using an externally declared * Note that this macro accesses __errno() using an externally declared
* function pointer (alt_errno). This is done so that the function call uses the * function pointer (alt_errno). This is done so that the function call uses the
* subroutine call instruction via a register rather than an immediate address. * subroutine call instruction via a register rather than an immediate address.
* This is important in the case that the code has been linked for a high * This is important in the case that the code has been linked for a high
* address, but __errno() is not being used. In this case the weak linkage * address, but __errno() is not being used. In this case the weak linkage
* would have resulted in the instruction: "call 0" which would fail to link. * would have resulted in the instruction: "call 0" which would fail to link.
*/ */
extern int* (*alt_errno) (void); extern int* (*alt_errno) (void);
@ -73,9 +73,9 @@ extern int* (*alt_errno) (void);
#include "alt_types.h" #include "alt_types.h"
#undef errno /*#undef errno
extern int errno; extern int errno;*/
static ALT_INLINE int* alt_get_errno(void) static ALT_INLINE int* alt_get_errno(void)
{ {

View File

@ -19,7 +19,7 @@ SPACE := $(empty) $(empty)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# The adjust-path macro # The adjust-path macro
# #
# If COMSPEC is defined, Make is launched from Windows through # If COMSPEC is defined, Make is launched from Windows through
# Cygwin. This adjust-path macro will call 'cygpath -u' on all # Cygwin. This adjust-path macro will call 'cygpath -u' on all
# paths to ensure they are readable by Make. # paths to ensure they are readable by Make.
@ -78,26 +78,26 @@ OBJ_DIR := ./obj
# utilize the BSP settings mechanism to do so. # utilize the BSP settings mechanism to do so.
# #
# Note that most variable assignments in this section have a corresponding BSP # Note that most variable assignments in this section have a corresponding BSP
# setting that can be changed by using the nios2-bsp-create-settings or # setting that can be changed by using the nios2-bsp-create-settings or
# nios2-bsp-update-settings command before nios2-bsp-generate-files; if you # nios2-bsp-update-settings command before nios2-bsp-generate-files; if you
# want any variable set to a specific value when this Makefile is re-generated # want any variable set to a specific value when this Makefile is re-generated
# (to prevent hand-edits from being over-written), use the BSP settings # (to prevent hand-edits from being over-written), use the BSP settings
# facilities above. # facilities above.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#START MANAGED #START MANAGED
# The following TYPE comment allows tools to identify the 'type' of target this # The following TYPE comment allows tools to identify the 'type' of target this
# makefile is associated with. # makefile is associated with.
# TYPE: BSP_PRIVATE_MAKEFILE # TYPE: BSP_PRIVATE_MAKEFILE
# This following VERSION comment indicates the version of the tool used to # This following VERSION comment indicates the version of the tool used to
# generate this makefile. A makefile variable is provided for VERSION as well. # generate this makefile. A makefile variable is provided for VERSION as well.
# ACDS_VERSION: 17.1 # ACDS_VERSION: 17.1
ACDS_VERSION := 17.1 ACDS_VERSION := 17.1
# This following BUILD_NUMBER comment indicates the build number of the tool # This following BUILD_NUMBER comment indicates the build number of the tool
# used to generate this makefile. # used to generate this makefile.
# BUILD_NUMBER: 590 # BUILD_NUMBER: 590
SETTINGS_FILE := settings.bsp SETTINGS_FILE := settings.bsp
@ -105,52 +105,52 @@ SOPC_FILE := ../../sys.sopcinfo
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# TOOL & COMMAND DEFINITIONS # TOOL & COMMAND DEFINITIONS
# #
# The base command for each build operation are expressed here. Additional # The base command for each build operation are expressed here. Additional
# switches may be expressed here. They will run for all instances of the # switches may be expressed here. They will run for all instances of the
# utility. # utility.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Archiver command. Creates library files. # Archiver command. Creates library files.
AR = riscv32-unknown-elf-ar AR = riscv64-unknown-elf-ar
# Assembler command. Note that CC is used for .S files. # Assembler command. Note that CC is used for .S files.
AS = riscv32-unknown-elf-gcc AS = riscv64-unknown-elf-gcc
# Custom flags only passed to the archiver. This content of this variable is # Custom flags only passed to the archiver. This content of this variable is
# directly passed to the archiver rather than the more standard "ARFLAGS". The # directly passed to the archiver rather than the more standard "ARFLAGS". The
# reason for this is that GNU Make assumes some default content in ARFLAGS. # reason for this is that GNU Make assumes some default content in ARFLAGS.
# This setting defines the value of BSP_ARFLAGS in Makefile. # This setting defines the value of BSP_ARFLAGS in Makefile.
BSP_ARFLAGS = -src BSP_ARFLAGS = -src
# Custom flags only passed to the assembler. This setting defines the value of # Custom flags only passed to the assembler. This setting defines the value of
# BSP_ASFLAGS in Makefile. # BSP_ASFLAGS in Makefile.
BSP_ASFLAGS = -Wa,-gdwarf2 BSP_ASFLAGS = -Wa,-gdwarf2
# C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" # C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal"
# optimization, etc. "-O0" is recommended for code that you want to debug since # optimization, etc. "-O0" is recommended for code that you want to debug since
# compiler optimization can remove variables and produce non-sequential # compiler optimization can remove variables and produce non-sequential
# execution of code while debugging. This setting defines the value of # execution of code while debugging. This setting defines the value of
# BSP_CFLAGS_OPTIMIZATION in Makefile. # BSP_CFLAGS_OPTIMIZATION in Makefile.
BSP_CFLAGS_OPTIMIZATION = -Os BSP_CFLAGS_OPTIMIZATION = -Os
# C/C++ compiler warning level. "-Wall" is commonly used.This setting defines # C/C++ compiler warning level. "-Wall" is commonly used.This setting defines
# the value of BSP_CFLAGS_WARNINGS in Makefile. # the value of BSP_CFLAGS_WARNINGS in Makefile.
BSP_CFLAGS_WARNINGS = -Wall BSP_CFLAGS_WARNINGS = -Wall
# C compiler command. # C compiler command.
CC = riscv32-unknown-elf-gcc -xc CC = riscv64-unknown-elf-gcc -xc
# C++ compiler command. # C++ compiler command.
CXX = riscv32-unknown-elf-gcc -xc++ CXX = riscv64-unknown-elf-gcc -xc++
# Command used to remove files during 'clean' target. # Command used to remove files during 'clean' target.
RM = rm -f RM = rm -f
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BUILD PRE & POST PROCESS COMMANDS # BUILD PRE & POST PROCESS COMMANDS
# #
# The following variables are treated as shell commands in the rule # The following variables are treated as shell commands in the rule
# definitions for each file-type associated with the BSP build, as well as # definitions for each file-type associated with the BSP build, as well as
# commands run at the beginning and end of the entire BSP build operation. # commands run at the beginning and end of the entire BSP build operation.
@ -158,7 +158,7 @@ RM = rm -f
# a command defined in the "CC_PRE_PROCESS" variable executes before the C # a command defined in the "CC_PRE_PROCESS" variable executes before the C
# compiler for building .c files), while post-process commands are executed # compiler for building .c files), while post-process commands are executed
# immediately afterwards. # immediately afterwards.
# #
# You can view each pre/post-process command in the "Build Rules: All & # You can view each pre/post-process command in the "Build Rules: All &
# Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of # Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of
# this Makefile. # this Makefile.
@ -167,33 +167,33 @@ RM = rm -f
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BSP SOURCE BUILD SETTINGS (FLAG GENERATION) # BSP SOURCE BUILD SETTINGS (FLAG GENERATION)
# #
# Software build settings such as compiler optimization, debug level, warning # Software build settings such as compiler optimization, debug level, warning
# flags, etc., may be defined in the following variables. The variables below # flags, etc., may be defined in the following variables. The variables below
# are concatenated together in the 'Flags' section of this Makefile to form # are concatenated together in the 'Flags' section of this Makefile to form
# final variables of flags passed to the build tools. # final variables of flags passed to the build tools.
# #
# These settings are considered private to the BSP and apply to all library & # These settings are considered private to the BSP and apply to all library &
# driver files in it; they do NOT automatically propagate to, for example, the # driver files in it; they do NOT automatically propagate to, for example, the
# build settings for an application. # build settings for an application.
# # For additional detail and syntax requirements, please refer to GCC help # # For additional detail and syntax requirements, please refer to GCC help
# (example: "nios2-elf-gcc --help --verbose"). # (example: "nios2-elf-gcc --help --verbose").
# #
# Unless indicated otherwise, multiple entries in each variable should be # Unless indicated otherwise, multiple entries in each variable should be
# space-separated. # space-separated.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Altera HAL alt_sys_init.c generated source file # Altera HAL alt_sys_init.c generated source file
GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c
GENERATED_C_LIB_SRCS += alt_sys_init.c GENERATED_C_LIB_SRCS += alt_sys_init.c
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BSP SOURCE FILE LISTING # BSP SOURCE FILE LISTING
# #
# All source files that comprise the BSP are listed here, along with path # All source files that comprise the BSP are listed here, along with path
# information to each file expressed relative to the BSP root. The precise # information to each file expressed relative to the BSP root. The precise
# list and location of each file is derived from the driver, operating system, # list and location of each file is derived from the driver, operating system,
# or software package source file declarations. # or software package source file declarations.
# #
# Following specification of the source files for each component, driver, etc., # Following specification of the source files for each component, driver, etc.,
@ -202,10 +202,10 @@ GENERATED_C_LIB_SRCS += alt_sys_init.c
# used to build each file. # used to build each file.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# altera_avalon_jtag_uart_driver sources root # altera_avalon_jtag_uart_driver sources root
altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers
# altera_avalon_jtag_uart_driver sources # altera_avalon_jtag_uart_driver sources
altera_avalon_jtag_uart_driver_C_LIB_SRCS := \ altera_avalon_jtag_uart_driver_C_LIB_SRCS := \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \
@ -213,14 +213,14 @@ altera_avalon_jtag_uart_driver_C_LIB_SRCS := \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c
# altera_avalon_pio_driver sources root # altera_avalon_pio_driver sources root
altera_avalon_pio_driver_SRCS_ROOT := drivers altera_avalon_pio_driver_SRCS_ROOT := drivers
# altera_avalon_pio_driver sources # altera_avalon_pio_driver sources
# altera_avalon_timer_driver sources root # altera_avalon_timer_driver sources root
altera_avalon_timer_driver_SRCS_ROOT := drivers altera_avalon_timer_driver_SRCS_ROOT := drivers
# altera_avalon_timer_driver sources # altera_avalon_timer_driver sources
altera_avalon_timer_driver_C_LIB_SRCS := \ altera_avalon_timer_driver_C_LIB_SRCS := \
$(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_ts.c \ $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_ts.c \
$(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_vars.c $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_vars.c
@ -232,10 +232,10 @@ altera_epcq_controller2_driver_SRCS_ROOT := drivers
altera_epcq_controller2_driver_C_LIB_SRCS := \ altera_epcq_controller2_driver_C_LIB_SRCS := \
$(altera_epcq_controller2_driver_SRCS_ROOT)/src/altera_epcq_controller2.c $(altera_epcq_controller2_driver_SRCS_ROOT)/src/altera_epcq_controller2.c
# altera_nios2_gen2_hal_driver sources root # altera_nios2_gen2_hal_driver sources root
altera_nios2_gen2_hal_driver_SRCS_ROOT := HAL altera_nios2_gen2_hal_driver_SRCS_ROOT := HAL
# altera_nios2_gen2_hal_driver sources # altera_nios2_gen2_hal_driver sources
altera_nios2_gen2_hal_driver_C_LIB_SRCS := \ altera_nios2_gen2_hal_driver_C_LIB_SRCS := \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_usleep.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_usleep.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_printf.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_printf.c \
@ -251,28 +251,28 @@ altera_nios2_gen2_hal_driver_C_LIB_SRCS := \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c
# hal sources root # hal sources root
hal_SRCS_ROOT := HAL hal_SRCS_ROOT := HAL
# hal sources # hal sources
hal_C_LIB_SRCS := \ hal_C_LIB_SRCS := \
$(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \ $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \
$(hal_SRCS_ROOT)/src/alt_errno.c \ $(hal_SRCS_ROOT)/src/alt_errno.c \
$(hal_SRCS_ROOT)/src/alt_flash_dev.c \ $(hal_SRCS_ROOT)/src/alt_flash_dev.c \
$(hal_SRCS_ROOT)/src/alt_main.c $(hal_SRCS_ROOT)/src/alt_main.c
# i2c_opencores_driver sources root # i2c_opencores_driver sources root
i2c_opencores_driver_SRCS_ROOT := drivers i2c_opencores_driver_SRCS_ROOT := drivers
# i2c_opencores_driver sources # i2c_opencores_driver sources
i2c_opencores_driver_C_LIB_SRCS := \ i2c_opencores_driver_C_LIB_SRCS := \
$(i2c_opencores_driver_SRCS_ROOT)/src/i2c_opencores.c $(i2c_opencores_driver_SRCS_ROOT)/src/i2c_opencores.c
# nios2_hw_crc32_driver sources root # nios2_hw_crc32_driver sources root
nios2_hw_crc32_driver_SRCS_ROOT := drivers nios2_hw_crc32_driver_SRCS_ROOT := drivers
# Assemble all component C source files # Assemble all component C source files
COMPONENT_C_LIB_SRCS += \ COMPONENT_C_LIB_SRCS += \
$(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \ $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \
$(altera_avalon_timer_driver_C_LIB_SRCS) \ $(altera_avalon_timer_driver_C_LIB_SRCS) \
@ -282,11 +282,11 @@ COMPONENT_C_LIB_SRCS += \
$(i2c_opencores_driver_C_LIB_SRCS) \ $(i2c_opencores_driver_C_LIB_SRCS) \
$(nios2_hw_crc32_driver_C_LIB_SRCS) $(nios2_hw_crc32_driver_C_LIB_SRCS)
# Assemble all component assembly source files # Assemble all component assembly source files
COMPONENT_ASM_LIB_SRCS += \ COMPONENT_ASM_LIB_SRCS += \
$(altera_nios2_gen2_hal_driver_ASM_LIB_SRCS) $(altera_nios2_gen2_hal_driver_ASM_LIB_SRCS)
# Assemble all component C++ source files # Assemble all component C++ source files
COMPONENT_CPP_LIB_SRCS += \ COMPONENT_CPP_LIB_SRCS += \
#END MANAGED #END MANAGED
@ -306,7 +306,7 @@ COMPONENT_CPP_LIB_SRCS += \
# purpose of this variable is to allow an external Makefile to append on # purpose of this variable is to allow an external Makefile to append on
# path information to precisely locate paths expressed in public.mk # path information to precisely locate paths expressed in public.mk
# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right # Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right
# here ("."), at the BSP root. # here ("."), at the BSP root.
# #
# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included. # ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -332,13 +332,14 @@ BSP_CFLAGS += \
$(BSP_CFLAGS_WARNINGS) \ $(BSP_CFLAGS_WARNINGS) \
$(BSP_CFLAGS_USER_FLAGS) \ $(BSP_CFLAGS_USER_FLAGS) \
$(ALT_CFLAGS) \ $(ALT_CFLAGS) \
$(CFLAGS) $(CFLAGS)
# Make ready the final list of include directories and other C pre-processor # Make ready the final list of include directories and other C pre-processor
# flags. Each include path is made ready by prefixing it with "-I". # flags. Each include path is made ready by prefixing it with "-I".
BSP_CPPFLAGS += \ BSP_CPPFLAGS += \
$(addprefix -I, $(BSP_INC_DIRS)) \ $(addprefix -I, $(BSP_INC_DIRS)) \
$(addprefix -I, $(ALT_INCLUDE_DIRS)) \ $(addprefix -I, $(ALT_INCLUDE_DIRS)) \
$(addprefix -I, /usr/lib/picolibc/riscv64-unknown-elf/include) \
$(ALT_CPPFLAGS) \ $(ALT_CPPFLAGS) \
$(CPPFLAGS) $(CPPFLAGS)
@ -408,7 +409,7 @@ DEPS = $(OBJS:.o=.d)
# Rules to force your project to rebuild or relink # Rules to force your project to rebuild or relink
# .force_relink file will cause any application that depends on this project to relink # .force_relink file will cause any application that depends on this project to relink
# .force_rebuild file will cause this project to rebuild object files # .force_rebuild file will cause this project to rebuild object files
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files # .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
@ -691,7 +692,7 @@ endif
ifneq ($(NEWLIB_DIR),) ifneq ($(NEWLIB_DIR),)
$(NEWLIB_DIR): $(NEWLIB_DIR):
@$(ECHO) Creating $(NEWLIB_DIR)... @$(ECHO) Creating $(NEWLIB_DIR)...
nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)" nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)"
@$(ECHO) Removing $(NEWLIB_DIR)-build-tmp... @$(ECHO) Removing $(NEWLIB_DIR)-build-tmp...
@$(RM) -rf $(NEWLIB_DIR)-build-tmp @$(RM) -rf $(NEWLIB_DIR)-build-tmp
endif endif