syscalls: Scan multiple folders to build complete syscall list
Previously the syscall list was generated only from the include folder. This is a limitation when the application tries to create system calls. This patch create a simple way to include these new syscalls without the application touching the kernel. This can be enabled by a Kconfig CONFIG_APPLICATION_DEFINED_SYSCALL. Once enabled the application source directory will be scanned to find all application defined syscalls. Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
530a71310e
commit
e67720bbf2
|
@ -428,6 +428,12 @@ else()
|
||||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${syscalls_subdirs_txt})
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${syscalls_subdirs_txt})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# SYSCALL_INCLUDE_DIRECTORY will include the directories that needs to be
|
||||||
|
# searched for syscall declarations if CONFIG_APPLICATION_DEFINED_SYSCALL is set
|
||||||
|
if(CONFIG_APPLICATION_DEFINED_SYSCALL)
|
||||||
|
set(SYSCALL_INCLUDE_DIRECTORY --include ${APPLICATION_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${syscalls_json}
|
${syscalls_json}
|
||||||
|
@ -435,6 +441,7 @@ add_custom_command(
|
||||||
${PYTHON_EXECUTABLE}
|
${PYTHON_EXECUTABLE}
|
||||||
${ZEPHYR_BASE}/scripts/parse_syscalls.py
|
${ZEPHYR_BASE}/scripts/parse_syscalls.py
|
||||||
--include ${ZEPHYR_BASE}/include # Read files from this dir
|
--include ${ZEPHYR_BASE}/include # Read files from this dir
|
||||||
|
${SYSCALL_INCLUDE_DIRECTORY}
|
||||||
--json-file ${syscalls_json} # Write this file
|
--json-file ${syscalls_json} # Write this file
|
||||||
DEPENDS ${syscalls_subdirs_trigger} ${PARSE_SYSCALLS_HEADER_DEPENDS}
|
DEPENDS ${syscalls_subdirs_trigger} ${PARSE_SYSCALLS_HEADER_DEPENDS}
|
||||||
)
|
)
|
||||||
|
|
|
@ -249,6 +249,13 @@ config BUILD_OUTPUT_STRIPPED
|
||||||
Build a stripped binary. This will build a zephyr.stripped file need
|
Build a stripped binary. This will build a zephyr.stripped file need
|
||||||
by some platforms.
|
by some platforms.
|
||||||
|
|
||||||
|
config APPLICATION_DEFINED_SYSCALL
|
||||||
|
bool "Scan application folder for any syscall definition"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Scan additional folders inside application source folder
|
||||||
|
for application defined syscalls.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,10 @@ def analyze_fn(match_group, fn):
|
||||||
return (fn, handler, invocation, sys_id, table_entry)
|
return (fn, handler, invocation, sys_id, table_entry)
|
||||||
|
|
||||||
|
|
||||||
def analyze_headers(base_path):
|
def analyze_headers(multiple_directories):
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
|
for base_path in multiple_directories:
|
||||||
for root, dirs, files in os.walk(base_path):
|
for root, dirs, files in os.walk(base_path):
|
||||||
for fn in files:
|
for fn in files:
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ def parse_args():
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument("-i", "--include", required=True,
|
parser.add_argument("-i", "--include", required=True, action='append',
|
||||||
help="Base include directory")
|
help="Base include directory")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-j", "--json-file", required=True,
|
"-j", "--json-file", required=True,
|
||||||
|
|
Loading…
Reference in a new issue