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

Enable OpenAMP Demo configuration via CMake #365

Merged
merged 3 commits into from
Apr 14, 2022

Conversation

bentheredonethat
Copy link
Contributor

Currently the demos' interrupt, shared memory and IPC structure values are hard-coded.

Allow these to configured via CMake configure by
(a) wrapping C symbols in #ifdef / #ifndef
(b) enabling linker script defined resource table location to be set in CMake.

Allow symbols for IPI and shared memory to be set in CMake configuration

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Allow symbols for IPI and shared memory to be set in CMake configuration

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
if(NOT DEFINED ${RSC_TABLE})
set(RSC_TABLE 0x3ed20000 CACHE STRING "")
endif(NOT DEFINED ${RSC_TABLE})

Copy link
Collaborator

Choose a reason for hiding this comment

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

This part is related to the machine, the resource table is optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated so that now this logic is only in the machine

@@ -38,7 +38,7 @@ foreach (_app rpmsg-echo-ping rpmsg-echo)
add_executable (${_app}.out ${_sources})
set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}")

target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group)
target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--defsym,_rsc_table=${RSC_TABLE} -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group)
Copy link
Collaborator

Choose a reason for hiding this comment

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

My apologize seems that my comment on my first review has not been saved...
Here it is the same the "--defsym,_rsc_table=${RSC_TABLE}" should come from the machine.
what's happen if ${RSC_TABLE} is not set?

here is an alternative:
https://github.com/OpenAMP/open-amp/blob/main/apps/system/generic/machine/zynqmp_r5/CMakeLists.txt#L6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated so that it is in this file

# If not provided, add default value for resource table
if(NOT DEFINED ${RSC_TABLE})
set(RSC_TABLE 0x3ed20000 CACHE STRING "")
endif(NOT DEFINED ${RSC_TABLE})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to the file you suggestd

@bentheredonethat
Copy link
Contributor Author

@arnopo updated so that only linker scripts and the 2 CMakeLists.txt files are updated. thanks

Currently the resource table location in the firmware is hard-coded.

Preserve the current functionality by adding a default value.

Allow user to overwrite the default resource table location by adding the
CMake property:

set(RSC_TABLE <address> CACHE STRING "")

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Copy link
Collaborator

@arnopo arnopo left a comment

Choose a reason for hiding this comment

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

I wonder if the application folder should not be in a separate repo as code is for demo and test and doesn't request same level of maturity.
@edmooring what is your feeling on this?

That's said for time being, LGTM with just a comment/question

#define SHM_DEV_NAME "3ed20000.shm" /* shared device name */

#endif /* SHM_DEV_NAME */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you really need to give a name that depend on the address?
Same for POLL_DEV_NAME and IPI_DEV_NAME

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for linux a name is needed as the device is accessed via UIO and device tree node name

@edmooring
Copy link
Contributor

I wonder if the application folder should not be in a separate repo as code is for demo and test and doesn't request same level of maturity. @edmooring what is your feeling on this?

That's said for time being, LGTM with just a comment/question

I think having the apps in a separate repository will make it harder for newcomers to work with the code. Their lives are hard enough already:)

Copy link
Contributor

@edmooring edmooring left a comment

Choose a reason for hiding this comment

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

Looks OK to me. Seems to work.

@arnopo arnopo merged commit 9b96acc into OpenAMP:main Apr 14, 2022
@arnopo arnopo added this to the Release V2022.04 milestone Apr 15, 2022
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.

3 participants