Преглед на файлове

build: Change board and core to upstream

joshua stein преди 2 години
родител
ревизия
487374ba32
променени са 3 файла, в които са добавени 25 реда и са изтрити 7 реда
  1. 22 2
      lib/BlueSCSI_platform_RP2040/BlueSCSI_platform.cpp
  2. 1 1
      lib/BlueSCSI_platform_RP2040/scsi_accel_rp2040.cpp
  3. 2 4
      platformio.ini

+ 22 - 2
lib/BlueSCSI_platform_RP2040/BlueSCSI_platform.cpp

@@ -12,12 +12,13 @@
 #include <hardware/adc.h>
 #include <hardware/flash.h>
 #include <hardware/structs/xip_ctrl.h>
-#ifdef MBED
 #include <hardware/structs/usb.h>
+#ifdef MBED
 #include <platform/mbed_error.h>
-#include <multicore.h>
 #include <USB/PluggableUSBSerial.h>
 #include "audio.h"
+#endif
+#include <pico/multicore.h>
 #include "scsi_accel_rp2040.h"
 
 extern "C" {
@@ -28,7 +29,9 @@ static bool g_scsi_initiator = false;
 static uint32_t g_flash_chip_size = 0;
 static bool g_uart_initialized = false;
 
+#ifdef MBED
 void mbed_error_hook(const mbed_error_ctx * error_context);
+#endif
 
 /***************/
 /* GPIO init   */
@@ -112,7 +115,9 @@ void platform_init()
     gpio_conf(SWO_PIN,        GPIO_FUNC_UART,false,false, true,  false, true);
     uart_init(uart0, 115200);
     g_uart_initialized = true;
+    #ifdef MBED
     mbed_set_error_hook(mbed_error_hook);
+    #endif
 
     //log("DIP switch settings: debug log ", (int)dbglog, ", termination ", (int)termination);
     log("Platform: ", g_platform_name);
@@ -335,6 +340,7 @@ void platform_emergency_log_save()
     crashfile.close();
 }
 
+#ifdef MBED
 void mbed_error_hook(const mbed_error_ctx * error_context)
 {
     log("--------------");
@@ -378,6 +384,7 @@ void mbed_error_hook(const mbed_error_ctx * error_context)
         for (int j = 0; j < base_delay * 10; j++) delay_ns(100000);
     }
 }
+#endif
 
 /*****************************************/
 /* Debug logging and watchdog            */
@@ -392,6 +399,7 @@ void mbed_error_hook(const mbed_error_ctx * error_context)
 // also starts calling this after 2 seconds.
 // This ensures that log messages get passed even if code hangs,
 // but does not unnecessarily delay normal execution.
+#ifdef MBED
 static void usb_log_poll()
 {
     static uint32_t logpos = 0;
@@ -414,6 +422,7 @@ static void usb_log_poll()
         logpos -= available - actual;
     }
 }
+#endif
 
 // Use ADC to implement supply voltage monitoring for the +3.0V rail.
 // This works by sampling the temperature sensor channel, which has
@@ -494,11 +503,13 @@ static void watchdog_callback(unsigned alarm_num)
 {
     g_watchdog_timeout -= 1000;
 
+#ifdef MBED
     if (g_watchdog_timeout < WATCHDOG_CRASH_TIMEOUT - 1000)
     {
         // Been stuck for at least a second, start dumping USB log
         usb_log_poll();
     }
+#endif
 
     if (g_watchdog_timeout <= WATCHDOG_CRASH_TIMEOUT - WATCHDOG_BUS_RESET_TIMEOUT)
     {
@@ -545,7 +556,9 @@ static void watchdog_callback(unsigned alarm_num)
                 p += 4;
             }
 
+#ifdef MBED
             usb_log_poll();
+#endif
             platform_emergency_log_save();
 
             platform_boot_to_main_firmware();
@@ -569,16 +582,20 @@ void platform_reset_watchdog()
         g_watchdog_initialized = true;
     }
 
+#ifdef MBED
     // USB log is polled here also to make sure any log messages in fault states
     // get passed to USB.
     usb_log_poll();
+#endif
 }
 
 // Poll function that is called every few milliseconds.
 // Can be left empty or used for platform-specific processing.
 void platform_poll()
 {
+#ifdef MBED
     usb_log_poll();
+#endif
     adc_poll();
     
 #ifdef ENABLE_AUDIO_OUTPUT
@@ -638,12 +655,14 @@ bool platform_rewrite_flash_page(uint32_t offset, uint8_t buffer[PLATFORM_FLASH_
         }
     }
 
+#ifdef MBED
     if (NVIC_GetEnableIRQ(USBCTRL_IRQn))
     {
         log("Disabling USB during firmware flashing");
         NVIC_DisableIRQ(USBCTRL_IRQn);
         usb_hw->main_ctrl = 0;
     }
+#endif
 
     debuglog("Writing flash at offset ", offset, " data ", bytearray(buffer, 4));
     assert(offset % PLATFORM_FLASH_PAGE_SIZE == 0);
@@ -876,6 +895,7 @@ const uint16_t g_scsi_parity_check_lookup[512] __attribute__((aligned(1024), sec
 
 } /* extern "C" */
 
+#ifdef MBED
 /* Logging from mbed */
 
 static class LogTarget: public mbed::FileHandle {

+ 1 - 1
lib/BlueSCSI_platform_RP2040/scsi_accel_rp2040.cpp

@@ -16,7 +16,7 @@
 #include <hardware/structs/iobank0.h>
 #include <hardware/sync.h>
 #include <audio.h>
-#include <multicore.h>
+#include <pico/multicore.h>
 
 // SCSI bus write acceleration uses up to 3 PIO state machines:
 // SM0: Convert data bytes to lookup addresses to add parity

+ 2 - 4
platformio.ini

@@ -16,10 +16,8 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git
 platform_packages = platformio/toolchain-gccarmnoneeabi@1.100301.220327
     framework-arduinopico@https://github.com/BlueSCSI/arduino-pico-internal.git#f0a51a8eef41df659cb5e0d495a7fa03a6d28666
 framework = arduino
-board = BlueSCSI_RP2040
-extra_scripts = src/build_bootloader.py
-board_build.ldscript = lib/BlueSCSI_platform_RP2040/rp2040.ld
-ldscript_bootloader = lib/BlueSCSI_platform_RP2040/rp2040_btldr.ld
+board = rpipicow
+board_build.core = earlephilhower
 lib_deps =
     SdFat=https://github.com/BlueSCSI/SdFat#2.2.0-gpt
     minIni