Преглед изворни кода

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 година
родитељ
комит
b9c0c67ab0

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

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

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

@@ -16,7 +16,7 @@
 
 #ifndef NETWORK_H
 #define NETWORK_H
-
+#ifdef ZULUSCSI_NETWORK
 #include <sys/types.h>
 
 #ifdef __cplusplus
@@ -30,7 +30,10 @@ extern "C" {
 #define SCSI_NETWORK_WIFI_CMD_INFO			0x04
 #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
 
 int scsiNetworkCommand(void);
@@ -40,5 +43,5 @@ int scsiNetworkPurge(void);
 #ifdef __cplusplus
 }
 #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 "bsp.h"
 #include "cdrom.h"
-//#include "debug.h"
-#ifdef ZULUSCSI_NETWORK
 #include "network.h"
-#endif // ZULUSCSI_NETWORK
 #include "tape.h"
 #include "mo.h"
 #include "vendor.h"

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

@@ -21,8 +21,8 @@
 
 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_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
 }
@@ -87,7 +87,7 @@ SECTIONS
         *libc*:*toa*(.text .text*)
         *libminIni.a:(.text .text*)
         *libCUEParser.a:(.text .text*)
-      /*  *libFrameworkArduino.a(.text .text*) */
+
         /* RP2040 breakpoints in RAM code don't always work very well
          * because the boot routine tends to overwrite them.
          * 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_packages =
     framework-arduinopico@https://github.com/rabbitholecomputing/arduino-pico.git#v3.6.0-DaynaPORT
+    earlephilhower/toolchain-rp2040-earlephilhower@^5.100300.230216
 framework = arduino
 board = rpipicow
 board_build.core = earlephilhower
@@ -153,7 +154,18 @@ build_flags =
     -DZULUSCSI_PICO
     -DZULUSCSI_NETWORK
     -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
     -DPICO_CYW43_ARCH_POLL=1
 	-DCYW43_LWIP=0

+ 1 - 1
src/ZuluSCSI_config.h

@@ -28,7 +28,7 @@
 #include <ZuluSCSI_platform.h>
 
 // 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 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.
 #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.
 #[SCSI2]
 #Product = "Disk with ID2"