Tool/software: Linux
I used ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05 for beaglebone black. I try to compile source code by makefile. Are there recommendations for the RTLinux programing?
SOURCE FILE
#include <rtl.h> #include <time.h> #include <pthread.h> pthread_t thread; void * start_routine(void *arg) { struct sched_param p; p.sched_priority = 1; pthread_setschedparam (pthread_self(), SCHED_FIFO, &p); pthread_make_periodic_np (pthread_self(), gethrtime(), 500000000); while (1) { pthread_wait_np(); rtl_printf("I'm here; my arg is %x\n", (unsigned) arg); } return 0; } int init_module(void) { return pthread_create (&thread, NULL, start_routine, 0); } void cleanup_module(void) { pthread_cancel (thread); pthread_join (thread, NULL); }
Makefile
obj-m=simple-rt.o KDIR:=/home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/board-support/linux-rt-4.9.69+gitAUTOINC+7069a470d5-g7069a470d5 CROSS=/home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- all: make -C $(KDIR) M=$(shell pwd) ARCH=arm CROSS_COMPILE=$(CROSS) modules clean: make -C $(KDIR) M=$(shell pwd) ARCH=arm CROSS_COMPILE=$(CROSS) clean
OUTPUT
make -C /home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/board-support/linux-rt-4.9.69+gitAUTOINC+7069a470d5-g7069a470d5 M=/home/tgtuser/workspace/Beaglebone/example/lkm/simple-rt ARCH=arm CROSS_COMPILE=/home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- modules make[1]: Entering directory `/home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/board-support/linux-rt-4.9.69+gitAUTOINC+7069a470d5-g7069a470d5' ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it. WARNING: Symbol version dump ./Module.symvers is missing; modules will have no dependencies and modversions. CC [M] /home/tgtuser/workspace/Beaglebone/example/lkm/simple-rt/simple-rt.o In file included from <command-line>:0:0: ././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: No such file or directory #include <generated/autoconf.h> ^ compilation terminated. make[2]: *** [/home/tgtuser/workspace/Beaglebone/example/lkm/simple-rt/simple-rt.o] Error 1 make[1]: *** [_module_/home/tgtuser/workspace/Beaglebone/example/lkm/simple-rt] Error 2 make[1]: Leaving directory `/home/tgtuser/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/board-support/linux-rt-4.9.69+gitAUTOINC+7069a470d5-g7069a470d5' make: *** [all] Error 2 tgtuser@tgtuser-ubuntu:~/workspace/Beaglebone/example/lkm/simple-rt$
Best regards,
Somkiat