From 0a828e79a394df28c2f1c20c065c01e3b9e0355c Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Fri, 1 Nov 2024 14:58:28 +0200 Subject: [PATCH] GD32F205: Fix build errors There is circular dependency as GD32F205 platform includes ZuluSCSI_disk.h for the prefetchbytes workaround. This requires `lib_ldf_mode = chain+` for platformio. In addition the GD32F205 with audio buffers is very low on RAM. Moved some constants into flash so that the new multi-bin/cue support fits. --- .../gd32_cdc_acm_core.c | 2 +- .../scsi_accel_dma.cpp | 2 +- .../usbd_msc_core.c | 2 +- platformio.ini | 1 + src/ZuluSCSI_settings.cpp | 38 +++++++++---------- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/ZuluSCSI_platform_GD32F205/gd32_cdc_acm_core.c b/lib/ZuluSCSI_platform_GD32F205/gd32_cdc_acm_core.c index bc7b710f..448d0db3 100644 --- a/lib/ZuluSCSI_platform_GD32F205/gd32_cdc_acm_core.c +++ b/lib/ZuluSCSI_platform_GD32F205/gd32_cdc_acm_core.c @@ -233,7 +233,7 @@ static const usb_desc_str product_string = }; /* USBD serial string */ -static usb_desc_str serial_string = +static const usb_desc_str serial_string = { .header = { diff --git a/lib/ZuluSCSI_platform_GD32F205/scsi_accel_dma.cpp b/lib/ZuluSCSI_platform_GD32F205/scsi_accel_dma.cpp index 20a05e6f..2032888a 100644 --- a/lib/ZuluSCSI_platform_GD32F205/scsi_accel_dma.cpp +++ b/lib/ZuluSCSI_platform_GD32F205/scsi_accel_dma.cpp @@ -704,4 +704,4 @@ static void greenpak_stop_dma() exti_interrupt_disable(GREENPAK_PLD_IO2_EXTI); } -#endif \ No newline at end of file +#endif diff --git a/lib/ZuluSCSI_platform_GD32F205/usbd_msc_core.c b/lib/ZuluSCSI_platform_GD32F205/usbd_msc_core.c index 89ae7203..2ec5d212 100644 --- a/lib/ZuluSCSI_platform_GD32F205/usbd_msc_core.c +++ b/lib/ZuluSCSI_platform_GD32F205/usbd_msc_core.c @@ -167,7 +167,7 @@ static __ALIGN_BEGIN const usb_desc_str product_string __ALIGN_END = { }; /* USBD serial string */ -static __ALIGN_BEGIN usb_desc_str serial_string __ALIGN_END = { +static __ALIGN_BEGIN const usb_desc_str serial_string __ALIGN_END = { .header = { .bLength = USB_STRING_LEN(12U), diff --git a/platformio.ini b/platformio.ini index 350ed299..11b63694 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,6 +33,7 @@ board_build.ldscript = lib/ZuluSCSI_platform_GD32F205/zuluscsi_gd32f205.ld ldscript_bootloader = lib/ZuluSCSI_platform_GD32F205/zuluscsi_gd32f205_btldr.ld framework = spl lib_compat_mode = off +lib_ldf_mode = chain+ lib_deps = SdFat=https://github.com/rabbitholecomputing/SdFat#2.2.3-gpt minIni diff --git a/src/ZuluSCSI_settings.cpp b/src/ZuluSCSI_settings.cpp index cb84ee36..21795c67 100644 --- a/src/ZuluSCSI_settings.cpp +++ b/src/ZuluSCSI_settings.cpp @@ -104,25 +104,25 @@ void ZuluSCSISettings::setDefaultDriveInfo(uint8_t scsiId, const char *presetNam - static const char *driveinfo_fixed[4] = DRIVEINFO_FIXED; - static const char *driveinfo_removable[4] = DRIVEINFO_REMOVABLE; - static const char *driveinfo_optical[4] = DRIVEINFO_OPTICAL; - static const char *driveinfo_floppy[4] = DRIVEINFO_FLOPPY; - static const char *driveinfo_magopt[4] = DRIVEINFO_MAGOPT; - static const char *driveinfo_network[4] = DRIVEINFO_NETWORK; - static const char *driveinfo_tape[4] = DRIVEINFO_TAPE; - - static const char *apl_driveinfo_fixed[4] = APPLE_DRIVEINFO_FIXED; - static const char *apl_driveinfo_removable[4] = APPLE_DRIVEINFO_REMOVABLE; - static const char *apl_driveinfo_optical[4] = APPLE_DRIVEINFO_OPTICAL; - static const char *apl_driveinfo_floppy[4] = APPLE_DRIVEINFO_FLOPPY; - static const char *apl_driveinfo_magopt[4] = APPLE_DRIVEINFO_MAGOPT; - static const char *apl_driveinfo_network[4] = APPLE_DRIVEINFO_NETWORK; - static const char *apl_driveinfo_tape[4] = APPLE_DRIVEINFO_TAPE; - - static const char *iomega_driveinfo_removeable[4] = IOMEGA_DRIVEINFO_ZIP100; + static const char * const driveinfo_fixed[4] = DRIVEINFO_FIXED; + static const char * const driveinfo_removable[4] = DRIVEINFO_REMOVABLE; + static const char * const driveinfo_optical[4] = DRIVEINFO_OPTICAL; + static const char * const driveinfo_floppy[4] = DRIVEINFO_FLOPPY; + static const char * const driveinfo_magopt[4] = DRIVEINFO_MAGOPT; + static const char * const driveinfo_network[4] = DRIVEINFO_NETWORK; + static const char * const driveinfo_tape[4] = DRIVEINFO_TAPE; + + static const char * const apl_driveinfo_fixed[4] = APPLE_DRIVEINFO_FIXED; + static const char * const apl_driveinfo_removable[4] = APPLE_DRIVEINFO_REMOVABLE; + static const char * const apl_driveinfo_optical[4] = APPLE_DRIVEINFO_OPTICAL; + static const char * const apl_driveinfo_floppy[4] = APPLE_DRIVEINFO_FLOPPY; + static const char * const apl_driveinfo_magopt[4] = APPLE_DRIVEINFO_MAGOPT; + static const char * const apl_driveinfo_network[4] = APPLE_DRIVEINFO_NETWORK; + static const char * const apl_driveinfo_tape[4] = APPLE_DRIVEINFO_TAPE; + + static const char * const iomega_driveinfo_removeable[4] = IOMEGA_DRIVEINFO_ZIP100; - const char **driveinfo = NULL; + const char * const * driveinfo = NULL; bool known_preset = false; scsi_system_settings_t& cfgSys = m_sys; @@ -483,4 +483,4 @@ scsi_device_preset_t ZuluSCSISettings::getDevicePreset(uint8_t scsiId) const char* ZuluSCSISettings::getDevicePresetName(uint8_t scsiId) { return devicePresetName[m_devPreset[scsiId]]; -} \ No newline at end of file +}