This is the mail archive of the ecos-discuss@sourceware.org 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]

Re: printf problem


Hi Sergei, hi list,

Am Montag, den 31.05.2010, 21:26 +0300 schrieb Sergei Gavrikov: 
> Those snippets are the very minimal configs :-)

Indeed. Find the output of your inspect script attached. Note: your
inspect script misses the netx serial driver, because it's included with
-hardware.

The config looks like that:
cdl_configuration eCos {
    description "" ;

    # These fields should not be modified.
    hardware    nxhx50re_ser_only ;
    template    default ;
    package -hardware CYGPKG_HAL_ARM current ;
    package -hardware CYGPKG_HAL_ARM_ARM9 current ;
    package -hardware CYGPKG_HAL_ARM_ARM9_NETX50 current ;
    package -hardware CYGPKG_IO_SERIAL_ARM_NETX current ;
    package -template CYGPKG_HAL current ;
    package -template CYGPKG_IO current ;
    package -template CYGPKG_IO_SERIAL current ;
    package -template CYGPKG_INFRA current ;   
    package -template CYGPKG_KERNEL current ;  
    package -template CYGPKG_MEMALLOC current ;
    package -template CYGPKG_ISOINFRA current ;
    package -template CYGPKG_LIBC current ;
    package -template CYGPKG_LIBC_I18N current ;   
    package -template CYGPKG_LIBC_SETJMP current ; 
    package -template CYGPKG_LIBC_SIGNALS current ;
    package -template CYGPKG_LIBC_STARTUP current ;
    package -template CYGPKG_LIBC_STDIO current ;  
    package -template CYGPKG_LIBC_STDLIB current ; 
    package -template CYGPKG_LIBC_STRING current ;
    package -template CYGPKG_LIBC_TIME current ;
    package -template CYGPKG_LIBM current ;
    package -template CYGPKG_IO_WALLCLOCK current ;
    package -template CYGPKG_ERROR current ;
    package CYGPKG_PDCURSES current ;
};


> As your HAL is freshmeat... And what your HAL global CFLAGS, LDFLAGS
> are?  Do you use the same flags as another ARM9 targets use? May be
> there are some odd things? Where your compiler (toolchain) came from?

I'm using the ecoscentric-supplied arm-eabi toolchain from ecos v3.0
release (but I'm on cvs for ecos itself right now)

CFLAGS and LDFLAGS should be somewhat standard for the arm ports. I
started using an integrator or innovator (can't remember anymore) arm9
hal. I could try using specific -mcpu options for the arm966 (currently
using just arm9), but that shouldn't be the problem.

from my Make.params:

ECOS_GLOBAL_CFLAGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wundef
-Woverloaded-virtual -Wno-write-strings -mno-thumb-interwork -mcpu=arm9
-g -O0 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions
ECOS_GLOBAL_LDFLAGS = -mno-thumb-interwork -mcpu=arm9
--no-target-default-spec -Wl,--gc-sections -Wl,-static -g -O0 -nostdlib


> About serial tests (though you said: 'the netX serial driver working
> quite fine'), if you looking for more tests, look at
> 
>    io/serial/<version>/tests/README

Okay, I did not think about the serial tests just before. But I compiled
them and after adding stuff to the ser_test_protocol.inl I got serial1,
serial2, tty1 and tty2 running fine. (I stopped here, because I don't
want to setup the serial_filter stuff, because I'm not using RedBoot /
gdb stubs; I'm building stand-alone apps)

> Can you confirm that at the least that `serial1' test finished without
> any failures on your target? Can you confirm also that all cyg_io* calls
> (lookup, read, write, set/get config) work as you could expect on your
> eCos serial device '/dev/serX'?

They are in the resulting application. At least lookup and write are
working, because that's what I used to test my serial drivers in the
first place.

I need to write some simple tests to see if set/get and read are
working. Will do that later.


Btw.: Testing printf is done with the PDCurses example and with my
minimalistic example, that uses printf after testing cyg_io_lookup and
_write.

Find my minimalistic exmaple attached.


Cheers,
Manuel

-- 
Manuel Borchers

Web: http://www.matronix.de
eMail: manuel@matronix.de

Attachment: diff.ecm
Description: Text document

/* 
 * Written 1999-03-19 by Jonathan Larmour, Cygnus Solutions
 * 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
#ifdef CYGPKG_IO_SERIAL
# include <pkgconf/io_serial.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

#ifndef CYGPKG_IO_SERIAL_HALDIAG
# error I/O HALDIAG pseudo-device driver must be enabled to build this example
#endif

#ifndef CYGPKG_IO_SERIAL_ARM_NETX
# error netX serial driver is not included
#else
#include <pkgconf/io_serial_arm_netx.h>
#endif

#ifndef CYGPKG_IO_SERIAL_ARM_NETX_SERIAL0
# error netX UART0 not defined
#endif


/* INCLUDES */

#include <stdio.h>                      /* printf */
#include <string.h>                     /* strlen */
#include <cyg/kernel/kapi.h>            /* All the kernel specific stuff */
#include <cyg/io/io.h>                  /* I/O functions */
#include <cyg/hal/hal_arch.h>           /* CYGNUM_HAL_STACK_SIZE_TYPICAL */

#include <cyg/infra/diag.h>



/* DEFINES */

#define NTHREADS 1
#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 )

/* STATICS */

static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];

/* FUNCTIONS */

static void simple_prog(CYG_ADDRESS data)
{
    cyg_io_handle_t handle;
    Cyg_ErrNo err;
    const char test_string[] = "serial example is working correctly!\n";
    cyg_uint32 len = strlen(test_string);

    diag_printf("Starting serial example\n");

    err = cyg_io_lookup( "/dev/haldiag", &handle );
    
    if (ENOERR == err) {
        diag_printf("Found /dev/haldiag. Writing string....\n");
        err = cyg_io_write( handle, test_string, &len );
        if (ENOERR == err) {
            diag_printf("I think I wrote the string. Did you see it?\n");
        }
    }

    err = cyg_io_lookup( "/dev/ser0", &handle );

    if (ENOERR == err) {
        diag_printf("Found /dev/ser0. Writing string....\n");
        err = cyg_io_write( handle, test_string, &len );
        if (ENOERR == err) {
            diag_printf("I think I wrote the string. Did you see it?\n");
        }
    }
    

    diag_printf("Serial example finished\n");
    printf("Serial example finished (printf)\n");
}

void cyg_user_start(void)
{
    cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
                      (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);
}

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

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