-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
This is prompted by #9446
There seems to be no way to create a simple non-TrustZone ARMv8 image - the tooling is assuming a binary choice between
- Cortex-M23: make a secure TrustZone library
- Cortex-M23-NS: make a non-secure TrustZone image (which must link in a secure library, maybe generated by the above)
There needs to be a third choice - make a simple non-TrustZone image. (That image would work either on a chip without TrustZone extension, or work on a TrustZone-capable chip by running entirely in Secure state).
We could adjust the core suffix to be 3-way. For that, this naming would make sense:
- Cortex-M33: make a non-TrustZone image
- Cortex-M33-S: make a secure TrustZone library
- Cortex-M33-NS: make a non-secure TrustZone image (which must link in a secure library, maybe generated by the above)
But it seems that the CPU options are starting to multiply out-of-hand there, what with the need to select DSP and FP too.
So, why is the secure choice part of the core name? It seems to me that it would be better handled like the SPE/NSPE choice for PSA - extra labels to indicate the "-S" and "-NS" variants, and the core is always just "Cortex-M33" (plus FP/DSP flags).
If you do that, the existing Python checks for "-NS" suffix or not convert like this:
if target.is_TZ_secure_target:
self.flags['cxx'].append("-mcmse")
self.flags['c'].append("-mcmse")
# Create Secure library
if (target.is_TZ_secure_target and
kwargs.get('build_dir', False)):
build_dir = kwargs['build_dir']
secure_file = join(build_dir, "cmse_lib.o")
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]
# Add linking time preprocessor macro DOMAIN_NS
if target.is_TZ_nonsecure_target:
define_string = self.make_ld_define("DOMAIN_NS", "0x1")
self.flags["ld"].append(define_string)
Both conditions are false if it's a non-TrustZone image, making the build system act like ARMv7.
Issue request type
[ ] Question
[X] Enhancement
[ ] Bug