trilliumeng / orion-sdk

Public SDK and ICD for Trillium Engineering's Orion Gimbals.
http://www.trilliumeng.com
MIT License
15 stars 15 forks source link

Build failures on aarch64, seemingly related to inconsistent protogen output? #18

Closed glazzarini-belcan closed 6 months ago

glazzarini-belcan commented 1 year ago

I'm getting compilation errors on a Linux aarch64 machine related to the OrionPublicPacket.c that doesn't occur when building on my x86 MacOS dev machine. I tried diffing the working OrionPublicPacket.c on my MacOS machine and the aarch64 Linux machine and found that the output on the Linux machine has inconsistent usage of a _pg_ prefix on the variables that seems to be causing the build errors below. On the MacOS x86 output these prefixes don't exist, so they're just user vs _pg_user for example.

Here's a snippet of this on the aarch64 output:

// OrionPublicPacket.c was generated by ProtoGen version 2.17.a

#include "OrionPublicPacket.h"
#include "floatspecial.h"
#include "fielddecode.h"
#include "fieldencode.h"
#include "scaleddecode.h"
#include "scaledencode.h"

/*!
 * \brief Encode a Date_t structure into a byte array
 *
 * Compresssed date format.
 * \param _pg_data points to the byte array to add encoded data to
 * \param _pg_bytecount points to the starting location in the byte array, and will be incremented by the number of encoded bytes.
 * \param _pg_user is the data to encode in the byte array
 */
void encodeDate_t(uint8_t* _pg_data, int* _pg_bytecount, const Date_t* _pg_user)
{

vs the x86:

// OrionPublicPacket.c was generated by ProtoGen version 2.11.c

#include "OrionPublicPacket.h"
#include "floatspecial.h"
#include "fielddecode.h"
#include "fieldencode.h"
#include "scaleddecode.h"
#include "scaledencode.h"

/*!
 * \brief Encode a Date_t structure into a byte array
 *
 * Compresssed date format.
 * \param data points to the byte array to add encoded data to
 * \param bytecount points to the starting location in the byte array, and will be incremented by the number of encoded bytes.
 * \param user is the data to encode in the byte array
 */
void encodeDate_t(uint8_t* data, int* bytecount, const Date_t* user)
{

And here's a screenshot of the diff with the line number 2384 that the build output is complaining about.

Screenshot 2023-04-18 at 4 34 49 PM

This seems to be resulting in the following failures? When I replace the OrionPublicPacket.c contents on the aarch64 Linux machine with the unprefixed output on from my x86 MacOS dev machine, these build errors no longer occur.

root@debian:~/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk# make TARGET=aarch64
make[1]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
ProtoGen version 2.17.a
Parsing file OrionPublicProtocol.xml
OrionPublicProtocol.xml:361:0: warning: OrionPublic:OrionFault:Value: Casting float to integer without truncation, consider setting scaler="1.0"
Writing HTML documentation to OrionPublic.html
Generated protocol files in ./
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[1]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[1]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Utils'
make[1]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Utils'
make[1]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/CameraInfo'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/CameraInfo'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/EncodeDecode'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/EncodeDecode'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/GeoPoint'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/GeoPoint'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/GpsAndHeading'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/GpsAndHeading'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/LineOfSight'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/LineOfSight'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/PathTrack'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/PathTrack'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/SendCommand'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/SendCommand'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/SendConfig'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/SendConfig'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/UserData'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/UserData'
make[2]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/VideoPlayer'
make[3]: Entering directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
OrionPublicPacket.c: In function ‘decodeGpsDataPacketStructure’:
OrionPublicPacket.c:2384:28: error: ‘user’ undeclared (first use in this function)
 2384 |     constructGpsEcefPosVel(user);
      |                            ^~~~
OrionPublicPacket.c:2384:28: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:8: aarch64/obj/OrionPublicPacket.o] Error 1
make[3]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Communications'
make[2]: *** [../Examples.mk:18: ../../Communications/aarch64/libOrionComm.a] Error 2
make[2]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples/VideoPlayer'
make[1]: *** [Makefile:2: build] Error 2
make[1]: Leaving directory '/root/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk/Examples'
make: *** [Makefile:4: build] Error 2
root@debian:~/Desktop/RemoteID_298-5768/RemoteID_298-5768/drone/orion-sdk# 
treavg commented 1 year ago

This issue is tied to the version of Protogen that is being used to generate the public comm interface on aarch64 platforms, specifically version 2.17.a, whereas 2.12.d is the last confirmed working version.

As it sits, users can perform the following as a workaround: a) Generate the communication files as is instructed via the included script. b) Modify the three function calls within decodeGpsDataPacketStructure that use user when it should be pg_user. i.e. constructGpsEcefPosVel, computeDateAndTimeFromWeekAndItow, and constructGpsEcefUncertainty.

A more permanent fix: Fetch the v2.12.d release code for Protogen and build the application on aarrch64, replacing the orion-sdk-original/Protogen/Linux/aarch64/Protogen executable with the build output.

trilliumbuild commented 6 months ago

The issue is indeed related with previous protogen binaries that were built against 2.17.a. These have been corrected.