rtlinux 테스트 프로그램에 대한 질문입니다.
글쓴이: zieben / 작성시간: 금, 2005/11/04 - 12:10오후
#include <rtl.h>
#include <time.h>
#include <pthread.h>
#include <rtl_printf.h>
#include <math.h>
#define PI 3.14159
#define DOT 10
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(), 1000000000);
float increment, x = 0.0;
increment = 2.*PI/DOT;
while(1) {
pthread_wait_np();
rtl_printf("%f %f\n", x, x);
x += increment;
}
return 0;
}
int init_module(void) {
return pthread_create (&thread, NULL, start_routine, 0);
}
void cleanup_module(void) {
pthread_delete_np (thread);
}
다음과 같이 sin값을 출력하는 rt모듈을 만들어봤습니다.
컴팡리은 무리 없이 진행이 되는데..
문제는 insmod하면 Unresolved symbol sin이라는 에러가 나네요.
원인이 뭘까요?
Forums:


수학 라이브러리를 링크하지 않으신 듯 하네요. -lm 옵션을 쓰세요.
수학 라이브러리를 링크하지 않으신 듯 하네요. -lm 옵션을 쓰세요.
[code:1]include rtl.mkall : rt_d
include rtl.mk all : rt_demo.o clean: rm -f *.o RT_DEMO.o : rt_demo.c $(CC) ${INCLUDE} ${CFLAGS} -c rt_demo.c -lm include $(RTL_DIR)/Rules.make다음과 같은 Makefile을 만들어서 컴파일 했는데요..
제가 -lm 옵션을 잘못 쓴건가요?
pthread 라이브러리와 math라이브러리를 커널 모듈에 쓰는 것 자체
pthread 라이브러리와 math라이브러리를 커널 모듈에 쓰는 것 자체가 안됩니다. 필요한 부분만 따로 구현하셔야 할 듯 하네요.
아니면 유저랜드에서 계산을 수행하고 커널과 통신하는 식으로 하셔야 할 듯 합니다.
----
Let's shut up and code.
댓글 달기