MEGA65 / mega65-tools

Tools and Utilities for the MEGA65 Retro Computers
GNU General Public License v3.0
29 stars 31 forks source link

MEGA65_FTP: Repairs for M65Connect #84

Closed gurcei closed 3 years ago

gurcei commented 3 years ago

We've uncovered a few issues in the latest mega65_ftp that have impacted M65Connect adversely. Discussion in this discord thread:

Main findings were:

mega65_ftp relies on the remotesd helper to constantly send the "MEGA65FT1.0" string to it over serial comms, in order for mega65_ftp to know that the helper is still running.

I had inadvertantly removed this, because I found it incredibly spammy, and made it difficult for me to debug serial comms issues.

But due to the nature of M65Connect wanting to do one-shot commands, yet leave mega65_ftp's remotesd helper still running, mega65_ftp will need to be aware of the helper still being running, so that means I will need to re-instate the serial spam message.

Another issue has been that I had made a repair to "m65common.c" - stop_cpu() method, to assure that it actually stopped the cpu.

This had an adverse side-effect on mega65_ftp once again, as it meant that the now-working stop_cpu() call would really stop the cpu and prevent such "MEGA65FT1.0" messages from arriving.

Rather than simply re-instate the broken logic of the original stop_cpu(), I've settled for the following.

I will re-instate the old/broken logic, but rename the function (and all usages of it) to be fake_stop_cpu(). I will also provide a real_stop_cpu() method containing my corrected version.

The hope being that any developer studying the code-base will be made aware of something being amiss via the oddly named fake_stop_cpu() function, and I will provide a comment for the function to explain the present situation, and advise them to try their point of usage with the real_stop_cpu() function instead, and assess if there were any repercussions.