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]

Re: serial output problem:cyg_io_write and printf



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


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