diff --git a/cmake/firmware/linker_script/gen_lds.cmake b/cmake/firmware/linker_script/gen_lds.cmake index 9a84df5..8c13bd5 100644 --- a/cmake/firmware/linker_script/gen_lds.cmake +++ b/cmake/firmware/linker_script/gen_lds.cmake @@ -56,6 +56,12 @@ function(gen_lds IP_LIB) # Get the system RDL files for the IP library get_ip_sources(RDL_FILES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + # Check if system RDL files exist if(NOT RDL_FILES) message(FATAL_ERROR "Library ${IP_LIB} does not have RDL_FILES property set, unable to run ${CMAKE_CURRENT_FUNCTION}") @@ -76,6 +82,7 @@ function(gen_lds IP_LIB) OUTPUT ${LDS_FILE} ${STAMP_FILE} COMMAND ${Python3_EXECUTABLE} ${LDS_GEN_TOOL} --rdlfiles ${RDL_FILES} + ${INCDIR_ARG} --outfile ${LDS_FILE} ${ARG_NODEBUG} ${OVERWRITTEN_PARAMETERS} diff --git a/cmake/firmware/linker_script/src/gen_linker_script.py b/cmake/firmware/linker_script/src/gen_linker_script.py index 6549460..c2d2f8d 100644 --- a/cmake/firmware/linker_script/src/gen_linker_script.py +++ b/cmake/firmware/linker_script/src/gen_linker_script.py @@ -174,6 +174,13 @@ def main(): parser.add_argument('--outfile', required=True, help='Output lds file') parser.add_argument('--debug', default=False, action="store_true", help='Include debug section in the lds or discard it') parser.add_argument('-p', '--param', nargs='+', help="Parameter to overwrite on top RDL module in the format 'PARAM=VALUE'") + parser.add_argument( + "-I", + dest="incdirs", + metavar="INCDIR", + action="append", + help='Search directory for files included with `include "filename"', + ) args = parser.parse_args() @@ -187,7 +194,7 @@ def main(): try: for input_file in args.rdlfiles: - rdlc.compile_file(input_file) + rdlc.compile_file(input_file, incl_search_paths=args.incdirs,) root = rdlc.elaborate(parameters=overwritten_params_dict) except RDLCompileError: sys.exit(1) diff --git a/cmake/peakrdl/peakrdl_docusaurus.cmake b/cmake/peakrdl/peakrdl_docusaurus.cmake index 3ec73e1..82bb837 100644 --- a/cmake/peakrdl/peakrdl_docusaurus.cmake +++ b/cmake/peakrdl/peakrdl_docusaurus.cmake @@ -30,6 +30,12 @@ function(peakrdl_docusaurus IP_LIB) get_ip_sources(RDL_FILES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + if(NOT RDL_FILES) message(FATAL_ERROR "Library ${IP_LIB} does not have RDL_FILES property set, unable to run ${CMAKE_CURRENT_FUNCTION}") @@ -38,6 +44,7 @@ function(peakrdl_docusaurus IP_LIB) find_python3() set(__CMD ${Python3_EXECUTABLE} -m peakrdl docusaurus + ${INCDIR_ARG} -o ${OUTDIR} ${RDL_FILES} ${_ARG_SIDEBAR_TEMPLATE} diff --git a/cmake/peakrdl/peakrdl_halcpp.cmake b/cmake/peakrdl/peakrdl_halcpp.cmake index d8bf65c..ff9030b 100644 --- a/cmake/peakrdl/peakrdl_halcpp.cmake +++ b/cmake/peakrdl/peakrdl_halcpp.cmake @@ -66,6 +66,12 @@ function(peakrdl_halcpp IP_LIB) get_ip_sources(RDL_FILES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + __ext_header_provided(${IP_LIB} libs) list(LENGTH libs libs_len) if(libs_len GREATER 0) @@ -83,7 +89,7 @@ function(peakrdl_halcpp IP_LIB) find_python3() set(__CMD ${Python3_EXECUTABLE} -m peakrdl halcpp - ${RDL_FILES} ${EXT_ARG} ${SKIB_BUSES_ARG} -o ${OUTDIR} ${OVERWRITTEN_PARAMETERS} + ${RDL_FILES} ${EXT_ARG} ${SKIB_BUSES_ARG} ${INCDIR_ARG} -o ${OUTDIR} ${OVERWRITTEN_PARAMETERS} ) target_include_directories(${IP_LIB} INTERFACE ${OUTDIR} ${OUTDIR}/include) diff --git a/cmake/peakrdl/peakrdl_regblock.cmake b/cmake/peakrdl/peakrdl_regblock.cmake index 0624194..5e308d5 100644 --- a/cmake/peakrdl/peakrdl_regblock.cmake +++ b/cmake/peakrdl/peakrdl_regblock.cmake @@ -81,6 +81,12 @@ function(peakrdl_regblock IP_LIB) # This function gets the IP sources and the deps get_ip_sources(RDL_SOURCES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + if(NOT RDL_SOURCES) message(FATAL_ERROR "Library ${IP_LIB} does not have SYSTEMRDL_SOURCES property set, unable to run ${CMAKE_CURRENT_FUNCTION}") @@ -91,6 +97,7 @@ function(peakrdl_regblock IP_LIB) --rename ${REGBLOCK_NAME} ${INTF_ARG} ${RESET_ARG} + ${INCDIR_ARG} -o ${OUTDIR} ${RDL_SOURCES} ) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 0023a7c..159bccb 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -62,6 +62,12 @@ function(peakrdl_regblock_wrap IP_LIB) # This function gets the IP sources and the deps get_ip_sources(RDL_SOURCES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + if(NOT RDL_SOURCES) message(FATAL_ERROR "Library ${IP_LIB} does not have SYSTEMRDL_SOURCES property set, unable to run ${CMAKE_CURRENT_FUNCTION}") @@ -76,6 +82,7 @@ function(peakrdl_regblock_wrap IP_LIB) ${INTF_ARG} ${RESET_ARG} ${TMR_OPT} + ${INCDIR_ARG} -o ${OUTDIR} ${RDL_SOURCES} ) diff --git a/cmake/peakrdl/peakrdl_socgen/common/socgen_props.rdl b/cmake/peakrdl/peakrdl_socgen/common/socgen_props.rdl index 6f838f2..9d6def1 100644 --- a/cmake/peakrdl/peakrdl_socgen/common/socgen_props.rdl +++ b/cmake/peakrdl/peakrdl_socgen/common/socgen_props.rdl @@ -28,6 +28,15 @@ property datatype { component = signal; }; +// For IPs that have a regblock_wrap target, bind this property +// to signals that are only used within the wrapper and are not +// ports of the core logic. +property wrap_only { + type = boolean; + default=true; + component = signal; +}; + property master { type = boolean; component = addrmap; diff --git a/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake b/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake index 26d9c7c..bafdc22 100644 --- a/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake +++ b/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake @@ -113,6 +113,12 @@ function(peakrdl_socgen IP_LIB) get_ip_sources(RDL_SOCGEN_GLUE ${IP_LIB} SYSTEMRDL_SOCGEN) get_ip_sources(SYSTEMRDL_SOURCES ${IP_LIB} SYSTEMRDL) + # Get SystemRDL include directories + get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) + if(INC_DIRS) + set(INCDIR_ARG -I ${INC_DIRS}) + endif() + if(NOT SYSTEMRDL_SOURCES) message(FATAL_ERROR "Library ${IP_LIB} does not have SYSTEMRDL_SOURCES property set, unable to run ${CMAKE_CURRENT_FUNCTION}") @@ -122,6 +128,7 @@ function(peakrdl_socgen IP_LIB) set(__CMD ${Python3_EXECUTABLE} -m peakrdl socgen --intfs ${RDL_SOCGEN_GLUE} + ${INCDIR_ARG} -o ${OUTDIR} ${SYSTEMRDL_SOURCES} ${ARG_USE_INCLUDE}