Hi, I want to setup a Linux host for cross-compling applications running on NX target. First I try to build an application to test the tegra watchdog timer /dev/watchdog0. I got the sample application code from this link:
Then I follow the instruction from
to create a Makefile to cross compile this application. But I always got “/bin/sh: 1: Syntax error: “(” unexpected”.
Can anyone provide an example Makefile for me?
My build host is a x86 running Ubuntu 18.04. The target is a Jetson_Xavier NX devkit (Linux 4.9.140-tegra).
I installed JetPack_4.4, Tegra_Linux_Sample-Root-Filesystem_R32.4.2_aarch64, and gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu on my host already.
Thank you very much.
This is my Makefile in case that anyone can correct it:
SYSROOT=/home/stuartx/nvidia/nvidia_sdk/JetPack_4.4_DP_Linux_DP_JETSON_XAVIER_NX_DEVKIT/Linux_for_Tegra/rootfs
CROSS_ROOT=/home/stuartx/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu
CROSS_COMPLE=${CROSS_ROOT}/bin
CC=${CROSS_COMPLE}/aarch64-linux-gnu-gcc
CXX=${CROSS_COMPLE}/aarch64-linux-gnu-g++
LD=${CROSS_COMPLE}/aarch64-linux-gnu-ld
AR=${CROSS_COMPLE}/aarch64-linux-gnu-ar
AS=${CROSS_COMPLE}/aarch64-linux-gnu-as
RANLIB=${CROSS_COMPLE}/aarch64-linux-gnu-ranlib
#NVCC=/usr/local/cuda/nvcc
CFLAGS:= -Wall -Werror -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations
CFLAGS+= -I$(SYSROOT)/usr/include/aarch64-linux-gnu -I$(SYSROOT)/usr/include
#CFLAGS+= -I/usr/local/cuda/target/aarch64-linux/include
LIBS:= -L$(CROSS_ROOT)/aarch64-linux-gnu/lib64 -L$(CROSS_Root)/aarch64-linux-gnu/libc/usr/lib $(CROSS_Root)/aarch64-linux-gnu/libc/usr/lib/libc_nonshared.a -L$(SYSROOT)/usr/lib/aarch64-linux-gnu
LFLAGS:= -Wl,–start-group $(LIBS) -Wl,–end-group
SRC_FILES:= tegra_wdt.c
TARGET:= wdt_demo
all: $(TARGET)
$(TARGET) : $(SRC_FILES)
$(CC) -o $@ $^ $(CFLAGS) $(LFLAGS)
clean:
rm -rf *.o $(TARGET)