This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Re: diag_printf via serial port
- From: Alexey Shusharin <mrfinch at mail dot ru>
- To: Sergei Gavrikov <w3sg at SoftHome dot net>, ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 01 Jun 2007 19:26:53 +0700
- Subject: Re: [ECOS] Re: diag_printf via serial port
- References: <465EA85B.4020600@cetoni.de> <465EB804.9040200@mail.ru> <1180617817.12360.70.camel@sg-ubuntu>
Sergei Gavrikov wrote:
>
> Alexey, as far as I could understand, you try to busy one serial port
> (UART0) by a triple work: for the debugging, for the diagnostic and for
> the interrupt driven TTY mode, but that isn't possible.
>
> You should use the second port on the board (D-Sub UART1) for TTY mode
> (/dev/ser1) and using CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE option to point
> what stdio output should appear there, i.e. printf() output (!diag)
> shouldn't appear on /dev/ttydiag. By default, stdio output quite flows
> via /dev/ttydiag.
Hello, Sergei
No, I don't use interrupt driven serial driver. On the contrary, I
wouldn't use it. Did you try load and start application on Olimex
LPC-E2294 via serial port?
As example I wrote a small test:
static void first_thread(CYG_ADDRESS data)
{
diag_printf("\nWe should see this string\n");
}
void cyg_user_start(void)
{
diag_printf("enter cyg_user_start()\n");
cyg_thread_create(4, first_thread, (cyg_addrword_t) 0, "smalltest",
(void *)stack, STACKSIZE, &thread, &thread_obj);
cyg_thread_resume(thread);
diag_printf("exit cyg_user_start()\n");
}
Then I connect via ethernet:
telnet 172.16.0.2 9000
Trying 172.16.0.2...
Connected to 172.16.0.2 (172.16.0.2).
Escape character is '^]'.
RedBoot> load smalltest.elf
Using default protocol (TFTP)
Entry point: 0x81010040, address range: 0x81010000-0x81016e60
RedBoot> go
enter cyg_user_start()
exit cyg_user_start()
We should see this string <----- test work properly
Then I connect via serial port:
RedBoot> load -m xmodem
CEntry point: 0x81010040, address range: 0x81010000-0x81016e60
xyzModem - CRC mode, 478(SOH)/0(STX)/0(CAN) packets, 1 retries
RedBoot> go
enter cyg_user_start()
exit cyg_user_start()
<----- I don't see test string
I found a bug in the variant layer of hal. It locates in
cyg_hal_plf_serial_isr() (/hal/arm/lpc2xxx/var/current/src/hal_diag.c).
This function handles UART interrupt but does't read UxIIR register in
order to clear the interrupt flag. So, the cyg_hal_plf_serial_isr()
calling never stops and prevents dsr and thread execution.
The test began working properly then I has added a read operation of
UxIIR. I will send a patch to ecos-patches mailing list in a short time.
Best regards
Alexey Shusharin
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss