Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command configuration issue for little endian #1020

Closed
onurturhan opened this issue Jun 24, 2019 · 2 comments
Closed

Command configuration issue for little endian #1020

onurturhan opened this issue Jun 24, 2019 · 2 comments
Labels
Milestone

Comments

@onurturhan
Copy link

Describe the bug
We created a cosmos demo project for testing the command configuration. Here are the two
command configuration layout. Simply, these configurations are same but only they have different
endianness.

To Reproduce

  1. Create new cosmos demo project
  2. Update file demo/config/targets/EXAMPLE/cmd_tlm/example_cmd.txt as below:
COMMAND EXAMPLE TEST_CMD1 BIG_ENDIAN ""
  PARAMETER PARAM0 0 16 UINT 0 65535 0 "" BIG_ENDIAN
  PARAMETER PARAM1 16 5 UINT 0 31 31 ""   BIG_ENDIAN
  PARAMETER PARAM2 21 5 UINT 0 31 31 ""   BIG_ENDIAN
  PARAMETER PARAM3 26 1 UINT 0 1 1 ""     BIG_ENDIAN 
  PARAMETER PARAM4 27 5 UINT 0 31 31 ""   BIG_ENDIAN

COMMAND EXAMPLE TEST_CMD2 LITTLE_ENDIAN "" 
  PARAMETER PARAM0 0 16 UINT 0 65535 0 "" LITTLE_ENDIAN
  PARAMETER PARAM1 16 5 UINT 0 31 31 ""   LITTLE_ENDIAN
  PARAMETER PARAM2 21 5 UINT 0 31 31 ""   LITTLE_ENDIAN
  PARAMETER PARAM3 26 1 UINT 0 1 1 ""     LITTLE_ENDIAN
  PARAMETER PARAM4 27 5 UINT 0 31 31 ""   LITTLE_ENDIAN
  1. Reload Configuration
  2. Click "Cmd Packets" Tab of COSMOS Command and Telemetry Server Window
  3. For TEST_CMD1 & TEST_CMD2's click "View In Command Sender" and "View Raw" Tabs.
  4. Send both commands and observe the behaviour from the "Raw Command Packet" Screen.

TEST_CMD1 (BIG_ENDIAN) case seems working fine with default values in the configuration.
However, TEST_CMD2 (LITTLE_ENDIAN) case seems not working with default values.

TEST_CMD1 
Address   Data                                             Ascii
---------------------------------------------------------------------------
00000000: 00 00 FF FF    
TEST_CMD2
Address   Data                                             Ascii
---------------------------------------------------------------------------
00000000: 00 C0 FF 3F      

Expected behavior
TEST_CMD1 is working as expected ( 00 00 FF FF ).
TEST_CMD2 is not working as expected ( 00 00 FF FF ) but ( 00 C0 FF 3F ) as shown in 'View Raw' tab.

Environment :

  • Centos6 - x86
  • COSMOS 4.3.0
@ghost ghost added the question label Jun 24, 2019
@ghost
Copy link

ghost commented Jun 24, 2019

Please read this issue #917 and see if that explains how little endian bitfields work.

@onurturhan
Copy link
Author

onurturhan commented Jul 13, 2019

To use same database for simulation which is little endian, we should solve this issue. Actually we add some code to your structure.c file. Using "META" feature, we pass some information to structure.c to mark LITTLE_16, LITTLE_32 situations, so we solved this problem. Maybe using META keyword is not proper solution, but working.
Solution: https://github.com/onurturhan/COSMOS/

@ghost ghost closed this as completed Oct 28, 2019
@ryanmelt ryanmelt added this to the questions milestone Dec 31, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants