Author Topic: Debugging the Nanokernel over a Newworld Serial Modem?  (Read 3925 times)

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Debugging the Nanokernel over a Newworld Serial Modem?
« on: October 27, 2018, 06:37:04 AM »
The Nanokernel log seems to default to a serial connection, New World Macs with a builtin modem should be able to output the Nanokernel log over the Modem port using a serial connection.

So let's see if we can figure out how to do that.

If this were an Old World machine, it would be easy, but we should be able to do it on a New World machine too.

I can't find the old Tech Note on Old World Two Machine debugging, so I don't remember how to setup the connection in the Terminal Emulator( ZTrem ) DATA Rate, DATA Bits, Parity?

If we look at a New World Machine with a builtin modem, here is what we can see:

Code: [Select]
input-device-1 scca
output-device-1 scca
0 > dev scca .properties
name                    ch-a
device_type             serial
compatible              scc-audio-control
                        chrp,es2
built-in               
reg                     00013020  00000001
                        00013030  00000001
                        00013050  00000001
                        00008400  00000100
                        00008500  00000100
interrupts              00000016 00000001 00000005 00000000 00000006 00000000
interrupt-parent        ff954898
AAPL,clock-id           73636361 73613331 73613435
AAPL,clock-data         01de2000 00000038 00000054 00000000 00000000 00000044
                        00000800 00000044 00000010 73613435 73623331 012ad400
                        02b11000 00000038 00000050 00000038 00000004 00000044
                        00000400 00000044 00000004 73613331 73623435 00000000
slot-names              00000000
                       


I'm sure there is some way to invoke scca without changing it to the first input and output device, maybe we can find what that is, however just changing it should work too.

Code: [Select]
setenv input-device scca
setenv output device scca

Now when we invoke Open Firmware, we should have a Serial Connection, I just don't remember how to connect with ZTerm?

What kind of cable do a need for the RJ45 jacks?

I should be able to go RJ45 to RJ45, I just never did it with serial.

Offline Naiw

  • Veteran Member
  • ****
  • Posts: 126
  • new to the forums
Re: Debugging the Nanokernel over a Newworld Serial Modem?
« Reply #1 on: October 27, 2018, 08:07:35 AM »
I believe on new world with modem, as you point out the serial port is occupied by the modem and thus not usable for debugging.

If I recall correctly the most common way to debug low level on these was using Ethernet or firewire.

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Debugging the Nanokernel over a Newworld Serial Modem?
« Reply #2 on: October 27, 2018, 08:59:56 AM »
Here's the technote:https://www.fenestrated.net/mirrors/Apple%20Technotes%20(As%20of%202002)/tn/tn1061.html

Yes, the NK debugger sends to serial by default. I have never figured out how to actually read it, though I suppose it's possible.

If the modem wasn't there and you were tapping the serial line directly, it looks like the NanoKernel output would be at 57.6k.

But because the modem is there, you would have to set it up to get a NKLog. You have to enable/turn on the modem somehow. Then, you would have to talk to that serial port and get the modem to try and begin a connection somewhere. Maybe this would involve the Hayes Command Set? Then, you would have to boot into Mac OS 9 and hope nothing gets messed up during that time. Maybe, just maybe, the NK would be able to send stuff over the modem (assuming you have another modem to pick up the data).

Talking over serial with OF is probably the easiest step. It will look something like this:
Code: [Select]
" scca:56700" open-dev ?dup 0= if ." open failed!" then constant scca-ihandle
: swrite " write" scca-ihandle $call-method dup . ." bytes written" cr ;
: sread " read" scca-ihandle $call-method dup . ." bytes read" cr ;
100 alloc-mem ?dup 0= if ." alloc-mem failed!" then constant read-buf

" some text or modem commands here" swrite drop
read-buf 100 sread read-buf swap dump