propeller-elf-gcc compilation on Jetson TK1
Falimond
Posts: 2
I am attempting to compile my C source code for the Propeller Activity Board on a Jetson TK1 (armv7l) running Ubuntu 12.04. In my case, I need to forgo using the GUI/SimpleIDE, so I am trying to compile from the command line. I figured the Raspberry Pi (armv6) SimpleIDE binaries might compatible with the TK1 but I have run into some strange stuff.
First off, this is the source for the SimpleIDE I installed. Running "simpleide" won't work because of a Qt incompatibility. I don't care because the whole point is to not use the GUI. After this, from /opt/parallax/bin I can run propeller-elf-gcc, propeller-load, etc. Using ELF and binary files created by actually running SimpleIDE on my Mac using the following source code, propeller-load on the TK1 works correctly. My program runs and the serial terminal output is correct. Therefore I assume the issue must be with the compiler: propeller-elf-gcc. The source is as follows...
My shell script to invoke propeller-elf-gcc and propeller-load is as follows.
The verbose output during compilation...
But when I run this version, a single, non-alphanumeric byte gets spit out to the terminal followed by nothing else. The version compiled on the Mac, loaded on by the TK1, instead spits out two non-alphanumeric values and then starts the count correctly. Just for comparison, the working binary is 9212 bytes in size.
The Simple Libraries I am using were retrieved here.
As far as I can tell, the only strange thing about the compilation output is...
I cannot find any reference to a "sys-include" folder on the TK1, nor my Mac. Does anyone know where this comes from?
Soon I will build from source both libfdserial and libsimpletext on the TK1. I've only used the included .a files up until now and I feel that I am running out of places to look for the source of this problem. Simplifying the source even further be removing dependence on those two libs and simply printing with printf builds just fine on the TK1, so I am stumped.
Any insight at all is greatly appreciated.
First off, this is the source for the SimpleIDE I installed. Running "simpleide" won't work because of a Qt incompatibility. I don't care because the whole point is to not use the GUI. After this, from /opt/parallax/bin I can run propeller-elf-gcc, propeller-load, etc. Using ELF and binary files created by actually running SimpleIDE on my Mac using the following source code, propeller-load on the TK1 works correctly. My program runs and the serial terminal output is correct. Therefore I assume the issue must be with the compiler: propeller-elf-gcc. The source is as follows...
#include <stdio.h> #include <propeller.h> #include "fdserial.h" fdserial *term; int main(void) { simpleterm_close(); term = fdserial_open(31,30,0,115200); int n = 1; while(1) { waitcnt(CLKFREQ/10+CNT); dprint(term, "%d",n); n++; } return 0; }
My shell script to invoke propeller-elf-gcc and propeller-load is as follows.
#!/bin/bash export PATH=/opt/parallax/bin:$PATH propeller-elf-gcc -Wall -v \ -I . -L . \ -I ~/Desktop/Simple-Libraries-master/Learn/Simple\ Libraries/TextDevices/libfdserial \ -L ~/Desktop/Simple-Libraries-master/Learn/Simple\ Libraries/TextDevices/libfdserial/cmm \ -I ~/Desktop/Simple-Libraries-master/Learn/Simple\ Libraries/TextDevices/libsimpletext \ -L ~/Desktop/Simple-Libraries-master/Learn/Simple\ Libraries/TextDevices/libsimpletext/cmm \ -o hello.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 -ffunction-sections -fdata-sections -Wl,--gc-sections hello.c -lsimpletext -lfdserial -lm propeller-load -Dreset=dtr -I ~/Desktop/SimpleIDE/propeller-gcc/propeller-load/ -b ACTIVITYBOARD -e hello.elf
The verbose output during compilation...
Using built-in specs. COLLECT_GCC=propeller-elf-gcc COLLECT_LTO_WRAPPER=/opt/parallax/libexec/gcc/propeller-elf/4.6.1/lto-wrapper Target: propeller-elf Configured with: ../../propgcc/gcc/configure --target=propeller-elf --prefix=/opt/parallax --disable-nls --disable-libssp --disable-lto --disable-shared --with-pkgversion=propellergcc_v1_0_0_2344 --with-bugurl=http://code.google.com/p/propgcc/issues Thread model: single gcc version 4.6.1 (propellergcc_v1_0_0_2344) COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' '.' '-L.' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial/cmm' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext/cmm' '-o' 'hello.elf' '-Os' '-mcmm' '-m32bit-doubles' '-fno-exceptions' '-std=c99' '-ffunction-sections' '-fdata-sections' /opt/parallax/libexec/gcc/propeller-elf/4.6.1/cc1 -quiet -v -I . -I /home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial -I /home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext -imultilib cmm/short-doubles hello.c -quiet -dumpbase hello.c -mcmm -m32bit-doubles -auxbase hello -Os -Wall -std=c99 -version -fno-exceptions -ffunction-sections -fdata-sections -o /tmp/ccVWQmis.s GNU C (propellergcc_v1_0_0_2344) version 4.6.1 (propeller-elf) compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.0.1, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/sys-include" #include "..." search starts here: #include <...> search starts here: . /home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial /home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext /opt/parallax/lib/gcc/propeller-elf/4.6.1/include /opt/parallax/lib/gcc/propeller-elf/4.6.1/include-fixed /opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/include End of search list. GNU C (propellergcc_v1_0_0_2344) version 4.6.1 (propeller-elf) compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.0.1, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 2d66887c08bf480da448e6ad7c490bae COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' '.' '-L.' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial/cmm' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext/cmm' '-o' 'hello.elf' '-Os' '-mcmm' '-m32bit-doubles' '-fno-exceptions' '-std=c99' '-ffunction-sections' '-fdata-sections' /opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/as -lmm -cmm -o /tmp/cc4F1eAJ.o /tmp/ccVWQmis.s COMPILER_PATH=/opt/parallax/libexec/gcc/propeller-elf/4.6.1/:/opt/parallax/libexec/gcc/propeller-elf/4.6.1/:/opt/parallax/libexec/gcc/propeller-elf/:/opt/parallax/lib/gcc/propeller-elf/4.6.1/:/opt/parallax/lib/gcc/propeller-elf/:/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ LIBRARY_PATH=/opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles/:/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/cmm/short-doubles/:/opt/parallax/lib/gcc/propeller-elf/4.6.1/:/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/ COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' '.' '-L.' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial/cmm' '-I' '/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext' '-L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext/cmm' '-o' 'hello.elf' '-Os' '-mcmm' '-m32bit-doubles' '-fno-exceptions' '-std=c99' '-ffunction-sections' '-fdata-sections' /opt/parallax/libexec/gcc/propeller-elf/4.6.1/collect2 -mpropeller -o hello.elf /opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles/spinboot.o /opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles/_crt0.o /opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles/_crtbegin.o -L. -L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libfdserial/cmm -L/home/ubuntu/Desktop/Simple-Libraries-master/Learn/Simple Libraries/TextDevices/libsimpletext/cmm -L/opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles -L/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/cmm/short-doubles -L/opt/parallax/lib/gcc/propeller-elf/4.6.1 -L/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib --gc-sections /tmp/cc4F1eAJ.o -lsimpletext -lfdserial -lm -lgcc --start-group -lc -lgcc --end-group -lgcc /opt/parallax/lib/gcc/propeller-elf/4.6.1/cmm/short-doubles/_crtend.o Propeller Version 1 on /dev/ttyUSB0 Loading hello.elf to EEPROM via hub memory 9208 bytes sent Verifying RAM ... OK Programming EEPROM ... OK Verifying EEPROM ... OK
But when I run this version, a single, non-alphanumeric byte gets spit out to the terminal followed by nothing else. The version compiled on the Mac, loaded on by the TK1, instead spits out two non-alphanumeric values and then starts the count correctly. Just for comparison, the working binary is 9212 bytes in size.
The Simple Libraries I am using were retrieved here.
As far as I can tell, the only strange thing about the compilation output is...
ignoring nonexistent directory "/opt/parallax/lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/sys-include"
I cannot find any reference to a "sys-include" folder on the TK1, nor my Mac. Does anyone know where this comes from?
Soon I will build from source both libfdserial and libsimpletext on the TK1. I've only used the included .a files up until now and I feel that I am running out of places to look for the source of this problem. Simplifying the source even further be removing dependence on those two libs and simply printing with printf builds just fine on the TK1, so I am stumped.
Any insight at all is greatly appreciated.
Comments
I have a server that watches the PropGCC repository and builds a new tarball on every commit. You can download the latest version for Raspberry Pi from this link: http://david.zemon.name:8111/repository/download/PropGCC5_Gcc4rpi/1644:id/propellergcc-alpha_v1_9_0-gcc4-rpi.tar.gz?guest=1 (I agree with your reasoning about armv6 binaries being compatible with armv7: they should be).
I think I recall that the ABI changed with this newer version of PropGCC, so you'll need new static libraries for Simple. You can either compile them yourself, pull only the source you need and build it as part of your project, or you can grab a zip of PropWare of use the libSimple.a libraries from it: http://david.zemon.name:8111/repository/download/PropWare_Develop/1794:id/PropWare-3.0.0.162-Generic-propware.zip?guest=1
I have tried the latest version of the binaries for the Pi that you linked. As a side note, I did not use anything from the second download link because it doesn't seem to contain the Simple Libraries (libfdserial and libsimpletext) that I need.
No new luck using the new binaries, even after using them to rebuild the latest release of libfdserial and libsimpletext from source.
At this point, I'm convinced that the problem is with the Simple Libraries as, without them, everything works just fine. I just can't seem to find any mention of someone having a similar issue, even with the Pi.
I think the (dis)similarity in gdb output for the different cases is interesting. For the simplified hello.c version they look relatively similar but for the one with fdserial the differences seem very odd.
Getting back to the original problem, I have heard that some of the Simple Libraries have trouble with new PropGCC versions (which is one reason, I think, that the official PropGCC release is so old). I don't know any more details, though.
When I compile the Simple libraries, I put all of the different objects into a single static archive: libSimple.a. Look for a library by that name in the second download and try linking against that. So long as you link with "-Wl,--gc-sections", you should get the same size binary because the files in the library were compiled with "-ffunction-sections -fdata-sections". A few bytes difference will of course be expected because the compiler is different.
I did some work a while ago to pinpoint at least one of those problems, and I haven't been able to find it again in either the PropGCC or Simple Libraries issue trackers on GitHub. Perhaps I talked through the issue in a forum thread here... not sure.
Anyway, what's weird to me (and the reason I don't understand this problem in the first place) is that Falimond used the PropGCC and Simple libraries shipped with SimpleIDE in his original post. Those should have been compatible. It makes sense that his second test - new version of PropGCC + old version of Simple libs - failed because that seems to be the same problem I (supposedly) documented a while ago. But his first test... that's just weird .