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]

cyg_thread_delay() only works before diag_printf() in AT91 EB55 ?!!!


Hi all,

I coded a small application to turn on/off the leds of the
AT91 EB55 board.
(I was going to use this application to test if it would run
in thumb mode without making any calls to redboot (printf()).

The application was compiled and linked with eCos in normal
ARM mode.I loaded the application with gdb/redboot and after
I executed 'continue' I noticed that the application turned
on the leds but didn't turned them off.
Running the application step by step I noticed that it
didn't return from the first 'cyg_thread_delay()'.

To my surprise if I preceded the call of cyg_thread_delay()
with a diag_printf(), cyg_thread_delay() returns OK after the
specified amount of time.
For this application to work OK I need to put two diag_printf(),
one before each call to cyg_thread_delay().

I haven't noticed this problem before.
Why this is happenning ?

=============================================================
#define CYGHWR_HAL_ARM_AT91_M55800A
#include <cyg/hal/hal_io.h>

int main(void) {
    // Enable PIO pins PB8-PB15
    HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_PER, 0x0000FF00);
    // Enable output for PIO pins PB8-PB15
    HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_OER, 0x0000FF00);

    while (1) {
      // Turn on all leds
      HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_CODR, 0x0000FF00);
      diag_printf("on\n");  // does not work without this !
      cyg_thread_delay(100);
      // Turn off all leds
      HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_SODR, 0x0000FF00);
      diag_printf("off\n"); // does not work without this !
      cyg_thread_delay(100);
    }
}
==============================================================


Regards, Claudio L. Salvadori Elaxys Tecnologia




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


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