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

Support compilation for x86 as a static library using CMake. #201

Merged
merged 56 commits into from
Jan 17, 2023
Merged

Conversation

aentinger
Copy link
Member

This fixes #176.

@aentinger aentinger added topic: software Code that runs on a PC. type: enhancement PR to improve the project. labels Jan 11, 2023
@aentinger aentinger self-assigned this Jan 11, 2023
@aentinger
Copy link
Member Author

Hi @pavel-kirienko ☕ 👋

I've got some issue (invalid use of incomplete type) with my forward declarations. It works, but the compiler is not happy when I turn up -Wpedantic/-Werror:

-Arduino-Cyphal/src/Publisher.ipp: In member function ‘bool impl::Publisher<T>::publish(const T&)’:
107-Arduino-Cyphal/src/Publisher.ipp:45:10: error: invalid use of incomplete type ‘class Node’ [-Werror]
   45 |   return _node_hdl.enqueue_transfer(_tx_timeout_usec,
      |          ^~~~~~~~~

107-Arduino-Cyphal/src/Publisher.hpp:21:7: note: forward declaration of ‘class Node’
   21 | class Node;
      |       ^~~~

I'm not sure how to best solve this, as both Node and Publisher use the other class. Do you have any suggestion?

@pavel-kirienko
Copy link
Member

pavel-kirienko commented Jan 11, 2023

You cannot invoke methods on an incomplete type, so .enqueue_transfer() is not valid if Node is only forward-declared. I recommend extracting the Publisher base class into a separate header file to break the cyclic dependency such that the resulting dependency is like this: PublisherBase <- Node <- Publisher<>

@107-systems 107-systems deleted a comment from github-actions bot Jan 11, 2023
@aentinger
Copy link
Member Author

Thank you for the pointer, I managed to break the circular dependency by extracting base classes into a separate header file (and inventing one, where none existed before).

@107-systems 107-systems deleted a comment from github-actions bot Jan 17, 2023
@107-systems 107-systems deleted a comment from github-actions bot Jan 17, 2023
@github-actions
Copy link

Memory usage change @ 6ee8649

Board flash % RAM for global variables %
adafruit:samd:adafruit_feather_m4_can 💚 -184 - -84 -0.04 - -0.02 N/A N/A
arduino:mbed_edge:edge_control 💚 -360 - -128 -0.04 - -0.01 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_nano:nano33ble 💚 -360 - -136 -0.04 - -0.01 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_nano:nanorp2040connect 💚 -329 - -70 -0.0 - -0.0 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_portenta:envie_m7 💚 -296 - -72 -0.04 - -0.01 🔺 +16 - +16 0.0 - 0.0
arduino:samd:mkrzero 💚 -196 - -68 -0.07 - -0.03 🔺 +16 - +20 +0.05 - +0.06
esp32:esp32:esp32 💚 -420 - -164 -0.03 - -0.01 🔺 +16 - +16 0.0 - 0.0
rp2040:rp2040:rpipico 💚 -208 - -40 -0.01 - -0.0 🔺 +16 - +16 +0.01 - +0.01
Click for full report table
Board examples/OpenCyphal-Blink
flash
% examples/OpenCyphal-Blink
RAM for global variables
% examples/OpenCyphal-GNSS-Node
flash
% examples/OpenCyphal-GNSS-Node
RAM for global variables
% examples/OpenCyphal-Heartbeat-Publisher
flash
% examples/OpenCyphal-Heartbeat-Publisher
RAM for global variables
% examples/OpenCyphal-Heartbeat-Subscriber
flash
% examples/OpenCyphal-Heartbeat-Subscriber
RAM for global variables
% examples/OpenCyphal-Service-Client
flash
% examples/OpenCyphal-Service-Client
RAM for global variables
% examples/OpenCyphal-Service-Server
flash
% examples/OpenCyphal-Service-Server
RAM for global variables
% examples/OpenCyphal-ToF-Distance-Sensor-Node
flash
% examples/OpenCyphal-ToF-Distance-Sensor-Node
RAM for global variables
%
adafruit:samd:adafruit_feather_m4_can -132 -0.03 N/A N/A -144 -0.03 N/A N/A -84 -0.02 N/A N/A -184 -0.04 N/A N/A -184 -0.04 N/A N/A -184 -0.04 N/A N/A -168 -0.03 N/A N/A
arduino:mbed_edge:edge_control -192 -0.02 16 0.01 -256 -0.03 16 0.01 -128 -0.01 16 0.01 -216 -0.02 16 0.01 -280 -0.03 16 0.01 -280 -0.03 16 0.01 -360 -0.04 16 0.01
arduino:mbed_nano:nano33ble -192 -0.02 16 0.01 -264 -0.03 16 0.01 -136 -0.01 16 0.01 -216 -0.02 16 0.01 -280 -0.03 16 0.01 -216 -0.02 16 0.01 -360 -0.04 16 0.01
arduino:mbed_nano:nanorp2040connect -134 -0.0 16 0.01 -136 -0.0 16 0.01 -70 -0.0 16 0.01 -190 -0.0 16 0.01 -198 -0.0 16 0.01 -198 -0.0 16 0.01 -329 -0.0 16 0.01
arduino:mbed_portenta:envie_m7 -128 -0.02 16 0.0 -128 -0.02 16 0.0 -72 -0.01 16 0.0 -216 -0.03 16 0.0 -216 -0.03 16 0.0 -216 -0.03 16 0.0 -296 -0.04 16 0.0
arduino:samd:mkrzero -132 -0.05 16 0.05 -144 -0.05 16 0.05 -68 -0.03 20 0.06 -188 -0.07 16 0.05 -196 -0.07 16 0.05 -196 -0.07 16 0.05 -168 -0.06 16 0.05
esp32:esp32:esp32 -248 -0.02 16 0.0 -196 -0.01 16 0.0 -164 -0.01 16 0.0 -308 -0.02 16 0.0 -308 -0.02 16 0.0 -296 -0.02 16 0.0 -420 -0.03 16 0.0
rp2040:rp2040:rpipico -136 -0.01 16 0.01 -56 -0.0 16 0.01 -40 -0.0 16 0.01 -208 -0.01 16 0.01 -200 -0.01 16 0.01 -208 -0.01 16 0.01 -136 -0.01 16 0.01
Click for full report CSV
Board,examples/OpenCyphal-Blink<br>flash,%,examples/OpenCyphal-Blink<br>RAM for global variables,%,examples/OpenCyphal-GNSS-Node<br>flash,%,examples/OpenCyphal-GNSS-Node<br>RAM for global variables,%,examples/OpenCyphal-Heartbeat-Publisher<br>flash,%,examples/OpenCyphal-Heartbeat-Publisher<br>RAM for global variables,%,examples/OpenCyphal-Heartbeat-Subscriber<br>flash,%,examples/OpenCyphal-Heartbeat-Subscriber<br>RAM for global variables,%,examples/OpenCyphal-Service-Client<br>flash,%,examples/OpenCyphal-Service-Client<br>RAM for global variables,%,examples/OpenCyphal-Service-Server<br>flash,%,examples/OpenCyphal-Service-Server<br>RAM for global variables,%,examples/OpenCyphal-ToF-Distance-Sensor-Node<br>flash,%,examples/OpenCyphal-ToF-Distance-Sensor-Node<br>RAM for global variables,%
adafruit:samd:adafruit_feather_m4_can,-132,-0.03,N/A,N/A,-144,-0.03,N/A,N/A,-84,-0.02,N/A,N/A,-184,-0.04,N/A,N/A,-184,-0.04,N/A,N/A,-184,-0.04,N/A,N/A,-168,-0.03,N/A,N/A
arduino:mbed_edge:edge_control,-192,-0.02,16,0.01,-256,-0.03,16,0.01,-128,-0.01,16,0.01,-216,-0.02,16,0.01,-280,-0.03,16,0.01,-280,-0.03,16,0.01,-360,-0.04,16,0.01
arduino:mbed_nano:nano33ble,-192,-0.02,16,0.01,-264,-0.03,16,0.01,-136,-0.01,16,0.01,-216,-0.02,16,0.01,-280,-0.03,16,0.01,-216,-0.02,16,0.01,-360,-0.04,16,0.01
arduino:mbed_nano:nanorp2040connect,-134,-0.0,16,0.01,-136,-0.0,16,0.01,-70,-0.0,16,0.01,-190,-0.0,16,0.01,-198,-0.0,16,0.01,-198,-0.0,16,0.01,-329,-0.0,16,0.01
arduino:mbed_portenta:envie_m7,-128,-0.02,16,0.0,-128,-0.02,16,0.0,-72,-0.01,16,0.0,-216,-0.03,16,0.0,-216,-0.03,16,0.0,-216,-0.03,16,0.0,-296,-0.04,16,0.0
arduino:samd:mkrzero,-132,-0.05,16,0.05,-144,-0.05,16,0.05,-68,-0.03,20,0.06,-188,-0.07,16,0.05,-196,-0.07,16,0.05,-196,-0.07,16,0.05,-168,-0.06,16,0.05
esp32:esp32:esp32,-248,-0.02,16,0.0,-196,-0.01,16,0.0,-164,-0.01,16,0.0,-308,-0.02,16,0.0,-308,-0.02,16,0.0,-296,-0.02,16,0.0,-420,-0.03,16,0.0
rp2040:rp2040:rpipico,-136,-0.01,16,0.01,-56,-0.0,16,0.01,-40,-0.0,16,0.01,-208,-0.01,16,0.01,-200,-0.01,16,0.01,-208,-0.01,16,0.01,-136,-0.01,16,0.01

@github-actions
Copy link

Memory usage change @ 779617e

Board flash % RAM for global variables %
adafruit:samd:adafruit_feather_m4_can 💚 -184 - -84 -0.04 - -0.02 N/A N/A
arduino:mbed_edge:edge_control 💚 -360 - -128 -0.04 - -0.01 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_nano:nano33ble 💚 -360 - -136 -0.04 - -0.01 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_nano:nanorp2040connect 💚 -329 - -70 -0.0 - -0.0 🔺 +16 - +16 +0.01 - +0.01
arduino:mbed_portenta:envie_m7 💚 -296 - -72 -0.04 - -0.01 🔺 +16 - +16 0.0 - 0.0
arduino:samd:mkrzero 💚 -196 - -68 -0.07 - -0.03 🔺 +16 - +20 +0.05 - +0.06
esp32:esp32:esp32 💚 -420 - -164 -0.03 - -0.01 🔺 +16 - +16 0.0 - 0.0
rp2040:rp2040:rpipico 💚 -208 - -40 -0.01 - -0.0 🔺 +16 - +16 +0.01 - +0.01
Click for full report table
Board examples/OpenCyphal-Blink
flash
% examples/OpenCyphal-Blink
RAM for global variables
% examples/OpenCyphal-GNSS-Node
flash
% examples/OpenCyphal-GNSS-Node
RAM for global variables
% examples/OpenCyphal-Heartbeat-Publisher
flash
% examples/OpenCyphal-Heartbeat-Publisher
RAM for global variables
% examples/OpenCyphal-Heartbeat-Subscriber
flash
% examples/OpenCyphal-Heartbeat-Subscriber
RAM for global variables
% examples/OpenCyphal-Service-Client
flash
% examples/OpenCyphal-Service-Client
RAM for global variables
% examples/OpenCyphal-Service-Server
flash
% examples/OpenCyphal-Service-Server
RAM for global variables
% examples/OpenCyphal-ToF-Distance-Sensor-Node
flash
% examples/OpenCyphal-ToF-Distance-Sensor-Node
RAM for global variables
%
adafruit:samd:adafruit_feather_m4_can -132 -0.03 N/A N/A -144 -0.03 N/A N/A -84 -0.02 N/A N/A -184 -0.04 N/A N/A -184 -0.04 N/A N/A -184 -0.04 N/A N/A -168 -0.03 N/A N/A
arduino:mbed_edge:edge_control -192 -0.02 16 0.01 -256 -0.03 16 0.01 -128 -0.01 16 0.01 -216 -0.02 16 0.01 -280 -0.03 16 0.01 -280 -0.03 16 0.01 -360 -0.04 16 0.01
arduino:mbed_nano:nano33ble -192 -0.02 16 0.01 -264 -0.03 16 0.01 -136 -0.01 16 0.01 -216 -0.02 16 0.01 -280 -0.03 16 0.01 -216 -0.02 16 0.01 -360 -0.04 16 0.01
arduino:mbed_nano:nanorp2040connect -134 -0.0 16 0.01 -136 -0.0 16 0.01 -70 -0.0 16 0.01 -190 -0.0 16 0.01 -198 -0.0 16 0.01 -198 -0.0 16 0.01 -329 -0.0 16 0.01
arduino:mbed_portenta:envie_m7 -128 -0.02 16 0.0 -128 -0.02 16 0.0 -72 -0.01 16 0.0 -216 -0.03 16 0.0 -216 -0.03 16 0.0 -216 -0.03 16 0.0 -296 -0.04 16 0.0
arduino:samd:mkrzero -132 -0.05 16 0.05 -144 -0.05 16 0.05 -68 -0.03 20 0.06 -188 -0.07 16 0.05 -196 -0.07 16 0.05 -196 -0.07 16 0.05 -168 -0.06 16 0.05
esp32:esp32:esp32 -248 -0.02 16 0.0 -196 -0.01 16 0.0 -164 -0.01 16 0.0 -308 -0.02 16 0.0 -308 -0.02 16 0.0 -296 -0.02 16 0.0 -420 -0.03 16 0.0
rp2040:rp2040:rpipico -136 -0.01 16 0.01 -56 -0.0 16 0.01 -40 -0.0 16 0.01 -208 -0.01 16 0.01 -200 -0.01 16 0.01 -208 -0.01 16 0.01 -136 -0.01 16 0.01
Click for full report CSV
Board,examples/OpenCyphal-Blink<br>flash,%,examples/OpenCyphal-Blink<br>RAM for global variables,%,examples/OpenCyphal-GNSS-Node<br>flash,%,examples/OpenCyphal-GNSS-Node<br>RAM for global variables,%,examples/OpenCyphal-Heartbeat-Publisher<br>flash,%,examples/OpenCyphal-Heartbeat-Publisher<br>RAM for global variables,%,examples/OpenCyphal-Heartbeat-Subscriber<br>flash,%,examples/OpenCyphal-Heartbeat-Subscriber<br>RAM for global variables,%,examples/OpenCyphal-Service-Client<br>flash,%,examples/OpenCyphal-Service-Client<br>RAM for global variables,%,examples/OpenCyphal-Service-Server<br>flash,%,examples/OpenCyphal-Service-Server<br>RAM for global variables,%,examples/OpenCyphal-ToF-Distance-Sensor-Node<br>flash,%,examples/OpenCyphal-ToF-Distance-Sensor-Node<br>RAM for global variables,%
adafruit:samd:adafruit_feather_m4_can,-132,-0.03,N/A,N/A,-144,-0.03,N/A,N/A,-84,-0.02,N/A,N/A,-184,-0.04,N/A,N/A,-184,-0.04,N/A,N/A,-184,-0.04,N/A,N/A,-168,-0.03,N/A,N/A
arduino:mbed_edge:edge_control,-192,-0.02,16,0.01,-256,-0.03,16,0.01,-128,-0.01,16,0.01,-216,-0.02,16,0.01,-280,-0.03,16,0.01,-280,-0.03,16,0.01,-360,-0.04,16,0.01
arduino:mbed_nano:nano33ble,-192,-0.02,16,0.01,-264,-0.03,16,0.01,-136,-0.01,16,0.01,-216,-0.02,16,0.01,-280,-0.03,16,0.01,-216,-0.02,16,0.01,-360,-0.04,16,0.01
arduino:mbed_nano:nanorp2040connect,-134,-0.0,16,0.01,-136,-0.0,16,0.01,-70,-0.0,16,0.01,-190,-0.0,16,0.01,-198,-0.0,16,0.01,-198,-0.0,16,0.01,-329,-0.0,16,0.01
arduino:mbed_portenta:envie_m7,-128,-0.02,16,0.0,-128,-0.02,16,0.0,-72,-0.01,16,0.0,-216,-0.03,16,0.0,-216,-0.03,16,0.0,-216,-0.03,16,0.0,-296,-0.04,16,0.0
arduino:samd:mkrzero,-132,-0.05,16,0.05,-144,-0.05,16,0.05,-68,-0.03,20,0.06,-188,-0.07,16,0.05,-196,-0.07,16,0.05,-196,-0.07,16,0.05,-168,-0.06,16,0.05
esp32:esp32:esp32,-248,-0.02,16,0.0,-196,-0.01,16,0.0,-164,-0.01,16,0.0,-308,-0.02,16,0.0,-308,-0.02,16,0.0,-296,-0.02,16,0.0,-420,-0.03,16,0.0
rp2040:rp2040:rpipico,-136,-0.01,16,0.01,-56,-0.0,16,0.01,-40,-0.0,16,0.01,-208,-0.01,16,0.01,-200,-0.01,16,0.01,-208,-0.01,16,0.01,-136,-0.01,16,0.01

…ME.md


Do as Pavel says.

Co-authored-by: Pavel Kirienko <pavel.kirienko@gmail.com>
@107-systems 107-systems deleted a comment from github-actions bot Jan 17, 2023
@aentinger aentinger merged commit 4212b9b into main Jan 17, 2023
@aentinger aentinger deleted the fix-176 branch January 17, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: software Code that runs on a PC. type: enhancement PR to improve the project.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature Request] Support x86 as compilation target
2 participants