This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: serial output problem:cyg_io_write and printf
- From: David Brennan <eCos at brennanhome dot com>
- To: liu hua <rongye_liu at hotmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Wed, 09 Mar 2005 04:33:34 -0800
- Subject: Re: [ECOS] serial output problem:cyg_io_write and printf
- References: <BAY12-F2831797AE11A50DD66007AE8510@phx.gbl>
liu hua wrote:
<...>
>
> But,if I use follow program:
> static void simple_prog(CYG_ADDRESS data)
> {
> cyg_io_handle_t handle;
> Cyg_ErrNo err;
> char read_string[50];
> const char test_string[] = "serial example is working correctly!\n";
> cyg_uint32 len = strlen(test_string);
>
> printf("Starting serial example\n");
> err = cyg_io_lookup( "/dev/tty0", &handle );
> if (ENOERR == err) {
> printf("Found /dev/tty0. Writing string....\n");
> err = cyg_io_write( handle, test_string, &len );
> } if (ENOERR == err) {
> printf("I think I wrote the string. Did you see it?\n");
> }
> }
> int main(void)
> {
> cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
> (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
I think you probably want this to be (depending on how stack is declared):
cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
(void *)*&*stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
You are probably running with a corrupted stack in your created thread.
Dave
>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss