nthallen / monarch

Monarch Data Acquisition System
0 stars 1 forks source link

tm_client: message mismatch due to time_t inconsistency #73

Closed nthallen closed 4 years ago

nthallen commented 4 years ago

Telemetry appears to be working, but getting all these errors continuously. Is it possible that the input buffer is not being cleared at the end of protocol_input() (or whatever that calls)?

19:10:03.944 [ERROR] tm_clt: Invalid TMTYPE: 0000 19:10:03.944 [WARNING] tm_clt: Discarding -16760 bytes (to EOB) in seek_tmid() 19:10:04.444 [ERROR] tm_clt: Invalid TMTYPE: 0000 19:10:04.444 [WARNING] tm_clt: Discarding -16812 bytes (to EOB) in seek_tmid() 19:10:04.943 [ERROR] tm_clt: Invalid TMTYPE: 0000 19:10:04.943 [WARNING] tm_clt: Discarding -16864 bytes (to EOB) in seek_tmid() 19:10:05.447 [ERROR] tm_clt: Invalid TMTYPE: 0000 19:10:05.447 [WARNING] tm_clt: Discarding -16916 bytes (to EOB) in seek_tmid()

nthallen commented 4 years ago

Problem is due to different structure sizes between the target system SDK and Linux/Cygwin: Use compile-time hacks with the SDK, I get:

SIZEOF_tm_hdr_t_IS<4>
SIZEOF_tstamp_t_IS<6>
SIZEOF_tmid_t_IS<32>
SIZEOF_tm_dac_t_IS<50>
SIZEOF_tm_info_t_IS<60>
SIZEOF_tm_data_t1_t_IS<4>
SIZEOF_tm_data_t2_t_IS<8>
SIZEOF_tm_data_t3_t_IS<6>
SIZEOF_tm_data_t4_t_IS<10>
SIZEOF_tm_msg_t_IS<64>
SIZEOF_tm_hdrs_t_IS<10>

while on both Linux and Cygwin, I get:

SIZEOF_tm_hdr_t_IS<4>
SIZEOF_tstamp_t_IS<10>
SIZEOF_tmid_t_IS<32>
SIZEOF_tm_dac_t_IS<50>
SIZEOF_tm_info_t_IS<64>
SIZEOF_tm_data_t1_t_IS<4>
SIZEOF_tm_data_t2_t_IS<8>
SIZEOF_tm_data_t3_t_IS<6>
SIZEOF_tm_data_t4_t_IS<10>
SIZEOF_tm_msg_t_IS<68>
SIZEOF_tm_hdrs_t_IS<14>
nthallen commented 4 years ago

The difference is the time_t in tstamp_t. This cannot be a system dependent type. I will need to define my own tm_time_t (or something) that is, let's say, int32_t (to be compatible with QNX's time_t), and then check how that is used in tmc/*.skel. The secs field of tstamp_t appears only twice in all of the DAS_IO library, so that should be fairly easy to track down.

nthallen commented 4 years ago

in tm.h: