diodep / ch55x_jtag

CH55x USB to JTAG bridge
125 stars 34 forks source link

main: Change memory space for ring buffer pointers #9

Closed vowstar closed 2 months ago

vowstar commented 7 months ago

Closes: https://github.com/diodep/ch55x_jtag/issues/8

kimstik commented 7 months ago

grep -E -o "mov\W+r0,#_\w+" src\main.asm | sort | uniq -c | sort -r

shows stats of redundant indirect movements:

53 mov     r0,#_USBOutPtr
29 mov     r0,#_Mpsse_Status
22 mov     r0,#_UpPoint1_Ptr
17 mov     r0,#_Mpsse_LongLen
 9 mov     r0,#_UpPoint1_Busy
 9 mov     r0,#_SOF_Count
 9 mov     r0,#_Mpsse_ShortLen
 8 mov     r0,#_UpPoint3_Busy
 7 mov     r0,#_Serial_Done
 7 mov     r0,#_ReadPtr
 6 mov     r0,#_soft_dtr
 6 mov     r0,#_Modem_Count
 5 mov     r0,#_soft_rts
 5 mov     r0,#_UpPoint3_Ptr
 5 mov     r0,#_USBReceived_1
 5 mov     r0,#_USBReceived
 4 mov     r0,#_Require_DFU
 4 mov     r0,#_Latency_Timer1
 4 mov     r0,#_Latency_Timer
 3 mov     r0,#_USBOutPtr_1
 3 mov     r0,#_USBOutLength_1
 3 mov     r0,#_USBOutLength
 2 mov     r0,#_WritePtr
 2 mov     r0,#_USB_Require_Data
 1 mov     r0,#_DTR_State

I believe that the first four items could potentially be removed from __idata, or perhaps even all of them. I don't see a significant reason to keep them there.