Source
...
Target
Commits (1)
  • John Ballance's avatar
    Added additional debugging via HAL_DebugTX with enabling switch · 2536c3ba
    John Ballance authored
    Detail:
      Added some debugging code to reroute, (assmebly time option) debug
      output through the HAL debug route. Has proved useful locating null
      pointer errors with vectors assembled high.
    Admin:
      (highlight level of testing that has taken place)
      (bugfix number if appropriate)
    
    
    Version 1.75. Tagged as 'DDEUtils-1_75'
    2536c3ba
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.74"
Module_Version SETA 174
Module_MajorVersion SETS "1.75"
Module_Version SETA 175
Module_MinorVersion SETS ""
Module_Date SETS "29 Mar 2015"
Module_ApplicationDate SETS "29-Mar-15"
Module_Date SETS "12 Jul 2015"
Module_ApplicationDate SETS "12-Jul-15"
Module_ComponentName SETS "DDEUtils"
Module_ComponentPath SETS "castle/RiscOS/Sources/Programmer/DDEUtils"
Module_FullVersion SETS "1.74"
Module_HelpVersion SETS "1.74 (29 Mar 2015)"
Module_FullVersion SETS "1.75"
Module_HelpVersion SETS "1.75 (12 Jul 2015)"
END
/* (1.74)
/* (1.75)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.74
#define Module_MajorVersion_CMHG 1.75
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Mar 2015
#define Module_Date_CMHG 12 Jul 2015
#define Module_MajorVersion "1.74"
#define Module_Version 174
#define Module_MajorVersion "1.75"
#define Module_Version 175
#define Module_MinorVersion ""
#define Module_Date "29 Mar 2015"
#define Module_Date "12 Jul 2015"
#define Module_ApplicationDate "29-Mar-15"
#define Module_ApplicationDate "12-Jul-15"
#define Module_ComponentName "DDEUtils"
#define Module_ComponentPath "castle/RiscOS/Sources/Programmer/DDEUtils"
#define Module_FullVersion "1.74"
#define Module_HelpVersion "1.74 (29 Mar 2015)"
#define Module_LibraryVersionInfo "1:74"
#define Module_FullVersion "1.75"
#define Module_HelpVersion "1.75 (12 Jul 2015)"
#define Module_LibraryVersionInfo "1:75"
......@@ -39,4 +39,87 @@ Throwback_ReasonErrorDetails * 1
Throwback_ReasonInfoDetails * 2
OPT OldOpt
MACRO
DebugReg $reg, $str
[ Debug
Push "$reg"
[ "$str" <> ""
BL DebugHALPrint
= "$str", 0
ALIGN
]
bl DebugHALPrintReg
]
MEND
MACRO
DebugRegNCR $reg, $str
[ Debug
Push "$reg"
[ "$str" <> ""
BL DebugHALPrint
= "$str", 0
ALIGN
]
bl DebugHALPrintRegNCR
]
MEND
MACRO
DebugByteReg $reg, $str
[ Debug
Push "$reg"
[ "$str" <> ""
BL DebugHALPrint
= "$str", 0
ALIGN
]
bl DebugHALPrintB
]
MEND
MACRO
DebugTX $str
[ Debug
BL DebugHALPrint
= "$str", 13,10,00
ALIGN
]
MEND
MACRO
DebugTXS $str
[ Debug
BL DebugHALPrint
= "$str",00
ALIGN
]
MEND
MACRO
DebugTX01 $src, $str
[ Debug
ASSERT "$src"<>"r0"
Push "r0, $src, lr"
BL DebugHALPrint
= "$str",00
TEQ $src, #0
BNE %ft0111
BL DebugHALPrint
= "null pointer ",00
B %ft0112
0111 LDRB r0, [$src], #1
CMP r0, #' '
blgt DebugTX
CMP r0, #' '
BGT %BT0111
0112 BL DebugHALPrint
= 10,13,00
ALIGN
Pull "r0, $src, lr"
]
MEND
END
; Copyright 2015 Castle Technology Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
;
[ HALDebug
; No initialisation; assumes the serial
; port is already set up
; in: lr-> string to TX
DebugHALPrint
Push "a1-a4,v1"
MOV v1, lr
10 LDRB a1, [v1], #1
TEQ a1, #0
BEQ %FT20
BL DebugTX
B %BT10
20 ADD v1, v1, #3
BIC lr, v1, #3
Pull "a1-a4,v1"
MOV pc, lr
DebugHALPrintReg ; Output number on top of stack to the serial port
Push "a1-a4,v1-v4,lr"
LDR v2, [sp,#9*4]
ADR v3, hextab
MOV v4, #8
10 LDRB a1, [v3, v2, LSR #28]
bl DebugTX
MOV v2, v2, LSL #4
SUBS v4, v4, #1
BNE %BT10
MOV a1, #13
bl DebugTX
MOV a1, #10
bl DebugTX
Pull "a1-a4,v1-v4,lr"
ADD sp, sp, #4
MOV pc, lr
DebugHALPrintRegNCR ; Output number on top of stack to the serial port, no CR
Push "a1-a4,v1-v4,lr"
LDR v2, [sp,#9*4]
ADR v3, hextab
MOV v4, #8
10 LDRB a1, [v3, v2, LSR #28]
bl DebugTX
MOV v2, v2, LSL #4
SUBS v4, v4, #1
BNE %BT10
MOV a1, #&20
bl DebugTX
Pull "a1-a4,v1-v4,lr"
ADD sp, sp, #4
MOV pc, lr
hextab DCB "0123456789abcdef"
DebugHALPrintB ; output number at TOS as a hex byte
Push "a1-a4,v1-v4,lr"
LDR v2, [sp,#9*4]
ADR v3, hextab
MOV v4, #2
mov v2, v2, lsl #24
10 LDRB a1, [v3, v2, LSR #28]
bl DebugTX
MOV v2, v2, LSL #4
SUBS v4, v4, #1
BNE %BT10
MOV a1, #&20
bl DebugTX
Pull "a1-a4,v1-v4,lr"
ADD sp, sp, #4
MOV pc, lr
DebugTX
stmfd r13!,{r0-r3,r8,r9,lr}
mov r8,#0
mov r9, #86 ; HAL_DebugTX
SWI XOS_Hardware
ldmfd r13!,{r0-r3,r8,r9,pc}
]
END
......@@ -34,7 +34,10 @@
; JRF: Debugging. Turn this off for ROMing
GBLL Debug
Debug SETL {FALSE}
Debug SETL {FALSE};{TRUE};
; use hal_debugtx for debug output
GBLL HALDebug
HALDebug SETL {TRUE};{FALSE}
; JRF: Switch added to allow longer filenames to be 'handled'. This may
; not necessarily fix all the problems that DDEUtils has with them,
......@@ -511,6 +514,9 @@ add_prefix0
MRS lr, CPSR ; NOP on old machine
STR lr, [sp, #20]
[ Debug
[ HALDebug
DebugTX01 r1,"Before add_prefix: "
|
STMFD sp!, {r0-r2}
SWI OS_WriteS
DCB "Before add_prefix: ", 0
......@@ -524,6 +530,7 @@ write_name0
BCS write_name0
SWI OS_NewLine
LDMFD sp!,{r0-r2}
]
]
MOV r2, r1
add_prefix1
......@@ -565,6 +572,9 @@ add_prefix4
MOV r8, r11
[ Debug
[ HALDebug
DebugTX01 r8, "After add_prefix: "
|
SWI OS_WriteS
DCB 4, "After add_prefix: ", 0
ALIGN
......@@ -576,6 +586,7 @@ add_prefix4
CMP r0, #' '+1
BCS %BT01
SWI OS_NewLine
]
]
LDMFD sp, {r0, r1, r2, r3, r4, lr}
BIC lr, lr, #C_bit
......@@ -636,6 +647,9 @@ add_prefix9
CMP r0, #' '
BHI add_prefix6
[ Debug
[ HALDebug
DebugTX01 r8, "After stripping ^s "
|
SWI OS_WriteS
DCB 4, "After stripping ^s ", 0
ALIGN
......@@ -648,6 +662,7 @@ write_name1
CMP r0, #' '+1
BCS write_name1
SWI OS_NewLine
]
]
LDMFD sp!, {r0, r1, r2, r3, r4, lr}
TEQ pc, pc
......@@ -729,6 +744,11 @@ common_handler_external_entry
; R1 = pointer to name to use
STMFD sp!, {r8, r11, lr}
[ Debug
[ HALDebug
DebugRegNCR r0,""
DebugRegNCR r1,""
DebugTX01 r1, "common file handler: "
|
STMFD sp!, {r0, r1}
SWI OS_WriteS
DCB 4, "common file handler: ", 0
......@@ -741,6 +761,7 @@ common_handler_external_entry
BHS %BT01
SWI OS_NewLine
LDMFD sp!, {r0, r1}
]
]
LDR r8, chain
LDR lr, wimp_domain
......@@ -980,6 +1001,9 @@ doswi_prefix
]
[ Debug
[ HALDebug
DebugTX01 r10, "attempting to set prefix: "
|
STMFD sp!, {r0, r2} ; Stack registers
SWI OS_WriteS
DCB 4, "attempting to set prefix: ", 0
......@@ -993,6 +1017,7 @@ doswi_prefix
BCS %BT01
SWI OS_NewLine
LDMFD sp!,{r0,r2} ; Unstack registers
]
]
ASSERT DDEUtils_Prefix = DDEUtilsSWI_Base
......@@ -1493,5 +1518,7 @@ initvar1
MOV r4, #0
SWI XOS_SetVarVal
LDMFD sp!, {r4, pc}
[ HALDebug
GET s.debug
]
END