<div dir="ltr"><div><div><div><div>The enclosed program is intended to run on the Microzed platform with SMP support enabled.  It is a POSIX version of the ticker sample program, and it does run in single-core mode.  However, if the #defines for CONFIGURE_SMP_APPLICATION and CONFIGURE_SMP_MAXIMUM_PROCESSORS are left uncommented, the application does not run at all.  It does not reach the first printf that marks entry into POSIX_Init().<br><br></div><div>The RTEMS BSP was built with<br>$ ../rtems/configure --prefix=$HOME/Programs/rtems_4_11 --enable-posix --enable-smp --disable-networking --enable-cxx --enable-tests=samples --enable-rtemsbsp="xilinx_zynq_zedboard" --target=arm-rtems4.11<br></div><div><br></div>I didn't see anything special in the Zynq manuals about the bitstream design or FSBL configuration that needs changes to support SMP operation.  Unfortunately, my attempts to GDB into the target through OpenOCD have failed, such that I cannot tell where RTEMS has locked up.<br><br></div>Any ideas would be greatly appreciated.<br><br></div>Thanks,<br></div>Jonathan<br><br><br>#include <bsp.h><br>#include <stdlib.h><br>#include <stdio.h><br><br>void *POSIX_Init(void *args);<br>void *ticker_threadfunc(void *closure);<br><br>#define CONFIGURE_SMP_APPLICATION<br>#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2<br>#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br><br>#define CONFIGURE_UNIFIED_WORK_AREAS<br>#define CONFIGURE_UNLIMITED_OBJECTS<br>#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br><br>#define CONFIGURE_INIT<br>#include <rtems/confdefs.h><br><br>void *<br>POSIX_Init(void *args)<br>{<br>    printf("Entry to POSIX_Init\n");<br>    const char *names[] = {<br>        "TAI1",<br>        "TAI2",<br>        "TAI3",<br>        NULL,<br>    };<br>    pthread_t threads[4];<br>    for (unsigned i = 0; names[i] != NULL; ++i) {<br>        pthread_create(&threads[i], NULL, ticker_threadfunc, (void *)names[i]);<br>        // Spread the tasks' start times out a pinch.<br>        sleep(2);<br>    }<br><br>    // Verify SMP operation.<br>    printf("Running on %lu cores\n", rtems_get_processor_count());<br><br>    for (unsigned i = 0; names[i] != NULL; ++i) {<br>        pthread_join(threads[i], NULL);<br>        printf("joined with thread %d\n", i);<br>    }<br>    printf("Exiting\n");<br>    // Huh.  The following does not behave as expected.  Instead of calling<br>    // exit(), nothing happens.<br>    // pthread_exit(NULL);<br>    exit(EXIT_SUCCESS);<br>    return NULL;<br>}<br><br>#include <stdbool.h><br>#include <time.h><br>#include <unistd.h><br><br>void *<br>ticker_threadfunc(void *closure)<br>{<br>    const char *threadname = closure;<br><br>    struct timespec begin;<br>    clock_gettime(CLOCK_REALTIME, &begin);<br>    while (true) {<br>        struct timespec now;<br>        clock_gettime(CLOCK_REALTIME, &now);<br>        <br>        struct tm formatted_now;<br>        gmtime_r(&now.tv_sec, &formatted_now);<br>        printf("%s: %04d-%02d-%02d %02d:%02d:%02d\n",<br>                threadname,<br>                formatted_now.tm_year,<br>                formatted_now.tm_mon,<br>                formatted_now.tm_mday,<br>                formatted_now.tm_hour,<br>                formatted_now.tm_min,<br>                formatted_now.tm_sec);<br><br>        sleep(5);<br>        if (now.tv_sec - begin.tv_sec >= 30) {<br>            pthread_exit(NULL);<br>        }<br>    }<br>    // Unreachable.<br>    return NULL;<br>}<br><br><div><div><div><br><br></div></div></div></div>