瀏覽代碼

Initial port to RP2040 platform.

SD card access works, SCSI does not work yet.

(Out of order)

(cherry picked from commit 62cdd20347f949c3506052984bc1d1989bc67cfa)
Petteri Aimonen 3 年之前
父節點
當前提交
6649f8686f
共有 4 個文件被更改,包括 98 次插入2 次删除
  1. 1 1
      platformio.ini
  2. 1 1
      utils/rename_binaries.sh
  3. 96 0
      utils/rp2040_gdb_macros
  4. 0 0
      utils/run_gdb_v1_0.sh

+ 1 - 1
platformio.ini

@@ -1,7 +1,7 @@
 ; PlatformIO Project Configuration File https://docs.platformio.org/page/projectconf.html
 
 [platformio]
-default_envs = ZuluSCSIv1_0, ZuluSCSIv1_1
+default_envs = AzulSCSIv1_0, AzulSCSIv1_1, AzulSCSI_RP2040_v2_0
 
 ; Example platform to serve as a base for porting efforts
 [env:template]

+ 1 - 1
utils/rename_binaries.sh

@@ -8,7 +8,7 @@ mkdir -p distrib
 DATE=$(date +%Y-%m-%d)
 VERSION=$(git describe --always)
 
-for file in $(ls .pio/build/*/*.bin .pio/build/*/*.elf)
+for file in $(ls .pio/build/*/*.bin .pio/build/*/*.elf .pio/build/*/*.uf2)
 do
     NEWNAME=$(echo $file | sed 's|.pio/build/\([^/]*\)/\(.*\)\.\(.*\)|\1_'$DATE'_'$VERSION'.\3|')
     echo $file to distrib/$NEWNAME

+ 96 - 0
utils/rp2040_gdb_macros

@@ -0,0 +1,96 @@
+# Macros to help debugging on RP2040 and other mbed-os / RTX targets using Black Magic Probe
+# Loosely based upon https://github.com/pyocd/pyOCD/pull/392/files
+
+# Get a thread backtrace from hardfault context
+define hardfault_backtrace
+    set $sp = $psp
+    bt
+end
+
+# List current threads
+define threads
+    set $t = &osRtxInfo.thread
+    thread_print_chain $t->run.curr "RUN  "
+    thread_print_chain $t->ready.thread_list "READY"
+    thread_print_chain $t->delay_list "DELAY"
+    thread_print_chain $t->wait_list "WAIT "
+
+    printf "Use thread_bt 0x... to show thread backtrace\n"
+end
+
+define thread_print_chain
+    set $p = $arg0
+    while ($p != 0)
+        printf "%-16s ", $p->name
+        printf $arg1
+        printf " 0x%08x\n", $p->sp
+        set $p = $p->thread_next
+    end
+end
+
+# Switch to different thread
+define thread_switch
+    set $tsp=(uint32_t*)$arg0
+    set $n_r0  =$r0  
+    set $n_r1  =$r1  
+    set $n_r2  =$r2  
+    set $n_r3  =$r3  
+    set $n_r4  =$r4  
+    set $n_r5  =$r5  
+    set $n_r6  =$r6  
+    set $n_r7  =$r7  
+    set $n_r8  =$r8  
+    set $n_r9  =$r9  
+    set $n_r10 =$r10 
+    set $n_r11 =$r11 
+    set $n_r12 =$r12 
+    set $n_sp  =$sp  
+    set $n_lr  =$lr  
+    set $n_pc  =$pc  
+    set $n_xPSR=$xPSR
+    set $r4   = $tsp[0]
+    set $r5   = $tsp[1]
+    set $r6   = $tsp[2]
+    set $r7   = $tsp[3]
+    set $r8   = $tsp[4]
+    set $r9   = $tsp[5]
+    set $r10  = $tsp[6]
+    set $r11  = $tsp[7]
+    set $r0   = $tsp[8]
+    set $r1   = $tsp[9]
+    set $r2   = $tsp[10]
+    set $r3   = $tsp[11]
+    set $r12  = $tsp[12]
+    set $lr   = $tsp[13]
+    set $pc   = $tsp[14]
+    set $xPSR = $tsp[15]
+    set $sp   = &$tsp[16]
+
+    echo Switched task, use thread_restore to return before continuing execution.\n
+end
+
+define thread_restore
+    set $r0  =$n_r0  
+    set $r1  =$n_r1  
+    set $r2  =$n_r2  
+    set $r3  =$n_r3  
+    set $r4  =$n_r4  
+    set $r5  =$n_r5  
+    set $r6  =$n_r6  
+    set $r7  =$n_r7  
+    set $r8  =$n_r8  
+    set $r9  =$n_r9  
+    set $r10 =$n_r10 
+    set $r11 =$n_r11 
+    set $r12 =$n_r12 
+    set $sp  =$n_sp  
+    set $lr  =$n_lr  
+    set $pc  =$n_pc  
+    set $xPSR=$n_xPSR
+end
+
+define thread_bt
+    thread_switch $arg0
+    bt
+    thread_restore
+end

+ 0 - 0
utils/run_gdb.sh → utils/run_gdb_v1_0.sh