Hi Roman,

 

The patch has increased the TARGET_CONFIG priority over PROJECT_CONFIG, and added #ifndef to the profile configuration files.

 

> But this #undef/#define approach is not safe

#undef/#define approach is not needed as we use #ifndef for all default values.

 

> It means that project developer need to #undef ITS_STACK_SIZE

The default ITS_STACK_SIZE is defined by  a profile configuration.

If needed, any parameter defined in a profile or in the default configuration can be changed in TARGET_CONFIG without #undef.

 

Best regards,

Andrej

 

From: Roman.Mazurak@infineon.com <Roman.Mazurak@infineon.com>
Sent: Friday, June 30, 2023 1:12 PM
To: tf-m@lists.trustedfirmware.org
Cc: Andrej Butok <andrey.butok@nxp.com>; Kevin.Peng@arm.com
Subject: Configuration order

 

Hi Andrey,

 

Patch 21339 introduced changes of configuration order:

  1. Platform configuration via TARGET_CONFIG_HEADER_FILE.
  2. Project configuration via PROJECT_CONFIG_HEADER_FILE
  3. config_base.h

 

It means that target can’t change configuration that is expected to be changed by project. Example:

  1. Platform must redefine ITS_STACK_SIZE to satisfy driver requirements. The good way for this is to set ITS_STACK_SIZE in config_tfm_target.h.
  2. Project developer need to perform some additional debugging or profiling of the product, so the TF-M must be built with extra code that require additional stack size. It means that project developer need to #undef ITS_STACK_SIZE and then redefine it using #define ITS_STACK_SIZE. But this #undef/#define approach is not safe, because it’s possible to calculate some other settings using configuration variable in config_tfm_target.h or perform additional configuration validation by config_tfm_target.h.

 

It looks like the new changes created another bunch of problems for TF-M configuration.

 

Regards,

Roman.