-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C128] serial driver random crashes. #2443
Comments
One of the first tests you could do is see whether one of the last three optimisation commits to the c128 driver is responsible for that: It'll require you to build cc65 from git, and do a git bisect or something like that. |
Okay but before I do that keep in mind this happens when using ser_static_stddrv as well (in addition to the swiftlink driver). |
It's the same, only statically linked :) |
I switched to the commit before your optimizations (ffa83c3), I couldn't do a MAKE though (Fatal error: Cannot open input file 'common/asctime.s': No such file or directory) |
Indeed, that didn't change a thing. To fix compilation, do: Also, uninstall the cc65 package from your distro to make sure you build using the correct one. |
Okay thanks for that. Well I went as far back as 008b4c4 and the issue remained. I also added checking cc65's and cl65's --version into the process just to be sure I was compiling / linking under the intended version. It's possible this never worked, after all it appears to work at first, I mean I spent a good 45 minutes on particles reading messages with no issue it wasn't until I started writing one that the issue popped up. |
Thanks for confirming that. Sadly that doesn't narrow your issue down... You'll probably have to figure a way to trace execution, look at the registers, etc, basically setup a good enough debugging. I don't know what you can use for that on the c128 platform, maybe vice or MAME? |
Yeah that's a bit over my head, I'm not an assembly programmer (hence me using C for my project instead of assembly). For now my only path forward is to target c64 instead and try to use the VDC and other 128 specific functionality (such as numeric keypad) while in 64 mode. All do-able but since the term program I'm trying to write is specifically for the 128 it would make more sense to target the 128. Well thanks for taking a look. |
I'd first try if the same thing happens with the respective C64 drivers - and if so, debug those first. C128 should use the same code, but adds some additional quirks and problems, so takkle that later :) |
I tried the same code targeting c64 and that worked without issue. At first I was working with my own code but when this issue popped up I started doing the testing with the sample program "terminal.c", same issue there. I didn't change that code at all from the sample. I built it once for c128 and once for c64. The c128 build exhibited the crashes and the c64 build did not. In my own terminal program I have used the c64 driver (c64-swlink.ser) and targeting c64 this works fine (in 64 mode of course) but I can't use this driver while targeting c128. I tried and as soon as I try to send anything (press a key) then the program breaks into machine code monitor. |
OK - you should open an issue about this then... Unfortunately quite tricky to debug - if you can provide a reliable way to reproduce the problem, please describe that as well. My guess would be some kind of problem related to the banking on C128 - but this would really need a C128 expert to look at. |
This is an open issue (2443). I provided repro steps in my initial message. Actually there's two repro steps, I can reproduce it on any BBS eventually by doing a lot of typing but for whatever reason on my BBS in particular it is more easily reproduced, also I've been mostly testing there because I figured if I'm going to be constantly crashing my session and leaving the BBS hanging I'd rather do that to my own than someone else's. |
Ah ok, i find it really confusing to have both this discussion and that issue :) As for reproducing... anything that involves "BBS" - or even any sort of remote computer - is not going to help much unfortunately, whoever is going to look at this probably prefers something that works completely local. |
If you want to debug this with Vice on Windows I recommend to use the VICE-Win-3.2-x64 version, as this is the last one which has the built in debugger included. |
I have been using a mixture of real hardware and vice (not WinVICE since I'm on linux) but the behavior is the same whether through VICE or real hardware. I am not able to reproduce it without connecting to something. When I'm testing against my BBS that's local network for me (though not the same machine) so in theory it should work against anything local that you can telnet into. |
Especially regarding RS232 stuff this is a really really bad idea - since tons of stuff was fixed in that area since 3.2 - And of course recent versions still can do everything - and much more - 3.2 could regarding debugging - it just doesn't have the fancy GUI for (a few) monitor things.
I know, it would still be great to find a simple testcase that works like this... perhaps using tcpser, or perhaps even using a little script with netcat (or whatever) |
Okay I'll try to figure out how to do that. I can connect using netcat (nc -l) but that doesn't echo back anything and so far have been unable to reproduce the issue using this so the crash might be happening in the receive rather than the send. If that's the case I'll need an echo of each character. |
Perhaps try sending a huge binary file (using minicom or so)? |
neither my term program that I'm working on or the sample (terminal.c) supports file transfers. I wasn't intending on implementing file transfers. I have tried having a few thousand "X"'s in my clipboard and pasting into VICE but that didn't really cause any issues. |
Yeah but you still should be able to use minicom to send a huge file to the emulator.... and at least test the transfer in that direction. It'd be already helpful to know if receiving or sending is the problem for that matter :) |
A friend of mine helped me set up something on my linux box, an ncat session I can ATDT into and it just echos back each keypress. But so far I am unable to reproduce the crash this way. |
OldWoman37 from the Lemon 64 Forum has found the cause of the issue and a workaround until it's fixed. For completeness I'll quote her here: |
Discussed in #2441
Originally posted by Divarin April 10, 2024
It looks like there might be an issue with both the standard serial driver (that used in the sample 'terminal.c') and the swiftlink driver for the Commodore 128 target.
Using samples/terminal.c, if I compile it for C128 it works okay for a while but at some point will crash back to basic.
I've tested this both in VICE and on real hardware.
I have been able to get this to happen by typing a lot of characters (or just holding down one key). It happens on any BBS at random times (including Commodore boards as well as others) but usually only while doing a lot of typing (so if you're just reading posts and occasionally pressing enter to go to the next post then it isn't likely to happen, more likely to happen while writing a post/email)
For some strange reason I have been able to reproduce it more quickly on my own BBS with these specific repro steps (I have tried this on other synchronet boards and it doesn't happen, except randomly while typing a message as described above)
Again, I'm not saying this only happens on my BBS I'm saying it happens on any BBS but that the quickest repro steps are those listed above, otherwise the longer repro steps are:
I first noticed this happening in my own program using the swiftlink driver (c128-swlink.ser) so as a sanity check I went to the sample (terminal.c) to see if the same behavior was happening there. I didn't change the sample code at all. I compiled it twice; one for C128 and one for C64. The C64 version ran fine but the C128 version would have this random crashing behavior.
P.S. if anyone has any methods that I could provide debugging information such as a stack trace please let me know.
The text was updated successfully, but these errors were encountered: