Hello. I cross-compiled a .cpp file for my S32K148EVB-Q176 in my ubuntu x86_64 VM with the following command.
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o deneme-arm deneme.cpp -lstdc++ -lc
Then I am getting these errors:
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-abort.o): in function `abort':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/abort.c:59: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-exit.o): in function `exit':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-fstatr.o): in function `_fstat_r':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/fstatr.c:55: undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-openr.o): in function `_open_r':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/openr.c:50: undefined reference to `_open'
My main goal is to build this program (which is a basic .cpp hello_world kind of file) in my linux machine for arm-32 architecture and then flash it to the board by itself using S32 Design Studio.
Beforehand I tried to compile a .c file with this command:
arm-linux-gnueabi-gcc hello.c -o hello-arm
It successfully generates an ELF arm-32 executable file. But when I try to flash it wiht S32DS to the board. I get below errors:
-Bus fault.
-Hard fault.
----------------------------------------------------------------------------------
-So my first question is this,
1) How can I cross-compile a .cpp code in my Linux terminal with using commands for S32K148EVB board.
Second question is,
2a) If I successfully compile, how can I flash the generated executable by itself using S32 Design Studio.
2b) Or suppose if I compiled an executable for the desired architecture like I showed with the second command. How can I successfully embed this executable to correct memory address in the board?
An explanation for this process would be really helpful. Thanks in advance.