This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ecos link error


I bought Falcom F35-xxl-si system and I have some problem to compile
demo file (demo_port_io.c). 
Error message is :
100: Undefined reference to cyg_get_port_caps
100: Undefined reference to cyg_get_port_mode
...

Project path: /home/ecos/ecos-work
include path: /home/ecos/install/include
lib path:     /home/ecos/install/lib

Demo.c is compiling with success but not demo_port_io.c
Can you To Help me ?

Bes regards
Pierre

# Mostly written by Jonathan Larmour, Red Hat, Inc.
# This file is in the public domain and may be used for any purpose

# PKG_INSTALL_DIR might need to be edited.  Right now it is set
# assuming that a user ran pkgconf.tcl in /cygdrive/c/ecos-work on Windows NT,
# or used the Configuration Tool with C:\ecos-work as a build-tree.
#
# You can also override it on the make command-line, e.g.:
#   make PKG_INSTALL_DIR=/myecc/install
# or you can set it in your environment

PKG_INSTALL_DIR = ../install

# You must also set XCC to the name of your cross-compiler, including any
# options it needs.

# Uncomment one of the below, or invoke make with the name of the compiler
# you want, e.g.:
#   make XCC="sparclite-elf-gcc -mcpu=sparclite -msoft-float"
# You can also set XCC in your environment

# NEC v850
XCC = v850-elf-gcc
XPP = v850-elf-g++

###### VARIABLES
# Any of these can be overriden on the command-line or in your environment

ifeq ($(findstring sh-elf-gcc,$(XCC)),sh-elf-gcc)
CFLAGS        = -ggdb
else
CFLAGS        = -g
endif

CXXFLAGS      = $(CFLAGS)

EXTRACFLAGS   = -Wall -I$(PKG_INSTALL_DIR)/include -ffunction-sections -fdata-sections -mlong-calls

EXTRACXXFLAGS = $(EXTRACFLAGS) -fno-exceptions -fno-rtti -fvtable-gc -finit-priority

LDFLAGS       = -nostartfiles -L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections
LIBS          = -Ttarget.ld -nostdlib

LD            = $(XCC)
LDPP          = $(XPP)

###### RULES

.PHONY: all clean CCCHECK

all: hello twothreads simple-alarm serial

clean:
	-rm -f *.o *.pre *.symbol *.bin *.S3

CCCHECK:
ifeq ($(XCC),)
	@echo You must set XCC to the name of your cross-compiler
	@false
endif

%: %.c
	$(XCC) -E -o $@.prx $(CFLAGS)  $(EXTRACFLAGS)  $<
	grep -x -v "[:space:]" $@.prx | grep -x -v "" | grep -x -v " " > $@.pre
	rm -f $@.prx
	$(XCC) -c -o $@.o -O0 $(CFLAGS)  $(EXTRACFLAGS)  $<
	$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
	v850-elf-objdump -t $@ | sort > $@.symbol
   # ------------ fÃr load mit redboot	---------------
	v850-elf-objcopy --srec-forceS3 -O srec $@ $@.S3
	v850-elf-objcopy -O binary $@ $@.bin

%: %.cxx
	$(XPP) -c -o $@.o -O0 $(CFLAGS)  $(EXTRACFLAGS)  $<
	$(LDPP) $(LDFLAGS) -o $@ $@.o $(LIBS)
	v850-elf-objdump -t $@ | sort > $@.symbol
   # ------------ fÃr load mit redboot	---------------
	v850-elf-objcopy --srec-forceS3 -O srec $@ $@.S3
	v850-elf-objcopy -O binary $@ $@.bin

%: %.cpp
	$(XPP) -c -o $@.o -O0 $(CFLAGS)  $(EXTRACFLAGS)  $<
	$(LDPP) $(LDFLAGS) -o $@ $@.o $(LIBS)
	v850-elf-objdump -t $@ | sort > $@.symbol
   # ------------ fÃr load mit redboot	---------------
	v850-elf-objcopy --srec-forceS3 -O srec $@ $@.S3
	v850-elf-objcopy -O binary $@ $@.bin


#include <stdio.h>
#include <cyg/hal/hal_io.h>		// HAL_WRITE_UINT8
#include <cyg/hal/v850_common.h>
// #include <cyg/io/iic.h>		
#include <cyg/infra/diag.h>	
#include <cyg/io/port_io.h>
#include <cyg/io/falxxl_port_dev.h>

#define SET_BIT(VAR,BIT) VAR|=(1<<BIT)
#define CLR_BIT(VAR,BIT) VAR&=(~(1<<BIT))


unsigned char i;
int main(void)
{
  cyg_uint8 reg8;
  cyg_uint8 Tog = 0;
  cyg_uint8 slave, sreg, value;
  cyg_uint16 addr;
  cyg_uint8 page[32];
  cyg_io_handle_t handle;
  unsigned int a;

  i = 0;
  HAL_WRITE_UINT8(V850_REG_PM10, 0);
  slave = 0xA2;
  sreg = value = 0;
  
  // if((handle=cyg_get_port_by_name("GPIO"))==NULL) a = 0; 
  // a = write_i2c(slave, sreg, &value);
  // if (a == 0) printf("Error RTC Status register\n");

  while (1) {
    HAL_READ_UINT8(V850_REG_P7, reg8);
    printf("%02X\n", reg8);
    HAL_WRITE_UINT8(V850_REG_P10, i++);
  }
  return 0;
}

/*
 * Written 2002-06-19 by Burkhard Kirchner FALCOM
 * This file is in the public domain and may be used for any purpose
 */

/* CONFIGURATION CHECKS */

#include <pkgconf/system.h>     /* which packages are enabled/disabled */
#ifdef CYGPKG_KERNEL
# include <pkgconf/kernel.h>
#endif
#ifdef CYGPKG_LIBC
# include <pkgconf/libc.h>
#endif

#ifndef CYGFUN_KERNEL_API_C
# error Kernel API must be enabled to build this example
#endif

#ifndef CYGPKG_LIBC_STDIO
# error C library standard I/O must be enabled to build this example
#endif

/* INCLUDES */
#include <stdio.h>                      /* printf */
#include <cyg/hal/hal_io.h>		// HAL_WRITE_UINT8
#include <cyg/hal/v850_common.h>
#include <cyg/kernel/kapi.h>		// cyg_thread_delay
#include <cyg/io/port_io.h>
#include <cyg/io/falxxl_port_dev.h>

Cyg_ErrNo printport(cyg_io_handle_t handle)
{
    char *capstrings[]={"digital input","digital output","analog input","analog output","pullup resistor","open drain","BIT6","BIT7"};
    unsigned long caps,mode,val,width;
    int i,cnt;
    cyg_get_port_caps(handle,&caps);
    cyg_get_port_mode(handle,&mode);
    cyg_get_port_width(handle,&width);
    cyg_read_port(handle,&val);
    printf("Port %s:",cyg_get_port_name(handle));
    cnt=0;
    printf("\n    possible: ");
    for(i=0;i<8;i++)
        if(caps&(1<<i))
            printf("%s%s",cnt++?", ":"",capstrings[i]);
    printf("\n    in use  : ");
    cnt=0;
    for(i=0;i<8;i++)
        if(mode&(1<<i))
            printf("%s%s",cnt++?", ":"",capstrings[i]);

    printf("\n    port width    = %ld",width);
    printf("\n    current value = 0x%lx (%ld)",val,val);
    printf("\n");
    return ENOERR;
}

void print_ports()
{
  printf("Port I/O test is running\n");
  printf("Ports available:\n");
  cyg_enum_ports(printport,false);
}

void cinema(void)
{
  long val=1;
  long new_mode = PORT_D_OUTPUT;
  cyg_io_handle_t handle;
  if((handle=cyg_get_port_by_name("GPIO"))==NULL) return;
  cyg_set_port_mode(handle,new_mode);
  while(1) {
    cyg_thread_delay(15);
    cyg_write_port(handle,val);
    val++;
  }
}

void analoginput(void)
{
  long val=1;
  long new_mode = PORT_A_INPUT;
  cyg_io_handle_t handle;
  if((handle=cyg_get_port_by_name("GPI1"))==NULL) return;
  cyg_set_port_mode(handle,new_mode);
  while(1) {
    cyg_thread_delay(15);
    cyg_read_port(handle,&val);
    printf("\nAnalog value = 0x%lx(%ld)",val,val);
  }
}

int main(void)
{
  print_ports();
//  analoginput();
  cinema();
  return 0;
}





-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]