[fpc-pascal] Cross compiling Windows to arm-linux
John Hansen
afanofosc_99 at yahoo.com
Mon Jul 22 21:52:04 CEST 2013
I am working on an API library for the new LEGO MINDSTORMS EV3 programmable brick. The brick is running Linux on a TI AM1808 ARM chip. I built a Free Pascal cross compiler using 2.7.1 source code along with the CodeSourcery Lite, 2009q1 cross compiler (arm-2009q1-203-arm-none-linux-gnueabi.exe on Windows). Both of these compilers are integrated into my Bricx Command Center (BricxCC) IDE for programming LEGO MINDSTORMS programmable bricks. I have successfully compiled and ran arm-linux binaries on the EV3 via my BricxCC IDE. The goal, ultimately, is to have a full library of C/C++ and Pascal API functions for creating native arm-linux applications to control your LEGO MINDSTORMS EV3 creations and so far I have been making very good progress in that direction. So far I can control LEDs, read button presses, and control motors in C, C++, or Pascal using these cross compilers.
Yesterday, however, I tried to run a binary for the first time that used TThread and I got a run-time error message that, via Google, told me I needed to use cthreads as the first unit in my program source code. After adding that to my uses statement I now get linker errors.
lcd_test.dpr: warning: 31: "crti.o" not found, this will probably cause a linking failure
lcd_test.dpr: warning: 31: "crtbegin.o" not found, this will probably cause a linking failure
lcd_test.dpr: warning: 31: "crtend.o" not found, this will probably cause a linking failure
lcd_test.dpr: warning: 31: "crtn.o" not found, this will probably cause a linking failure
D:\FPC\2.7.1\units\arm-linux\rtl\cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
D:\FPC\2.7.1\units\arm-linux\rtl\cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
Yesterday I tried a lot of -X options of various sorts based on things I found via Google but so far I haven not had much luck getting past these errors. I have now added paths to units using -Fu for a folder(s) under my CodeSourcery Lite install where I found the 4 files mentioned above. That gets rid of the warnings but I still get either the above error or "undefined reference to `__aeabi_unwind_cpp_pr0'"
I have spent the better part of two days solid trying to find a solution on the web and so far nothing has fixed the problem. I have turned on --verbose to see what the linker is doing and I have looked at the link.res file.
Does anyone have any idea what is going wrong and how to fix this problem? It sounds like it might be that I need to have the order that it tries to link the files and libraries modified so that it links the C runtime .o files after my own code or something like that. But how do I accomplish that feat?
John Hansen
More information about the fpc-pascal
mailing list