-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Minimal code to run LF on FlexPRET with uC runtime #2417
Conversation
… print the expected "hello world"
fun generateCtorDefinition() = with(PrependOperator) { | ||
""" | ||
| void ${reactor.name}_ctor(${reactor.name} *self, Environment *env) { | ||
| size_t trigger_idx = 0; | ||
| Reactor_ctor(&self->super, "${reactor.name}", env, ${if (numChildren > 0) "self->_children" else "NULL"}, $numChildren, ${if (reactor.reactions.size > 0) "self->_reactions" else "NULL"}, ${reactor.reactions.size}, ${if (numTriggers() > 0) "self->_triggers" else "NULL"}, ${numTriggers()}); | ||
| Reactor_ctor(&self->super, "${reactor.name}", env, NULL, ${if (numChildren > 0) "self->_children" else "NULL"}, $numChildren, ${if (reactor.reactions.size > 0) "self->_reactions" else "NULL"}, ${reactor.reactions.size}, ${if (numTriggers() > 0) "self->_triggers" else "NULL"}, ${numTriggers()}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erlingrj I had to add NULL
here to make it compile, but I assume it should be self->parent
for all reactors that are not the main
reactor. This might be needed on the base branch as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Thanks. Unfortunately, I have made some changes to the reactor-uc API that are not reflected yet in the code-generator. I will try to bring everything up-to-date soon
@magnmaeh, I am in the process of making some bigger changes to the reactor-uc API and will have to make some updates here in the code-generator as well. One key thing to realize is that we want the code generator to just output a CMake/Make project that can be included in another project. I.e. the main CMakeLists.txt lives outside, and also the main function. For the POSIX platform we have added a main function because it is convenient for quick testing. But we envision that for other platforms we generate a subdirectory in a project and include it in the existing build-flow |
@magnmaeh I have now merged in comprehensive changes to I am planning to fork |
Great work! I'll have a look :) |
I think this is ready for review as well. But I guess you don't want the main/CMake and main/main.c files to be part of the PR? I used it just to verify that it worked, which it did. After your additions it even magically solved my one issue with it not printing the "Hello world from FlexPRET!". So that was nice :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks mostly good, just a question about the including the toolchain file
|set(PLATFORM "FLEXPRET" CACHE STRING "Platform to target") | ||
| | ||
|if ($S{PLATFORM} STREQUAL "FLEXPRET") | ||
| # Must include toolchain file before project(), otherwise cmake | ||
| # will determine its own compiler settings | ||
| include(${S}ENV{FP_SDK_PATH}/cmake/riscv-toolchain.cmake) | ||
|endif() | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is necessary as long as the generated CMakeLists.txt is included from a project where the riscv-toolchain is include
Can you instead add these changes directly to https://github.com/erlingrj/reactor-uc which now contains the code-generator also? |
Currently a draft only