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

Execute code generation in cmake #48

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

Cantonplas
Copy link
Contributor

@Cantonplas Cantonplas commented Feb 28, 2025

When you build the project it should detect the name of the board and creates the generated code of the board. Needs further testing but should work.

Oops now i see that i merged the other pr into this one, but well this pr only changes 4 lines in generator.py and the cmakelist

Copy link
Member

@g0nz4I0 g0nz4I0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the change that modifies the STLIB apth, also maybe it would be interesting if you change the base branch, and compare it with the other branch instead of with main.

@@ -4,8 +4,7 @@
"path": "."
},
{
"name": "ST-LIB",
"path": "../ST-LIB"
"path": "../Projectos/ST-LIB"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't affect anymore

Copy link
Member

@jmaralo jmaralo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful! You are removing the state_machine code generation, put it back and adapt it to the new structure, it will be needed later on

CMakeLists.txt Outdated
@@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 3.14)

project (template-project ASM C CXX)
set(EXECUTABLE ${PROJECT_NAME}.elf)
set(Board ${PROJECT_NAME})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(Board ${PROJECT_NAME})
set(ADJ_BOARD ${PROJECT_NAME})

Comment on lines +175 to +178
add_custom_target(run_generator ALL
COMMAND ${Python3_EXECUTABLE} ${GENERATOR_SCRIPT} ${Board}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to add a new target, you can add a command that generates packets, see #49 for how Gonzalo is doing it, altough I also added some comments there on how he is doing it, but long story short, you can use add_custom_command() with a command that generates code, see the docs here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this submodule to Code_Generation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this file, it is no longer needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this file?

Copy link
Member

@jmaralo jmaralo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget the previous review comment, but still the code is a bit hard to read, you should split all into four, one generator for data packets, another one for orders, another one for protections and another one for the state machine, and also split the generator, descriptors and templates into four. The code as is is a bit unclear and the option to just execute one generator is desirable

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.

4 participants