[ECOS] comlib_gps_init( ) fails because of assertion

MapTrace bv jbregman@maptrace.nl
Mon Oct 13 11:39:00 GMT 2003

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?


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;


    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);


    if (result == STATUS_ALL_OK) {
        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:


# Cyg I/O (3) or POSIX I/O (2)?

all: main.c
    @v850-elf-gcc -g $(TARGET) main.c \
    $(ECOS_LIB_PATH)/comlib.a \
    -I $(CL_INCLUDE_DIR) \
    -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

More information about the Ecos-discuss mailing list