#2364 closed defect (fixed)

pc386 build fails

Reported by: hermann19829 Owned by: Joel Sherrill <joel.sherrill@…>
Priority: normal Milestone: 4.11.1
Component: unspecified Version: 4.11
Severity: normal Keywords: pc386
Cc: Pavel Pisa, Gedare Bloom Blocked By:
Blocking:

Description

When building RTEMS for pc386 make all fails after executing bootstrap and configure by

../rtems/configure --target=i386-rtems4.11 --enable-rtemsbsp=pc386 --enable-tests=samples --disable-posix

at entering .../samples/hello with
undefined reference to pthread_mutex_trylock and
undefined reference to pthread_mutex_unlock

When commenting lines 869-874, 891-892, 899-901 in development/rtems/src/rtems/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
the build succeeds.

 860 rtems_device_driver
 861 frame_buffer_open(
 862     rtems_device_major_number  major,
 863     rtems_device_minor_number  minor,
 864     void                      *arg
 865 )
 866 {
 867     printk( FB_VESA_NAME " open device\n" );
 868 
 869     //if (pthread_mutex_trylock(&vesa_mutex) != 0)
 870     //{
 871     //    printk( FB_VESA_NAME " could not lock vesa_mutex\n" );
 872 
 873     //    return RTEMS_UNSATISFIED;
 874     //}
 875 
 876     return RTEMS_SUCCESSFUL;
 877 
 878 }
 879 
 880 /*
 881  * fb_vesa device driver CLOSE entry point
 882  */
 883 rtems_device_driver
 884 frame_buffer_close(
 885     rtems_device_major_number  major,
 886     rtems_device_minor_number  minor,
 887     void                      *arg
 888 )
 889 {
 890   printk( FB_VESA_NAME " close device\n" );
 891   //if (pthread_mutex_unlock(&vesa_mutex) == 0)
 892   //{
 893       /* restore previous state.  for VGA this means return to text mode.
 894        * leave out if graphics hardware has been initialized in
 895        * frame_buffer_initialize() */
 896 
 897       printk(FB_VESA_NAME ": close called.\n" );
 898       return RTEMS_SUCCESSFUL;
 899   //}
 900 
 901   //return RTEMS_UNSATISFIED;
 902 }

Attachments (1)

0001-pc386-console-fb-.c-Use-atomics-to-avoid-dependency-.patch (7.1 KB) - added by Joel Sherrill on Jun 9, 2015 at 8:53:18 PM.
Switch from pthread to atomics since only used to avoid two users are the same time.

Download all attachments as: .zip

Change History (8)

comment:1 Changed on Jun 9, 2015 at 4:10:59 PM by hermann19829

also doesn't work when enabling posix like:

../rtems/configure --target=i386-rtems4.11 --enable-rtemsbsp=pc386 --enable-tests=samples --enable-posix

comment:2 Changed on Jun 9, 2015 at 5:09:13 PM by Joel Sherrill

This is a patch which makes the VBE_RM enabled only when POSIX is. I see the pthread mutex usage in three files and am not sure of the usage. It may be possible to replace all of the mutex usage with an atomic bool which indicates it is in use. The usage is really just to ensure only one open occurs at a time.

This disables the driver which I don't think is what we want. There are three files which need addressing. And start.S calls a vesa method which still needs to be provided. So the fix needs to be thought out.

$ git diff
diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac b/c/src/lib/libbsp/i386/pc
index 469d5f5..f780b9c 100644
--- a/c/src/lib/libbsp/i386/pc386/configure.ac
+++ b/c/src/lib/libbsp/i386/pc386/configure.ac
@@ -15,6 +15,7 @@ RTEMS_CHECK_TOOL(OBJCOPY,objcopy,:)

RTEMS_PROG_CCAS


RTEMS_CHECK_NETWORKING

+RTEMS_CHECK_POSIX

RTEMS_CHECK_SMP


# Is this an Intel Edison?

@@ -131,7 +132,7 @@ RTEMS_BSPOPTS_SET([USE_VBE_RM],[*],[0])

RTEMS_BSPOPTS_HELP([USE_VBE_RM],
[Defined by default. Enables use of the Vesa Bios Extensions - real mode

interface, which enables graphical mode and introduce it upon bootup.])

-AM_CONDITIONAL(USE_VBE_RM,test "$USE_VBE_RM" = "1")
+AM_CONDITIONAL(USE_VBE_RM,test "$USE_VBE_RM" = "1" -a "${RTEMS_HAS_POSIX_API}"

if test X${CLOCK_DRIVER_USE_TSC} = X1 -a X${CLOCK_DRIVER_USE_8254} = X1 ; then

AC_MSG_ERROR([pc386 both TSC and 8254 specified for clock driver])

comment:3 Changed on Jun 9, 2015 at 5:09:45 PM by Joel Sherrill

Cc: Pavel Pisa added
Version: 4.104.11

comment:4 Changed on Jun 9, 2015 at 8:50:31 PM by Joel Sherrill

Cc: Gedare Bloom added

Changed on Jun 9, 2015 at 8:53:18 PM by Joel Sherrill

Switch from pthread to atomics since only used to avoid two users are the same time.

comment:5 Changed on Jun 10, 2015 at 1:25:16 PM by Gedare Bloom

It would be cleaner to propose we add a public atomic API, but this change seems OK to me.

comment:6 Changed on Jun 10, 2015 at 2:11:11 PM by Joel Sherrill

I agree and if this patch is OK. I was planning on filing a PR to add one. It can't just be thrown in quickly. :(

comment:7 Changed on Jun 11, 2015 at 3:11:26 PM by Joel Sherrill <joel.sherrill@…>

Owner: set to Joel Sherrill <joel.sherrill@…>
Resolution: fixed
Status: newclosed

In becbedac784793f7701cbdbe2c6b3360e86d0778/rtems:

pc386/console/fb*.c: Use atomics to avoid dependency on pthreads

closes #2364.

Note: See TracTickets for help on using tickets.