Other Parts Discussed in Thread: SK-AM62
Hi everyone,
i am pretty new working with linux enviroment and i need hand to compile a simple test application on linux machine running Ubuntu 18.04.
I am successfully compiling a simple test program on sk-am62, i've created a file called ee_test.c :
// include file con le strutture per la periferica #include <linux/i2c-dev.h> // #include <linux/i2c-smbus.h> #include <stdio.h> //indirizzo della EEPROM a cui leggere #define EE_ADDRESS 0x51 #define I2C_NUMBER 0 char dev_prefix[20] = "/dev/i2c-"; char dev_name[20]; int perif_num = 0; int num; int main(void) { // completa il nome della periferica num = snprintf(dev_name, sizeof(dev_name), "%s%d",dev_prefix,perif_num); // test per vedere se ha scrittop giusto printf("%s\n", dev_name); return 0; } // eof
if i do that from sk-am62, everything works fine, the programs compile and run without problem.
Now i want to cross compile it on Ubuntu, because working with source files inside sk-am62 is hard, since i don t have a text editor inside arago linux and i don t know how to edit sorce files.
i created a makefile in my Ubuntu:
# ------------------------------------------------------------------------- # Makefile di compilazione per programma di test i2c su linux Arago # ------------------------------------------------------------------------- PLATFORM=am62x ARCH=arm64 PSDK_PATH=/home/ema/psdk/ TOOLS_PATH=$(PSDK_PATH)linux-devkit/sysroots/ BIN_PATH=$(TOOLS_PATH)x86_64-arago-linux/usr/bin/ CC_PREFIX=aarch64-none-linux-gnu- CC = $(BIN_PATH)$(CC_PREFIX)gcc CC_64 = $(BIN_PATH)$(CC_PREFIX)g++ AR_64 = $(BIN_PATH)$(CC_PREFIX)ar DBG_FLAGS=-g3 -gdwarf-2 -std=c++11 SRC=./ee_read.c OUT=ee_read INC_PATH=$(TOOLS_PATH)aarch64-linux/usr/include/ INC_LNX_PATH=$(PSDK_PATH)board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/ INC_ASM=$(INC_LNX_PATH)asm-generic/ INC= -I . -I $(INC_PATH) -I $(INC_LNX_PATH) #normal debug: $(CC) $(DBG_FLAGS) $(SRC) $(INC) -o $(OUT) #pulisce compilazione clean: rm -f *.o $(OUT) lib*.a
but when i try to run it, it gives a lot of error in header files, please help to find out what i m doing wrong, here is output result:
/home/ema/psdk/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-none-linux-gnu-gcc -g3 -gdwarf-2 ./ee_read.c -I . -I /home/ema/psdk/linux-devkit/sysroots/aarch64-linux/usr/include/ -I /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/ -o ee_read In file included from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/kcsan-checks.h:7, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/asm/rwonce.h:27, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/compiler.h:248, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/i2c-dev.h:28, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/i2c-dev.h:12, from ./ee_read.c:13: /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/compiler_attributes.h:64: warning: "__always_inline" redefined 64 | #define __always_inline inline __attribute__((__always_inline__)) | In file included from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/stddef.h:5, from /home/ema/psdk/linux-devkit/sysroots/aarch64-linux/usr/include/linux/posix_types.h:5, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/types.h:14, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/types.h:6, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/i2c-dev.h:27, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/i2c-dev.h:12, from ./ee_read.c:13: /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/stddef.h:5: note: this is the location of the previous definition 5 | #define __always_inline inline | In file included from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/compiler.h:248, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/i2c-dev.h:28, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/i2c-dev.h:12, from ./ee_read.c:13: /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/asm/rwonce.h:64:31: error: expected ‘;’ before ‘unsigned’ 64 | static __no_sanitize_or_inline | ^ | ; 65 | unsigned long __read_once_word_nocheck(const void *addr) | ~~~~~~~~ /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/asm/rwonce.h:82:28: error: expected ‘;’ before ‘unsigned’ 82 | static __no_kasan_or_inline | ^ | ; 83 | unsigned long read_word_at_a_time(const void *addr) | ~~~~~~~~ In file included from ./ee_read.c:15: /home/ema/psdk/linux-devkit/sysroots/aarch64-linux/usr/include/stdio.h:77:19: error: conflicting types for ‘ssize_t’ 77 | typedef __ssize_t ssize_t; | ^~~~~~~ In file included from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/uapi/linux/i2c-dev.h:27, from /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/i2c-dev.h:12, from ./ee_read.c:13: /home/ema/psdk/board-support/linux-rt-5.10.109+gitAUTOINC+d9ee8a25c2-gd9ee8a25c2/include/linux/types.h:60:26: note: previous declaration of ‘ssize_t’ was here 60 | typedef __kernel_ssize_t ssize_t; | ^~~~~~~ Makefile:29: recipe for target 'debug' failed make: *** [debug] Error 1i am using Ubuntu 18.04 as os, and i have processor sdk 08.03.00.19 installed,
what are the correct paths for include files, to successfully cross-compile?? are there any reference project for cross-compile for this board?
thank you
Emanuele Peruzzi