On 24 Mar 2017, at 15:07, Guillermo Polito <guillermopolito@gmail.com> wrote:

Hi all,

We are here with Olivier taking a loot at how serial ports work, because he wants to use it to connect to arduino/raspberries.

We saw that the serial port works nice in unix, in windows we had a look but we found some problems (and we do not have now a windows machine to test well), and we found that in mac it does not work. We are seeing that this behaviour is there since Pharo 3 (4 years ago).

We tried to see if it was a problem of the VM plugin (missing depenencies using ld / otool) but everything seemed ok.

Finally, we took the vm from git and tried to compile it from scratch.

Meta-question 1: Is there a way to create an xcode project from the vm sources? We would have lost less time if we used a graphical debugger to take a look at this :).

No. What you do is to create an empty project and then attaching the running vm. 

Esteban


There, we found that
- apparently the mac VM is using an empty implementation of the serial port plugin:

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/Mac%20OS/plugins/SerialPlugin/sqMacSerialPort.c

We replaced the contents of that file by the one in the Unix plugin and it worked when the plugin was compiled as internal (delta some differences between the default values in mac and unix like uppercasing the 's' of ttyS and ttys) 

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/plugins/SerialPlugin/sqUnixSerial.c

However, as soon as we retried to recompile the plugin as external it did not work any more... The initializeModule function was never called, the module was not loaded (from the system report) and the Serial port could not be open. For this we would have liked a debugger. And I'm not a friend of gdb on the terminal...

Meta-question 2: Is there any clean/make clean used to remove generated files. We found ourselves a lot of times bitten by the fact that even recompiling everything using `mvm -A` did not really recompile and we had to remove files from here and there...

How should we propose a fix?
- do we duplicate the code of the plugin in the mac and unix platforms?
- or do we somehow tell the compilation process that for this plugin it should use the sources in the unix platform code?

Thanks!
Guille and Olivier