The following fixes are to be done to increase the code quality:
- avoid implicit casting by using matching types or casting when it is safe. If it is not always safe, use a conversion function to dynamically check that the origin value can fit in the destination type
- add parenthesis for better readability of some expressions
- check the returning value of functions
- add const keyword when mutability is not required
- remove bitfields
- expose and address an Arm GNU Compiler bug regarding the cmse_nonsecure_caller intrinsic
- cast unused parameters/values to void to be more explicit
- add parenthesis around macro parameters
- encapsulate function-like macros into a function to avoid name clashes
- initialise unitialised variables
This fix can first mainly focus on the core components of TF-M (without tests, NS app and platform code).