Ver código fonte

RP2040: Put time-critical code in RAM

Loading code from external flash increases latency by small amounts.
In practice the effect is quite minimal due to RP2040 integrated
cache, but there is enough RAM to do this optimization.
Petteri Aimonen 3 anos atrás
pai
commit
949b392350
1 arquivos alterados com 23 adições e 2 exclusões
  1. 23 2
      lib/ZuluSCSI_platform_RP2040/rp2040.ld

+ 23 - 2
lib/ZuluSCSI_platform_RP2040/rp2040.ld

@@ -38,8 +38,23 @@ SECTIONS
         *(.dtors)
         *(.eh_frame*)
         . = ALIGN(4);
-        *(.text)
-        *(.text*)
+
+        /* Put only non-timecritical code in flash
+         * This includes e.g. floating point math routines.
+         */
+        *libm*:(.text .text*)
+        *libc*:(.text .text*)
+        *libgcc*:*df*(.text .text*)
+        *USB*(.text .text*)
+        *SPI*(.text .text*)
+        *Spi*(.text .text*)
+        *spi*(.text .text*)
+        *stdc*:(.text .text*)
+        *supc*:(.text .text*)
+        *nosys*:(.text .text*)
+        *libc*:*printf*(.text .text*)
+        *libc*:*toa*(.text .text*)
+        *libminIni.a:(.text .text*)
     } > FLASH
     .rodata : {
         . = ALIGN(4);
@@ -74,7 +89,13 @@ SECTIONS
     .data : {
         __data_start__ = .;
         *(vtable)
+
+        /* Time critical code will go here to avoid external flash latency */
         *(.time_critical*)
+        . = ALIGN(4);
+        *(.text)
+        *(.text*)
+
         . = ALIGN(4);
         *(.data*)
         . = ALIGN(4);