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]

comlib_gps_init( ) fails because of assertion


Hi all,

I'm trying to write a gps test program for the Falcom F35. It seems to compile alright, but when I try a comlib_gps_init( ) it fails because of an assertion error. I believe the error message means the port number is too high, which I don't understand, because when I look at the source of serial.c, I see a '#define PORT_MAX 7' preprocessor directive. Does this indicate there's something wrong with my ComLib installation? I have included my program output, source and makefile. Any ideas?

Thanks,

Jaco Bregman



**** Program debug output:

Switch to nmea on port 0...
Switch failed on port 0.
Switch to nmea on port 1...
Switch to nmea on port 1 succeeded.
Initializing gps...
User assertion failed: "nPort <= PORT_MAX" at lib/serial.c: 96




*** Gps test program:


#include <comlib/comlib.h>
#include <stdio.h>

int main(void) {
   uint nPort = 0;
   tSerialStatus result;
   tGPSModule * gpsModule;

   comlib_init();
   comlib_gps_reset();

   while (result != STATUS_ALL_OK && nPort < 8) {
       printf("Switch to nmea on port %d...\n", nPort);
       result = comlib_gps_switch_to_nmea(nPort);

       if (result != STATUS_ALL_OK) {
           printf("Switch failed on port %d.\n", nPort);
       }

       nPort++;
   }

   if (result == STATUS_ALL_OK) {
       nPort--;
       printf("Switch to nmea on port %i succeeded.\n", nPort);
       printf("Initializing gps...\n");
       result = comlib_gps_init(gpsModule, nPort, NULL, 0, 4);

       if (result == STATUS_ALL_OK) {
           comlib_gps_command(gpsModule, "PSRF103,00,00,00,01", 2);
       }
       else {
           printf("Initializing gps failed.\n");
       }
   }

   return 1;
}




**** Makefile:


CL_LIB_DIR=/opt/sdk35/comlib/lib
CL_INCLUDE_DIR=/opt/sdk35/comlib/include/comlib

# Cyg I/O (3) or POSIX I/O (2)?
TARGET=-DTARGET_PLATFORM=3 -DUSE_HW_FC#-DMAX_BAUD=38400

all: main.c
   @clear
   @v850-elf-gcc -g $(TARGET) main.c \
   $(ECOS_LIB_PATH)/comlib.a \
   -I $(CL_INCLUDE_DIR) \
   -I $(ECOS_INCLUDE_PATH)  \
   -L $(CL_LIB_DIR) \
   -L $(ECOS_LIB_PATH) \
   -Ttarget.ld -nostdlib -Wall -o mainGps
   @v850-elf-objcopy --srec-forceS3 -O srec mainGps mainGps.S3


-- 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]