2

I am trying to compile a simple C application for a SoloX Cortex-A9 using Eclipse in a Windows Environment.

#include <stdio.h>

int main () {
int ch;
for( ch = 75 ; ch <= 100; ch++ )
{
    printf("ASCII value = %d, Character = %c\n", ch , ch );
}
return(0);
}

I am looking for a assistance setting up Eclipse and getting the Toolchain/Command Sorted.

So far I have tried the following with varying degree's of success.

arm-none-eabi-gcc with --specs=nosys.specs to remove some issues.

This compiles, but when executed produces a Segmentation Fault

It was then suggested that the solox (Cortexa9) is a armhf and not an armel so I tried arm-linux-gnueabihf

This also complies but much to my irritation also produces a "Segmentation Fault."

Eclipse Plugins; I have The GNU ARM Eclipse Plug-in is an Eclipse CDT Manged Build Extension for GNU ARM Toolchains like CodeSourcery G++ Lite, GNUARM, WinARM, Yagarto, and supports the development of managed C/C++ applications for the ARM series of processors. Version: 0.5.3.201010141144

Feeling very out of depth and hoping someone can point me in the right direction.

Edit to provide additional information;

"All Options" command is - "-I"D:\SDKC_imx6Sandbox\SDK\Projects\Test_6_1" -I"D:\SDKC_imx6Sandbox\SDK\Projects\Test_6_1/source" -O3 -Wall -Wa,-adhlns="$@.lst" -c -fmessage-length=0 -mcpu=cortex-a9"

The Target is running Linux and I am loading the binary via winscp over Ethernet.

  • Please provide the exact command line used to compile the program. – A.K. Oct 25 '17 at 15:32
  • What operating system runs on the target (if any) and how do you load and run the compiled program? – A.K. Oct 25 '17 at 15:36
  • I have updated the original question the the information you asked for. – Mark A Johnson Oct 26 '17 at 12:57
  • Okay. There is still some confusion though. You mention `--specs=nosys.specs` and link to a different post. However, that post seems to be about Cortex-M0 which is quite a different processor and unlikely to run Linux. So anything what you were told there may not apply here. You should use `arm-linux-gnueabihf` toolchain with very minimum amount of compilation options, since it's Linux. Try first to compile this without Eclipse, from command line, removing all options that are not necessary. For this simple program, you should not need any options at all. – A.K. Oct 26 '17 at 13:44
  • Something like this: `arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -static -o test test.c` – A.K. Oct 26 '17 at 14:26
  • That works as a Command Line! I have managed to hammer Eclipse to get the command looking like it should be the same (-I"D:\SDKC_imx6Sandbox\SDK\Projects\Test_6_1" -O0 -static -o -mcpu=cortex-a9) but am suffering from an "unrecognised emulation mode: cpu=cortex-a9" – Mark A Johnson Oct 26 '17 at 15:19
  • So your program works on the target? I am not sure what is `unrecognised emulation mode` - is it a compiler error? It took `-mcpu` from your command line. Maybe your toolchain does not know this processor? You may get away just omitting it. BTW: `-static` is just in case libraries on the target may not match what you have in the toolchain. It is better to sort this out and remove `-static`. – A.K. Oct 26 '17 at 15:29
  • I believe it to be a "Linker Error" its coming from ../arm-linux-gnueabihf/bin/ld.exe and says it supports "armelf_linux_eabi armelfb_linux_eabi" (if i remove -static from the command line it still builds/runs) – Mark A Johnson Oct 26 '17 at 15:34
  • So I guess this may be caused by the Eclipse plugin doing build in its own way. Unfortunately, I am not experienced with it. Try to figure out what it is actually doing. – A.K. Oct 26 '17 at 15:39
  • I see. Somebody (Eclipse) is calling `ld` directly and the `-m` option leaks to its command line. You should either use `gcc` as a linker or adjust `ld` options as they are different. – A.K. Oct 26 '17 at 15:42

0 Answers0