crypto-client: reorganize source files/folders
The goal is to keep psasim as simple as possible:
- do not build a separate lib for psa-ff; build those source
files as part of server or client
- do not have lot of different makefiles: just 1 that does all
we need
- do not have several subfolders for headers: only 1 is enough
for this kind of project
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/psa-client-server/psasim/tools/psa_autogen.py b/tests/psa-client-server/psasim/tools/psa_autogen.py
index 53b1fea..cece2b7 100755
--- a/tests/psa-client-server/psasim/tools/psa_autogen.py
+++ b/tests/psa-client-server/psasim/tools/psa_autogen.py
@@ -15,6 +15,9 @@
FILENAME = str(sys.argv[1])
+SCRIPT_PATH = os.path.dirname(__file__)
+GENERATED_H_PATH = os.path.join(SCRIPT_PATH, "..", "include", "psa_manifest")
+GENERATED_C_PATH = os.path.join(SCRIPT_PATH, "..", "src")
with open(str(FILENAME), "r") as read_file:
data = json.load(read_file)
@@ -32,14 +35,14 @@
irqs = []
try:
- os.mkdir("psa_manifest")
+ os.mkdir(GENERATED_H_PATH)
print("Generating psa_manifest directory")
except OSError:
print ("PSA manifest directory already exists")
- man = open(str("psa_manifest/" + FILENAME + ".h"), "w")
- pids = open("psa_manifest/pid.h", "a")
- sids = open("psa_manifest/sid.h", "a")
+ man = open(os.path.join(GENERATED_H_PATH, FILENAME + ".h"), "w")
+ pids = open(os.path.join(GENERATED_H_PATH, "pid.h"), "a")
+ sids = open(os.path.join(GENERATED_H_PATH, "sid.h"), "a")
if len(services) > 28:
print ("Unsupported number of services")
@@ -116,23 +119,20 @@
man.close()
symbols = []
- # Go through all the files in the current directory and look for the entrypoint
- for root, directories, filenames in os.walk('.'):
+ # Go through source files and look for the entrypoint
+ for root, directories, filenames in os.walk(GENERATED_C_PATH):
for filename in filenames:
-
if "psa_ff_bootstrap" in filename or filename == "psa_manifest":
continue
-
try:
fullpath = os.path.join(root,filename)
with open(fullpath, encoding='utf-8') as currentFile:
text = currentFile.read()
if str(entry_point + "(") in text:
- symbols.append(fullpath)
+ symbols.append(filename)
except IOError:
print("Couldn't open " + filename)
-
except UnicodeDecodeError:
pass
@@ -144,8 +144,9 @@
print("Duplicate entrypoint symbol detected: " + str(symbols))
sys.exit(2)
else:
- bs = open(str("psa_ff_bootstrap_" + str(partition_name) + ".c"), "w")
- bs.write("#include <psasim/init.h>\n")
+ bs = open(os.path.join(GENERATED_C_PATH, "psa_ff_bootstrap_" + partition_name + ".c"),
+ "w")
+ bs.write("#include <init.h>\n")
bs.write("#include \"" + symbols[0] + "\"\n")
bs.write("#include <signal.h>\n\n")
bs.write(qcode)