nasa / CF

The Core Flight System (cFS) CFDP application.
Apache License 2.0
79 stars 45 forks source link

CFDP setup between two cFS projects #2

Closed ashrafalhajjeh closed 2 years ago

ashrafalhajjeh commented 4 years ago

Hi, I have setup two cFS projects on a Linux VM with CF running on each one with CI and TO to test file transfer between the two projects as shown below: cfdp_issue_diagram When I try to transfer file /cf/cf.so from one side to the other (destination file name /cf/cf_sent.so) I get the following result (file sent from ppesim-cfs to pdpmep-fsw): CFDP file transfer attempt When I change the code at cf_app.c line 1030 from: cf_app_c_Ln1030_changed To: cf_app_c_Ln1030 The received packet's length is shown to be correct but the file still doesn't make it across. If I attempt to run the unchange CF code between the Linux VM (little endian machine) and a powerPC (big endian) I get a segmentation fault (most likely because the powerPC is running the cFS project as root which I confirmed by running the receiving end of the VM version as sudo and I got a segmentation fault as well).

To start, is there anything I am missing with setting up two CF applications this way? Or is there any more information you might need me to provide?

Thanks, Ashraf.

ashrafalhajjeh commented 4 years ago

After doing a little digging into this issue, here's what I found: In pdu.c, the PDU length is packed on lines (269->272) as big-endian: pdu_c_length_gen

In pdu.c, the received file data packet struct generation also interprets PDU length as big-endian: pdu_c_fd_struct_len pdu_c_fd_struct_len_2 which is good.

The reason I was having issues now come from the following two pieces of code: In cf_app.c: cf_app_c_length_usage In pdu.c: pdu_c_nak_struct_len

Where the length is interpreted as a struct parameter assuming the machine's endianness (in my case little-endian). In the cf_app.c case, this forced me to create a very large incoming packet buffer (>60k bytes) for file chunks of just 200-500 bytes. In the pdu.c case, I ended up running into the "Incoming Nak truncated to fit in storage" message due to the pdu length indicating a large memory size for the NAK struct creation.

I think the two areas that use the length in an endianness dependent manner should be changed to accommodate running on a little-endian machine.

meleffendi commented 4 years ago

I had the same issue. When I changed the code at cf_app.c line 1030 and added the CFE_MAKE_BIG16 macro it worked. I could get class 1 transactions working but I'm having issues with class 2 transactions. Did you have any success with class 2 transactions? @ashrafalhajjeh

skliper commented 4 years ago

I realize this isn't immediate help, but just a heads up that there is a major update to CF in the works that we plan to release open source.

meleffendi commented 4 years ago

@skliper I guess I'm just gonna wait for the new update then and work on other stuff for now.

skliper commented 2 years ago

Closing as obsolete (applies to v2.X)