浏览代码

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 年之前
父节点
当前提交
949b392350
共有 1 个文件被更改,包括 23 次插入2 次删除
  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);