Skip to content

Commit

Permalink
Merge pull request #871 from 32blit/toolchain-2350-misc-fixes
Browse files Browse the repository at this point in the history
Small collection of fixes
  • Loading branch information
Daft-Freak authored Nov 7, 2024
2 parents 349bd9a + 7551227 commit 6055a95
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
11 changes: 6 additions & 5 deletions 32blit-pico/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ else()
set(BOARD_ID ${PICO_BOARD})
endif()

if(EXISTS ${CONFIG_PATH}/config.cmake)
include(${CONFIG_PATH}/config.cmake)
message("Using board config \"${BLIT_BOARD_NAME}\"")
else()
include(${CMAKE_CURRENT_LIST_DIR}/board/pico/config.cmake)
if(NOT EXISTS ${CONFIG_PATH}/config.cmake)
set(CONFIG_PATH ${CMAKE_CURRENT_LIST_DIR}/board/pico)
if(DEFINED PICO_ADDON)
message(WARNING "Using default config for \"${PICO_BOARD}\", add-on \"${PICO_ADDON}\"...")
else()
message(WARNING "Using default config for \"${PICO_BOARD}\"...")
endif()
endif()

include(${CONFIG_PATH}/config.cmake)
message("Using board config \"${BLIT_BOARD_NAME}\"")

if(EXISTS ${CONFIG_PATH}/config.h)
list(APPEND BLIT_BOARD_DEFINITIONS "BLIT_BOARD_CONFIG=\"${CONFIG_PATH}/config.h\"")
endif()
Expand Down Expand Up @@ -179,6 +179,7 @@ function(blit_executable NAME)
blit_executable_args(${ARGN})

add_executable(${NAME} ${SOURCES})
target_compile_definitions(${NAME} PRIVATE PICO_EMBED_XIP_SETUP=1)
target_link_libraries(${NAME} BlitHalPico BlitEngine)

pico_enable_stdio_uart(${NAME} 1)
Expand Down
4 changes: 4 additions & 0 deletions 32blit-pico/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "input.hpp"
#include "led.hpp"
#include "multiplayer.hpp"
#include "storage.hpp"
#include "usb.hpp"

#include "engine/api_private.hpp"
Expand Down Expand Up @@ -203,10 +204,13 @@ static void alarm_callback(uint alarm_num) {

int main() {
#if OVERCLOCK_250
#ifndef PICO_RP2350
// Apply a modest overvolt, default is 1.10v.
// this is required for a stable 250MHz on some RP2040s
vreg_set_voltage(VREG_VOLTAGE_1_20);
sleep_ms(10);
#endif

set_sys_clock_khz(250000, false);
#endif

Expand Down
5 changes: 2 additions & 3 deletions 32blit/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace blit {

if(new_screen.pen_blend)
screen.pbf = new_screen.pen_blend;

if(new_screen.blit_blend)
screen.bbf = new_screen.blit_blend;

Expand Down Expand Up @@ -89,8 +89,7 @@ namespace blit {
return ret;
}

Surface null_surface(nullptr, PixelFormat::M, Size(0, 0));
Surface &screen = null_surface;
Surface screen(nullptr, PixelFormat::M, Size(0, 0));

static const uint32_t update_rate_ms = 10;
static uint32_t pending_update_time = 0;
Expand Down
2 changes: 1 addition & 1 deletion 32blit/engine/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace blit {

enum ScreenMode { lores, hires, hires_palette };
extern Surface &screen;
extern Surface screen;


extern void (*init) ();
Expand Down
4 changes: 2 additions & 2 deletions pico.toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m0plus -mthumb")

include(${CMAKE_CURRENT_LIST_DIR}/pico-common.toolchain)

if (NOT PICO_BOARD)
if (NOT PICO_BOARD AND NOT PICO_ADDON)
set(PICO_BOARD pimoroni_picosystem)
endif()
endif()
6 changes: 5 additions & 1 deletion pico2.toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ if (NOT PICO_NO_CMSE)
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mcmse")
endif()

include(${CMAKE_CURRENT_LIST_DIR}/pico-common.toolchain)
include(${CMAKE_CURRENT_LIST_DIR}/pico-common.toolchain)

if (NOT PICO_BOARD)
set(PICO_BOARD pico2)
endif()

0 comments on commit 6055a95

Please sign in to comment.