From 3a750c55cb2b5643228179829a75a47a95451750 Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Sat, 10 Aug 2024 23:13:25 +0100 Subject: [PATCH] Fix release build --- drivers/dvhstx/dvhstx.cmake | 4 ++++ drivers/dvhstx/dvhstx.cpp | 2 +- drivers/dvhstx/dvhstx.hpp | 4 ++-- drivers/dvhstx/dvi.hpp | 16 ++++++++-------- examples/dvhstx/mandelbrot.cpp | 1 - 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/dvhstx/dvhstx.cmake b/drivers/dvhstx/dvhstx.cmake index ac055d7..91c9cf5 100644 --- a/drivers/dvhstx/dvhstx.cmake +++ b/drivers/dvhstx/dvhstx.cmake @@ -10,6 +10,10 @@ target_sources(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/intel_one_mono_2bpp.c ) +# Enforce consistent compile options. +# For the moment, don't use -O3 options that increase code size significantly +target_compile_options(${DRIVER_NAME} INTERFACE -Wall -Werror -O2 -fgcse-after-reload -floop-interchange -fpeel-loops -fpredictive-commoning -fsplit-paths -ftree-loop-distribute-patterns -ftree-loop-distribution -ftree-vectorize -ftree-partial-pre -funswitch-loops) + target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}) # Pull in pico libraries that we need diff --git a/drivers/dvhstx/dvhstx.cpp b/drivers/dvhstx/dvhstx.cpp index 7111cdf..d84fa79 100644 --- a/drivers/dvhstx/dvhstx.cpp +++ b/drivers/dvhstx/dvhstx.cpp @@ -671,7 +671,7 @@ bool DVHSTX::init(uint16_t width, uint16_t height, Mode mode_) memset(frame_buffer_display, 0, frame_width * frame_height * frame_bytes_per_pixel); memset(frame_buffer_back, 0, frame_width * frame_height * frame_bytes_per_pixel); - memset(palette, 0, PALETTE_SIZE); + memset(palette, 0, PALETTE_SIZE * sizeof(palette[0])); frame_buffer_display = frame_buffer_display; diff --git a/drivers/dvhstx/dvhstx.hpp b/drivers/dvhstx/dvhstx.hpp index 6924bfa..fcfbabd 100644 --- a/drivers/dvhstx/dvhstx.hpp +++ b/drivers/dvhstx/dvhstx.hpp @@ -145,8 +145,8 @@ namespace pimoroni { uint32_t* line_buffers; const struct dvi_timing* timing_mode; - uint v_inactive_total; - uint v_total_active_lines; + int v_inactive_total; + int v_total_active_lines; uint h_repeat_shift; uint v_repeat_shift; diff --git a/drivers/dvhstx/dvi.hpp b/drivers/dvhstx/dvi.hpp index 9d8221a..1ee8018 100644 --- a/drivers/dvhstx/dvi.hpp +++ b/drivers/dvhstx/dvi.hpp @@ -31,16 +31,16 @@ struct dvi_timing { bool h_sync_polarity; - uint h_front_porch; - uint h_sync_width; - uint h_back_porch; - uint h_active_pixels; + int h_front_porch; + int h_sync_width; + int h_back_porch; + int h_active_pixels; bool v_sync_polarity; - uint v_front_porch; - uint v_sync_width; - uint v_back_porch; - uint v_active_lines; + int v_front_porch; + int v_sync_width; + int v_back_porch; + int v_active_lines; uint bit_clk_khz; }; diff --git a/examples/dvhstx/mandelbrot.cpp b/examples/dvhstx/mandelbrot.cpp index 8b7756e..c69bf79 100644 --- a/examples/dvhstx/mandelbrot.cpp +++ b/examples/dvhstx/mandelbrot.cpp @@ -108,7 +108,6 @@ int main() { display.init(FRAME_WIDTH, FRAME_HEIGHT, DVHSTX::MODE_PALETTE); stdio_init_all(); - while (!stdio_usb_connected()); init_palette();