Skip to content

Conversation

@bocchino
Copy link
Collaborator

This PR adds code generation for direct calls with typed ports.

  • Implement code generation
  • Add unit tests

Code generation for serial ports is future work.

Further to #840.

@bocchino bocchino requested review from Kronos3 and LeStarch November 18, 2025 17:20
Fix bug in port resolution
@bocchino
Copy link
Collaborator Author

bocchino commented Nov 22, 2025

A couple of issues to fix, uncovered during integration:

  • The generated code for ports uses #if FW_DIRECT_PORT_CALLS before it includes the config header. This works only if FW_DIRECT_PORT_CALLS is defined on the command line. We need to support setting it in the config header.
  • The generated code for topologies uses #ifndef FW_DIRECT_PORT_CALLS instead of #if !FW_DIRECT_PORT_CALLS.

@bocchino
Copy link
Collaborator Author

bocchino commented Dec 2, 2025

Further issues uncovered during integration:

  • The topology code gen is not generating the functions CComponentBase::p_isConnected and CComponentBase::p_out in the case that (1) component C has an output port p and (2) an instance of C is part of the topology and (3) there is no connection from c.p for any instance c of C. This causes a linker error. In this case we should generate code that returns false for p_isConnected and runs ASSERT(0) for p_out, since an unconnected port should not be invoked.
  • The topology code gen does not correctly handle connections to the special input port cmd recv. The handlerBase calling protocol appears to be different than for general ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants