I have been trying to get into C/C++ programming for a while on MorphOS, over the last few weeks I have installed the SDK and started to play around.
To compile the classic “Hello, World!” I use “gcc -o hello hello.c”
To compile an MUI based app I use “gcc -noixemul -o muicode muicode.c”
That all compiles OK.
I would like to use a USB to serial adapter cable (Prolific PL2303) to connect to a microcontroller. I have looked at the example from the SDK (Examples/Device/Serial). What is the correct way to compile this code? And how do I specify I am using the “serialpl2303.device”? I’m not sure about make files, is it just the case to “cd” to the folder and run the “make” command?
Below shows the output I get: -
Code:
System:Development/Examples/Device/Serial> make
ppc-morphos-gcc '-DDEVNAME="serial.device"' -O2 -mcpu=604e -c -o serial.o serial.c
In file included from /gg/os-include/proto/exec.h:14,
from serial.c:27:
/gg/os-include/clib/exec_protos.h:11: #error "Mixing ixemul and native library calls is not supported. Native application should be built with -noixemul"
In file included from /gg/os-include/proto/intuition.h:14,
from serial.c:28:
/gg/os-include/clib/intuition_protos.h:10: #error "Mixing ixemul and native library calls is not supported. Native application should be built with -noixemul"
make: *** [Makefile:20: serial.o] Error 1
System:Development/Examples/Device/Serial>
I have also tried to compile: -
http://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node0192.htmlgcc -o serial serial.c
Code:
Work:Code/SerialTest> gcc -o serial serial.c
In file included from serial.c:21:
/System/Development/gg/os-include/clib/exec_protos.h:11:3: error: #error "Mixing ixemul and native library calls is not supported. Native application should be built with -noixemul"
11 | # error "Mixing ixemul and native library calls is not supported. Native application should be built with -noixemul"
| ^~~~~
serial.c: In function 'main':
serial.c:61:21: warning: passing argument 1 of 'DeleteExtIO' from incompatible pointer type [-Wincompatible-pointer-types]
61 | DeleteExtIO(SerialIO);
| ^~~~~~~~
| |
| struct IOExtSer *
In file included from serial.c:22:
/System/Development/gg/os-include/clib/alib_protos.h:77:37: note: expected 'struct IORequest *' but argument is of type 'struct IOExtSer *'
77 | VOID DeleteExtIO( struct IORequest *ioReq );
| ~~~~~~~~~~~~~~~~~~^~~~~
Work:Code/SerialTest>
gcc -noixemul -o serial serial.c
Code:
Work:Code/SerialTest> gcc -noixemul -o serial serial.c
serial.c: In function 'main':
serial.c:61:21: warning: passing argument 1 of 'DeleteExtIO' from incompatible pointer type [-Wincompatible-pointer-types]
61 | DeleteExtIO(SerialIO);
| ^~~~~~~~
| |
| struct IOExtSer *
In file included from serial.c:22:
/System/Development/gg/os-include/clib/alib_protos.h:77:37: note: expected 'struct IORequest *' but argument is of type 'struct IOExtSer *'
77 | VOID DeleteExtIO( struct IORequest *ioReq );
| ~~~~~~~~~~~~~~~~~~^~~~~
Work:Code/SerialTest>
I have not done much C/C++ programming, just some Arduino/PlatformIO & Python. My main hope is to write a very simple bit of test code (and compile) that will send out and receive over a USB serial port.
I have used Term to confirm the cable is working.
MorphOS = 3.14
gcc = 9.3.0
Any help will be appreciated, thanks,
Paul