2009-02-12 12:18:03     Help to make Makefile

Document created by Aaronwu Employee on Aug 13, 2013
Version 1Show Document
  • View in full screen mode

2009-02-12 12:18:03     Help to make Makefile

marat gafarov (RUSSIAN FEDERATION)

Message: 69352   

 

Is Makefile:

 

EXEC = dacsel

OBJS = dacsel.o

 

all: $(EXEC)

 

$(EXEC): $(OBJS)

  $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS$(LDLIBS_$@))

 

romfs:

  $(ROMFSINST) /bin/$(EXEC)

 

clean:

  -rm -f $(EXEC) *.elf *.gdb *.o

 

_____________________________________________________

 

 

dacsel.o :

 

#include <errno.h>

#include <fcntl.h>

#include <stdbool.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <strings.h>

#include <time.h>

#include <unistd.h>

#include <sys/stat.h>

#include <sys/types.h>

#include <asm/gpio.h>

 

int main(int argc, char *argv[])

{

  while(1)

  {

  if (gpio_direction_output(GPIO_PF7, 1) < 0) printf("Error 1);

  gpio_set_value(GPIO_PF7, 1);

  usleep(1000000);

  gpio_set_value(GPIO_PF7, 0);

  }

}

__________________________________________________________

 

The compiler cannot find asm/gpio.h

 

 

QuoteReplyEditDelete

 

 

2009-02-12 15:05:22     Re: Help to make Makefile

Mike Frysinger (UNITED STATES)

Message: 69355   

 

you cannot use kernel API from userspace

QuoteReplyEditDelete

 

 

2009-02-12 23:20:16     Re: Help to make Makefile

marat gafarov (RUSSIAN FEDERATION)

Message: 69368   

 

That is it is necessary to use the driver?

QuoteReplyEditDelete

 

 

2009-02-12 23:51:37     Re: Help to make Makefile

Mike Frysinger (UNITED STATES)

Message: 69369   

 

if you want to use the kernel API, then your code needs to be in kernel space.  usually that means a driver.

QuoteReplyEditDelete

 

 

2009-02-13 01:19:21     Re: Help to make Makefile

marat gafarov (RUSSIAN FEDERATION)

Message: 69371   

 

Thanks

QuoteReplyEditDelete

 

 

2009-02-13 07:59:35     Re: Help to make Makefile

Robin Getz (UNITED STATES)

Message: 69418   

 

Marat:

 

As usual - Mike's answer is 100% correct - but he forgot to add -- that if you want to control gpio from userspace - there are ways to do that - you can use one of the pre-existing drivers - you don't need to create your own.

 

-Robin

QuoteReplyEditDelete

 

 

2009-02-14 23:50:49     Re: Help to make Makefile

marat gafarov (RUSSIAN FEDERATION)

Message: 69456   

 

You mean simple-gpio?

Attachments

    Outcomes