View Single Post
  #21   Spotlight this post!  
Unread 12-02-2008, 11:12
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: Welcome to the WPILib forum

I noticed what I thought was a bug last year in serial_ports.h and its changed slightly this year but is still there?

The following is an except from a .map file from MPLAB when using WPILIB. It appears rx2Framing_Errors is defined as static storage within serial_ports.h rather than as an extern so every inclusion of this file allocates new storage for this variable. It may be that this is not shared across files, but the rx1 equivalent variables are only defined once in serial_ports.c. A similar set of variables are defined for rx2 in serial_ports.c... but then serial_ports.h defines possibly the same variable but with an underscore.

The results appears that just some extra storage is allocated but never used. Since these appear to be static defines in serial_ports.c, I wonder if there is any need at all for them in serial_ports.h.

Anyway, just an observation.

Code:
         rx1FramingErrors   0x0005b6       data     static C:\..\serial_ports.c
         rx1OverrunErrors   0x0005b4       data     static C:\..\serial_ports.c

       rx2FramingErrors   0x0005b7       data     static C:\..\serial_ports.c
        rx2Framing_Errors   0x000300       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x00061a       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x0005d1       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x0004fd       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x000638       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x0004eb       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x000622       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x0002cb       data     static C:\..serial_ports.h
        rx2Framing_Errors   0x000609       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x0003b2       data     static C:\..\serial_ports.h
        rx2Framing_Errors   0x000636       data     static C:\..\serial_ports.h

         rx2OverrunErrors   0x0005b5       data     static C:\..\serial_ports.c
        rx2Overrun_Errors   0x0004ec       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x000301       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x0005d2       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x00061b       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x0004fe       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x000639       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x00060a       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x000623       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x0003b3       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x000637       data     static C:\..\serial_ports.h
        rx2Overrun_Errors   0x0002cc       data     static C:\..\serial_ports.h