Hello, My bord is below. http://www.friendlyarm.net/products/tiny6410 Tiny6410 SDK v1.2 I want make(makefile) a sample source. But I can not complete make(makefile). I do not understand the meaning of the error messsage. Please tell me solution. 1. 86:3: error: impossible constraint in 'asm' line 86 --> FD_ZERO(&rds); 2. 98:14: error: impossible constraint in 'asm' line98 --> } else if (FD_ISSET(led_control_pipe, &rds)) { --------------------- makefile --------------------- KERNEL_SRC = /*** Path*****/arm6410/linux-2.6.38 BUILD_DIR := $(shell pwd) EXTRA_CFLAGS = -I/*** Path*****/include EXTRA_CFLAGS = -I/*** Path*****/include EXTRA_CFLAGS = -I/*** Path*****/include MODULES = led-player_Test.o obj-m := $(MODULES) CROSS_COMPILE = arm-linux- ARCH = arm MAKEARCH = $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) all: $(MAKEARCH) -C $(KERNEL_SRC) SUBDIRS=$(BUILD_DIR) modules clean: rm -f *.o rm -f *.ko rm -f *.mod.c --------------------------------- All of sample source --------------------------------- #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/select.h> #include <sys/time.h> #include <string.h> static int led_fd; static int type = 1; static void push_leds(void) { static unsigned step; unsigned led_bitmap; int i; switch(type) { case 1: if (step >= 6) { step = 0; } if (step < 3) { led_bitmap = 1 << step; } else { led_bitmap = 1 << (6 - step); } break; case 0: if (step > 255) { step = 0; } led_bitmap = step; break; default: led_bitmap = 0; } step++; for (i = 0; i < 4; i++) { ioctl(led_fd, led_bitmap & 1, i); led_bitmap >>= 1; } } int main(void) { int led_control_pipe; int null_writer_fd; // for read endpoint not blocking when control process exit double period = 0.5; led_fd = open("/dev/leds0", 0); if (led_fd < 0) { led_fd = open("/dev/leds", 0); } if (led_fd < 0) { perror("open device leds"); exit(1); } unlink("/tmp/led-control"); mkfifo("/tmp/led-control", 0666); led_control_pipe = open("/tmp/led-control", O_RDONLY | O_NONBLOCK); if (led_control_pipe < 0) { perror("open control pipe for read"); exit(1); } null_writer_fd = open("/tmp/led-control", O_WRONLY | O_NONBLOCK); if (null_writer_fd < 0) { perror("open control pipe for write"); exit(1); } for (;;) { fd_set rds; struct timeval step; int ret; [line 86] ----> FD_ZERO(&rds); FD_SET(led_control_pipe, &rds); step.tv_sec = period; step.tv_usec = (period - step.tv_sec) * 1000000L; ret = select(led_control_pipe + 1, &rds, NULL, NULL, &step); if (ret < 0) { perror("select"); exit(1); } if (ret == 0) { push_leds(); [line 98] ----> } else if (FD_ISSET(led_control_pipe, &rds)) { static char buffer[200]; for (;;) { char c; int len = strlen(buffer); if (len >= sizeof buffer - 1) { memset(buffer, 0, sizeof buffer); break; } if (read(led_control_pipe, &c, 1) != 1) { break; } if (c == '\r') { continue; } if (c == '\n') { int tmp_type; double tmp_period; if (sscanf(buffer,"%d%lf", &tmp_type, &tmp_period) == 2) { type = tmp_type; period = tmp_period; } fprintf(stderr, "type is %d, period is %lf\n", type, period); memset(buffer, 0, sizeof buffer); break; } buffer[len] = c; } } } close(led_fd); return 0; }
What does error message mean?
What do you try to compile? A regular application or Linux kernel code? From the Makefile it seems to be Linux kernel code. From the source it seems a regular application. You can't mix it.
Thank for your reply >>>>>fd_set rds; What does this mean? This source cpde supplier said "FD_SET" is linux system command. "rds" is to use linux pipe. Since I don't know in detail about sourcr code, because I'm not making its software. I got this source code below. http://kanebebe.dip.jp/download/ARM11-6410-DVD/Linux/examples-mini6410-2... >>>>What do you try to compile? I am going to make a kernel object file ( *.ko ) from c source file, in isolated directory from the kernel source. ( If necessary, use is "insmod" or "rmmod".)
> I am going to make a kernel object file Then you should use only include files from the kernel itself! But your code is using "#include <stdio.h>" for example. This is the application side. The kernel itself does not have stream IO! Your source code seems not to be intended as a kernel module!
And the sources from the Link you mention are application code. And it already comes with Makefiles. Don't use a Makefile from the kernel sources.
Thank you. >>>>>Your source code seems not to be intended as a kernel module! For information on how to make kernel module and sample source, I seemed to lack of understanding.