Эх сурвалжийг харах

Fix broken builds and adjust SRAM and FLASH usage

Hid the network WiFi includes in such a way that the GD32F205 target
in PlatformIO doesn't compile the DaynaPORT RP2040 code. This is
generally cause by PlatformIO's LDF not respecting ifdef macros around
includes.

Tuned the SRAM consumption by increasing the usable SRAM in
the linker file, `rp2040-daynaport.ld`, and decreasing the
log buffer along with adjusting network frame buffer depth.

Also adjusted the Flash size on 4kb boundaries to about the same
size as the firmware compiles to.
Morio 2 жил өмнө
parent
commit
b9c0c67ab0

+ 2 - 2
lib/SCSI2SD/src/firmware/network.c

@@ -14,14 +14,13 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
  */
 
 
+#ifdef ZULUSCSI_NETWORK
 #include <string.h>
 #include <string.h>
-
 #include "scsi.h"
 #include "scsi.h"
 #include "scsi2sd_time.h"
 #include "scsi2sd_time.h"
 #include "scsiPhy.h"
 #include "scsiPhy.h"
 #include "config.h"
 #include "config.h"
 #include "network.h"
 #include "network.h"
-#include <ZuluSCSI_platform_network.h>
 
 
 extern bool g_log_debug;
 extern bool g_log_debug;
 
 
@@ -483,3 +482,4 @@ int scsiNetworkPurge(void)
 
 
 	return sent;
 	return sent;
 }
 }
+#endif // ZULUSCSI_NETWORK

+ 7 - 4
lib/SCSI2SD/src/firmware/network.h

@@ -16,7 +16,7 @@
 
 
 #ifndef NETWORK_H
 #ifndef NETWORK_H
 #define NETWORK_H
 #define NETWORK_H
-
+#ifdef ZULUSCSI_NETWORK
 #include <sys/types.h>
 #include <sys/types.h>
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
@@ -30,7 +30,10 @@ extern "C" {
 #define SCSI_NETWORK_WIFI_CMD_INFO			0x04
 #define SCSI_NETWORK_WIFI_CMD_INFO			0x04
 #define SCSI_NETWORK_WIFI_CMD_JOIN			0x05
 #define SCSI_NETWORK_WIFI_CMD_JOIN			0x05
 
 
-#define NETWORK_PACKET_QUEUE_SIZE   7		// must be <= 255
+#ifndef NETWORK_PACKET_QUEUE_SIZE
+# define NETWORK_PACKET_QUEUE_SIZE   10		// must be <= 255
+#endif
+
 #define NETWORK_PACKET_MAX_SIZE     1520
 #define NETWORK_PACKET_MAX_SIZE     1520
 
 
 int scsiNetworkCommand(void);
 int scsiNetworkCommand(void);
@@ -40,5 +43,5 @@ int scsiNetworkPurge(void);
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
-
-#endif
+#endif // ZULUSCSI_NETWORK
+#endif // NETWORK_H

+ 0 - 3
lib/SCSI2SD/src/firmware/scsi.c

@@ -29,10 +29,7 @@
 #include "scsi2sd_time.h"
 #include "scsi2sd_time.h"
 #include "bsp.h"
 #include "bsp.h"
 #include "cdrom.h"
 #include "cdrom.h"
-//#include "debug.h"
-#ifdef ZULUSCSI_NETWORK
 #include "network.h"
 #include "network.h"
-#endif // ZULUSCSI_NETWORK
 #include "tape.h"
 #include "tape.h"
 #include "mo.h"
 #include "mo.h"
 #include "vendor.h"
 #include "vendor.h"

+ 3 - 3
lib/ZuluSCSI_platform_RP2040/rp2040-daynaport.ld

@@ -21,8 +21,8 @@
 
 
 MEMORY
 MEMORY
 {
 {
-    FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 1m
-    RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 242k  /* Leave space for pico-debug */
+    FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 528k
+    RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k  /* Leave space for pico-debug */
     SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
     SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
     SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
     SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
 }
 }
@@ -87,7 +87,7 @@ SECTIONS
         *libc*:*toa*(.text .text*)
         *libc*:*toa*(.text .text*)
         *libminIni.a:(.text .text*)
         *libminIni.a:(.text .text*)
         *libCUEParser.a:(.text .text*)
         *libCUEParser.a:(.text .text*)
-      /*  *libFrameworkArduino.a(.text .text*) */
+
         /* RP2040 breakpoints in RAM code don't always work very well
         /* RP2040 breakpoints in RAM code don't always work very well
          * because the boot routine tends to overwrite them.
          * because the boot routine tends to overwrite them.
          * Uncommenting this line puts all code in flash.
          * Uncommenting this line puts all code in flash.

+ 13 - 1
platformio.ini

@@ -129,6 +129,7 @@ build_flags =
 platform = https://github.com/maxgerhardt/platform-raspberrypi.git
 platform = https://github.com/maxgerhardt/platform-raspberrypi.git
 platform_packages =
 platform_packages =
     framework-arduinopico@https://github.com/rabbitholecomputing/arduino-pico.git#v3.6.0-DaynaPORT
     framework-arduinopico@https://github.com/rabbitholecomputing/arduino-pico.git#v3.6.0-DaynaPORT
+    earlephilhower/toolchain-rp2040-earlephilhower@^5.100300.230216
 framework = arduino
 framework = arduino
 board = rpipicow
 board = rpipicow
 board_build.core = earlephilhower
 board_build.core = earlephilhower
@@ -153,7 +154,18 @@ build_flags =
     -DZULUSCSI_PICO
     -DZULUSCSI_PICO
     -DZULUSCSI_NETWORK
     -DZULUSCSI_NETWORK
     -DZULUSCSI_DAYNAPORT
     -DZULUSCSI_DAYNAPORT
-    -DLOGBUFSIZE=4096
+; These take a large portion of the SRAM and can be adjusted
+; It is important to leave enough free space for USB serial to work
+;   Around 7220 bytes seems to be enough.
+; The current settings use too much SRAM to debug the board over SWD
+; The values can be adjusted down to get a debug build to fit to SRAM
+    -DLOGBUFSIZE=6144
+    -DPREFETCH_BUFFER_SIZE=8192
+    ; This controls the depth of 2 x NETWORK_PACKET_MAX_SIZE (1520 bytes)
+    ; For example a queue size of 10 would be 10 x 2 x 1520 = 30400 bytes
+    -DNETWORK_PACKET_QUEUE_SIZE=10
+
+
 ; build flags mirroring the framework-arduinopico#v3.6.0-DaynaPORT static library build
 ; build flags mirroring the framework-arduinopico#v3.6.0-DaynaPORT static library build
     -DPICO_CYW43_ARCH_POLL=1
     -DPICO_CYW43_ARCH_POLL=1
 	-DCYW43_LWIP=0
 	-DCYW43_LWIP=0

+ 1 - 1
src/ZuluSCSI_config.h

@@ -28,7 +28,7 @@
 #include <ZuluSCSI_platform.h>
 #include <ZuluSCSI_platform.h>
 
 
 // Use variables for version number
 // Use variables for version number
-#define FW_VER_NUM      "23.09.25"
+#define FW_VER_NUM      "23.10.05"
 #define FW_VER_SUFFIX   "wifi-dev"
 #define FW_VER_SUFFIX   "wifi-dev"
 #define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
 #define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
 
 

+ 5 - 0
zuluscsi.ini

@@ -48,6 +48,11 @@
 #CDAVolume = 63 # Change CD Audio default volume. Maximum 255.
 #CDAVolume = 63 # Change CD Audio default volume. Maximum 255.
 #DisableMacSanityCheck = 0 # Disable sanity warnings for Mac disk drives. Default is 0 - enable checks
 #DisableMacSanityCheck = 0 # Disable sanity warnings for Mac disk drives. Default is 0 - enable checks
 
 
+# SCSI DaynaPORT settings
+#WiFiSSID = "Wifi SSID string"
+#WiFiPassword = "WiFi Password"
+#WiFiMACAddress = "01:23:45:67:89"
+
 # Settings can be overridden for individual devices.
 # Settings can be overridden for individual devices.
 #[SCSI2]
 #[SCSI2]
 #Product = "Disk with ID2"
 #Product = "Disk with ID2"