Hi All,
We're proposing to add an API that would allow to implement a custom post-startup initialization of hw, peripherals etc.
Contrarily to SystemInit() intended for a high priority hw initialization (for example clock and power subsystems), and called on a very early boot stage from startup code, these functions are called from C code, hence variables and other drivers data are protected from being cleared up by the C library init.
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1973
Ken and Mate, as maintainers of the TF-M core part, could you please take a look at the patch?
Thanks,
Andrey Narkevitch
Cypress Semiconductor
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
Hi Mate,
Thanks for the detailed explanation and confirmation that the SAU region number reference can be removed.
This will enable using CMSIS-Zone to configure also TF-M in an easy way.
I would appreciate if some can create a ticket to track progress.
Thanks,
Robert
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Mate Toth-Pal via TF-M
Sent: Thursday 26 September 2019 09:40
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Zone Alignment
Hi Robert,
The region IDs in 'tfm_ns_region_e' are used for two purposes in TF-M (just as you mention in your mail):
1. For configuring the SAU.
As far as I understood, with the CMSIS-Zone Utility it is possible to generate a 'tz_sau_nvic.c' file, which then can be added to the platform folder of a target in TF-M. The tfm_spm_hal_init_isolation_hw(...) hal function then can call the TZ_Config_SAU(...) function defined in 'tz_sau_nvic.c'. The TZ_Config_SAU(...) uses integer literals to address the different regions of the SAU, but that is OK for this purpose.
2. The tfm_core_memory_permission_check_handler(...) function The idea was that secure services would be able to query whether the caller NS client has access to a certain NS memory region.
Implementing this feature would require TF-M core to know whether a region returned by cmse_check_address_range is a Non-Secure memory or not. With the current output of the CMSIS-Zone Utility I don't see this is possible other than looking into the config of the SAU region and check the content of the RLAR register. (Although this would only reveal whether the region is S/NS, code/data differentiation should be done in a different way) However this feature never got implemented, and this is only supported in Library model. Also after removing isolation level 3 from Library model I think there is no point in keeping this function. So the reference to the SAU regions from this function can be removed.
So summarizing the above, I think there is no reason why CMSIS-Zone Utility could not be used in TF-M, and it seems that it could be integrated fairly easily.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 26 September 2019 09:27
To: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Zone Alignment
Hi Summer,
Thanks for looking into this.
Requesting a specific SAU region number for a specific memory region is an inconvenience for CMSIS-Zone. It introduces additional complexity for the user who would need to know and configure this and also for the tool to handle.
Normally the user just configures the memory region (address, size, access. security, privilege, ...) and leaves to the tool to assign a region and generate the SAU setup code.
Having the additional constrain (ex: NS_CODE needs to be assigned to RGN=0) is just another obstacle and source of error in user configuration of the memory layout for TF-M.
I would help if TF-M would remove the constrain on specific region number assignments.
Thanks,
Robert
-----Original Message-----
From: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com>
Sent: Thursday 26 September 2019 08:14
To: Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Zone Alignment
Hi Robert,
I think the static defined region number would be much for easier for implementation:
First, we need to assign a Region Number together with RBAR and RLAR.
Then, we could use the Region Number to stand for the region that is configured by the RBAR and RLAR.
It is just like an ID for a block of the memory.
Dose it causes some inconvenience for CMSIS-Zone?
Regards,
Summer
On 9/13/19, 6:56 PM, "TF-M on behalf of Robert Rostohar via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
Hi,
We are working on CMSIS-Zone Utility [1] which is a GUI tool for configuring a complex system. This includes also TrustZone setup (SAU) and device specific MPC and PPC.
This tool can be also used to configure SAU, MPC and PPC in TF-M.
However TF-M currently requires that a specific region number is used for NS_REGION_CODE (0), NS_REGION_DATA (1), ...
Those region numbers are used when SAU is configured in function sau_and_idau_cfg and the code in function tfm_core_memory_permission_check_handler depends on it.
Is it really necessary that a specific region number is being used and why?
I have received indication that this in not really needed and that the code should be redesigned. This would enable the use of CMSIS-Zone to configure TF-M out of the box.
Thanks,
Robert
[1] https://github.com/ARM-software/CMSIS-Zone
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi Robert,
The region IDs in 'tfm_ns_region_e' are used for two purposes in TF-M (just as you mention in your mail):
1. For configuring the SAU.
As far as I understood, with the CMSIS-Zone Utility it is possible to generate a 'tz_sau_nvic.c' file, which then can be added to the platform folder of a target in TF-M. The tfm_spm_hal_init_isolation_hw(...) hal function then can call the TZ_Config_SAU(...) function defined in 'tz_sau_nvic.c'. The TZ_Config_SAU(...) uses integer literals to address the different regions of the SAU, but that is OK for this purpose.
2. The tfm_core_memory_permission_check_handler(...) function
The idea was that secure services would be able to query whether the caller NS client has access to a certain NS memory region.
Implementing this feature would require TF-M core to know whether a region returned by cmse_check_address_range is a Non-Secure memory or not. With the current output of the CMSIS-Zone Utility I don't see this is possible other than looking into the config of the SAU region and check the content of the RLAR register. (Although this would only reveal whether the region is S/NS, code/data differentiation should be done in a different way)
However this feature never got implemented, and this is only supported in Library model. Also after removing isolation level 3 from Library model I think there is no point in keeping this function. So the reference to the SAU regions from this function can be removed.
So summarizing the above, I think there is no reason why CMSIS-Zone Utility could not be used in TF-M, and it seems that it could be integrated fairly easily.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 26 September 2019 09:27
To: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Zone Alignment
Hi Summer,
Thanks for looking into this.
Requesting a specific SAU region number for a specific memory region is an inconvenience for CMSIS-Zone. It introduces additional complexity for the user who would need to know and configure this and also for the tool to handle.
Normally the user just configures the memory region (address, size, access. security, privilege, ...) and leaves to the tool to assign a region and generate the SAU setup code.
Having the additional constrain (ex: NS_CODE needs to be assigned to RGN=0) is just another obstacle and source of error in user configuration of the memory layout for TF-M.
I would help if TF-M would remove the constrain on specific region number assignments.
Thanks,
Robert
-----Original Message-----
From: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com>
Sent: Thursday 26 September 2019 08:14
To: Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Zone Alignment
Hi Robert,
I think the static defined region number would be much for easier for implementation:
First, we need to assign a Region Number together with RBAR and RLAR.
Then, we could use the Region Number to stand for the region that is configured by the RBAR and RLAR.
It is just like an ID for a block of the memory.
Dose it causes some inconvenience for CMSIS-Zone?
Regards,
Summer
On 9/13/19, 6:56 PM, "TF-M on behalf of Robert Rostohar via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
Hi,
We are working on CMSIS-Zone Utility [1] which is a GUI tool for configuring a complex system. This includes also TrustZone setup (SAU) and device specific MPC and PPC.
This tool can be also used to configure SAU, MPC and PPC in TF-M.
However TF-M currently requires that a specific region number is used for NS_REGION_CODE (0), NS_REGION_DATA (1), ...
Those region numbers are used when SAU is configured in function sau_and_idau_cfg and the code in function tfm_core_memory_permission_check_handler depends on it.
Is it really necessary that a specific region number is being used and why?
I have received indication that this in not really needed and that the code should be redesigned. This would enable the use of CMSIS-Zone to configure TF-M out of the box.
Thanks,
Robert
[1] https://github.com/ARM-software/CMSIS-Zone
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Robert,
I think the static defined region number would be much for easier for implementation:
First, we need to assign a Region Number together with RBAR and RLAR.
Then, we could use the Region Number to stand for the region that is configured by the RBAR and RLAR.
It is just like an ID for a block of the memory.
Dose it causes some inconvenience for CMSIS-Zone?
Regards,
Summer
On 9/13/19, 6:56 PM, "TF-M on behalf of Robert Rostohar via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
Hi,
We are working on CMSIS-Zone Utility [1] which is a GUI tool for configuring a complex system. This includes also TrustZone setup (SAU) and device specific MPC and PPC.
This tool can be also used to configure SAU, MPC and PPC in TF-M.
However TF-M currently requires that a specific region number is used for NS_REGION_CODE (0), NS_REGION_DATA (1), ...
Those region numbers are used when SAU is configured in function sau_and_idau_cfg and the code in function tfm_core_memory_permission_check_handler depends on it.
Is it really necessary that a specific region number is being used and why?
I have received indication that this in not really needed and that the code should be redesigned. This would enable the use of CMSIS-Zone to configure TF-M out of the box.
Thanks,
Robert
[1] https://github.com/ARM-software/CMSIS-Zone
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi all,
Sorry for frequent review requests of merging feature-twincpu back. To avoid making it more annoying, I combine three topics here.
Please check the details below.
1. NS part changes
NSPE mailbox, NS PSA client call interface in multi-core topology, mailbox initialization in NS App main().
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-ns%22+(status:o…
2. Multi-core memory access check
Multi-core specific memory access check since multi-core platform cannot rely on the memory check provided by CMSE.
A dedicated design document is uploaded, which has been reviewed and accepted on feature-twincpu branch
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-mem-check%22+(s…
3. Changes to linker script
Several changes to linker script to enable multi-core build:
Adjust secure data sections layout to save MPU region and memory resource on Armv6-M/Armv7-M
Add a RAM code section to support running code from RAM.
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-link-script%22+…
This should be the last review request/last merge step before pushing specific multi-core platform support, I promise, at least in Sept. 😊
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Tuesday, September 24, 2019 2:07 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review the changes to TF-M core/SPM and mailbox from feature-twincpu branch
Hi all,
Here is the forth step of merging feature-twincpu back to master branch. It includes the changes to TF-M core/SPM and SPE mailbox implementation.
Please help review the patches via https://review.trustedfirmware.org/q/topic:%22twincpu-merge-core-mailbox%22…
I planned to split those features into multiple topics but failed due to the dependencies between them.
They are the key part of multi-core communication, plus the NS mailbox part. I'd like to introduce the components a little bit below.
1. Common PSA client call handlers
Multi-core topology invokes PSA client call via mailbox, rather than by calling veneers. https://review.trustedfirmware.org/c/trusted-firmware-m/+/2019/ extracts out common PSA client call handlers from existing svcalls. Single-Armv8-M and multi-core topology can implement their own PSA client call functions respectively and invoke the common PSA client call handlers.
2. Remote Procedure Call (RPC)
RPC layer sits between TF-M SPM and underlying SPE mailbox implementation. It decouples the actual mailbox implementations to TF-M SPM and defines several callbacks for underlying mailbox.
3. SPE mailbox
As the name implies, it implements the mailbox functionalities and RPC callbacks in SPE. It also defines mailbox HAL APIs for platforms.
The NSPE part mailbox will be uploaded later.
4. Generic multi-core functionalities
This part adds several TF-M core functions, with multi-core specific implementations, such as tfm_nspm_thread_entry () and tfm_psa_ipc_request_handler().
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Friday, September 20, 2019 5:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review topology changes for supporting diverse topology use cases
Hi all,
Would you please help review the following patches to support multi-core topology in TF-M?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-topology%22+(st…
Those patches prepare for multi-core support being merged from feature-twincpu branch to master branch. It is the third step of the merging back progress. The previous steps are multi-core build enhancement and Armv6-M/Armv7-M arch support below.
If it sounds interesting to you, I'm glad to share more details about multi-core development and plan of merging it back to master.
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Thursday, September 19, 2019 4:37 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review Armv6-M/Armv7-M support patches
Hi all,
Could you please take a look at the following patch set to add Armv6-M/Armv7-M support?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-arch%22+(status…
That patch set merges Armv6-M/Armv7-M support from feature-twincpu branch back to master branch. It is one step of the progress to merge feature-twincpu branch back to master branch.
Any suggestion is welcome. Thanks a lot.
Best regards,
Hu Ziji
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
The ITS design document has been on review for quite a while now, so I plan to merge it this week. If anyone still wants to make any comments, please do so soon here: https://review.trustedfirmware.org/c/trusted-firmware-m/+/1604
The ITS implementation is also open for review in this series of patches: https://review.trustedfirmware.org/c/trusted-firmware-m/+/1730
Kind regards,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Jamie Fox via TF-M
Sent: 22 July 2019 12:00
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] TF-M Internal Trusted Storage service design proposal
Hi all,
As you may be aware, implementing the PSA Internal Trusted Storage (ITS) APIs is on the TF-M roadmap for this quarter (https://developer.trustedfirmware.org/w/tf_m/planning/). We plan to implement these APIs with a new TF-M Internal Trusted Storage service.
The design proposal for the new TF-M ITS service is now available for design review here: https://review.trustedfirmware.org/c/trusted-firmware-m/+/1604 . The design is currently in "draft" state, which means further refinements are to be expected, and feedback is welcome.
For more information about the PSA ITS APIs themselves, the PSA Storage API document may be downloaded from here: https://pages.arm.com/PSA-APIs
Kind regards,
Jamie
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
PSA Trusted Boot and Firmware Update specification requires the support of at least one immutable root of trust public key (ROTPK) for firmware verification. It is beneficial to be able to provision these keys during the factory life-cycle of the device independently from any software components. The current key handling solution in TF-M secure boot does not supports this key provisioning process. MCUBoot requires compile time built-in public key(s) for image verification.
The following design proposal addressing this issue:
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1453/
Feel free to add any comments you want on the review!
BR,
Tamas
Hi all,
Here is the forth step of merging feature-twincpu back to master branch. It includes the changes to TF-M core/SPM and SPE mailbox implementation.
Please help review the patches via https://review.trustedfirmware.org/q/topic:%22twincpu-merge-core-mailbox%22…
I planned to split those features into multiple topics but failed due to the dependencies between them.
They are the key part of multi-core communication, plus the NS mailbox part. I'd like to introduce the components a little bit below.
1. Common PSA client call handlers
Multi-core topology invokes PSA client call via mailbox, rather than by calling veneers. https://review.trustedfirmware.org/c/trusted-firmware-m/+/2019/ extracts out common PSA client call handlers from existing svcalls. Single-Armv8-M and multi-core topology can implement their own PSA client call functions respectively and invoke the common PSA client call handlers.
2. Remote Procedure Call (RPC)
RPC layer sits between TF-M SPM and underlying SPE mailbox implementation. It decouples the actual mailbox implementations to TF-M SPM and defines several callbacks for underlying mailbox.
3. SPE mailbox
As the name implies, it implements the mailbox functionalities and RPC callbacks in SPE. It also defines mailbox HAL APIs for platforms.
The NSPE part mailbox will be uploaded later.
4. Generic multi-core functionalities
This part adds several TF-M core functions, with multi-core specific implementations, such as tfm_nspm_thread_entry () and tfm_psa_ipc_request_handler().
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Friday, September 20, 2019 5:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review topology changes for supporting diverse topology use cases
Hi all,
Would you please help review the following patches to support multi-core topology in TF-M?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-topology%22+(st…
Those patches prepare for multi-core support being merged from feature-twincpu branch to master branch. It is the third step of the merging back progress. The previous steps are multi-core build enhancement and Armv6-M/Armv7-M arch support below.
If it sounds interesting to you, I'm glad to share more details about multi-core development and plan of merging it back to master.
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Thursday, September 19, 2019 4:37 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review Armv6-M/Armv7-M support patches
Hi all,
Could you please take a look at the following patch set to add Armv6-M/Armv7-M support?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-arch%22+(status…
That patch set merges Armv6-M/Armv7-M support from feature-twincpu branch back to master branch. It is one step of the progress to merge feature-twincpu branch back to master branch.
Any suggestion is welcome. Thanks a lot.
Best regards,
Hu Ziji
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
Would you please help review the following patches to support multi-core topology in TF-M?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-topology%22+(st…
Those patches prepare for multi-core support being merged from feature-twincpu branch to master branch. It is the third step of the merging back progress. The previous steps are multi-core build enhancement and Armv6-M/Armv7-M arch support below.
If it sounds interesting to you, I'm glad to share more details about multi-core development and plan of merging it back to master.
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Thursday, September 19, 2019 4:37 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Please review Armv6-M/Armv7-M support patches
Hi all,
Could you please take a look at the following patch set to add Armv6-M/Armv7-M support?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-arch%22+(status…
That patch set merges Armv6-M/Armv7-M support from feature-twincpu branch back to master branch. It is one step of the progress to merge feature-twincpu branch back to master branch.
Any suggestion is welcome. Thanks a lot.
Best regards,
Hu Ziji
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
Could you please take a look at the following patch set to add Armv6-M/Armv7-M support?
https://review.trustedfirmware.org/q/topic:%22twincpu-merge-arch%22+(status…
That patch set merges Armv6-M/Armv7-M support from feature-twincpu branch back to master branch. It is one step of the progress to merge feature-twincpu branch back to master branch.
Any suggestion is welcome. Thanks a lot.
Best regards,
Hu Ziji
Hi All,
The patches for this change had been merged.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Mate Toth-Pal via TF-M
Sent: 26 August 2019 09:24
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: [TF-M] Removing legacy veneer support from TF-M library model
Hi All,
I'm planning to remove the custom veneer support for Library model from TF-M. Please see the proposed patch here: https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1597/
Ticket for the change is: https://developer.trustedfirmware.org/T439
After this change all secure services must use the automatically generated veneer functions in 'interface/include/tfm_veneers.h', as it is described in the design: https://developer.trustedfirmware.org/w/tf_m/design/uniform_secure_service_…
This change doesn't affect the NSPM secure functions ('TZ_.*()' and 'tfm_register_client_id()' ). This change also doesn't affect IPC model at all (i.e. psa api functions).
Regards,
Mate
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi,
I have created a patch to manipulate the handle value returned to caller.
At first when we was implementing IPC we created an unique id for handle, the price is we need to loop searching for the data structure from the list with this id, which increases the execution time.
Then we optimized this part return the memory allocated directly - since the memory is protected by hardware, the memory content could not be retrieved, either.
But to avoid the potential information leakage or some side channel attack on handles, we need to disturb it before return to user. The returned handle contains only limited
information so that it makes user hard to retrieve information on it.
Now the returned value is the offset inside handle pool, without showing the memory address directly. This can be enhanced later after the random generator is applied, we can disturb more on this part.
The patch is here:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1962
Please help to comment in this thread or in the issue tracker:
https://developer.trustedfirmware.org/T501
Thanks.
/Ken
"non-make based systems which are commonly used for microcontroller development"
This message must understand every TF-M developer!
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Monday, September 16, 2019 7:14 AM
To: Antonio De Angelis <Antonio.DeAngelis(a)arm.com>; Jamie Fox <Jamie.Fox(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Antonio, Jamie,
Thanks both for the explanations. It is understood how crypto headers are handled in TF-M and why.
However this approach is causing issues when using non-make based systems which are commonly used for microcontroller development.
I have explained already what the issue is and Andrej provided even more details in T428.
Please keep track of all issues that have been reported initially in this thread.
Thanks,
Robert
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: Friday 13 September 2019 09:08
To: Antonio De Angelis <Antonio.DeAngelis(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Antonio,
If you do not want to change the file name, could you at least change the include name?
For example, from #include "psa/crypto.h" to #include "tfm/psa/crypto.h"
It works in our port. Is it possible for you?
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: Thursday, September 12, 2019 10:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…);reserved=0), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
Hi Christian,
TF-M has solved this by adding mbedcrypto__ prefix to PSA functions implemented with mbed-crypto (see header crypto_spe.h). This works also when using component based system, besides the issue with headers discussed in this thread.
Best regards,
Robert
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Christian Daudt via TF-M
Sent: Saturday 14 September 2019 16:18
To: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
I'm failing to see how TFM and mbed-crypto can be both components in a TF-M system. I would expect that when I call e.g. "psa_import_key " from the NSPE, that must resolve to a single implementation, and it must be the TF-M client api that passes the request to the SPE crypto service - i.e. the code from interface/src/tfm_crypto_*_api.c. Can you describe how you see both being utilized simultaneously?
Thanks,
Christian.
On 2019-09-13, 3:07 AM, "TF-M on behalf of Andrej Butok via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
Hi Antonio,
If you do not want to change the file name, could you at least change the include name?
For example, from #include "psa/crypto.h" to #include "tfm/psa/crypto.h"
It works in our port. Is it possible for you?
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: Thursday, September 12, 2019 10:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…);reserved=0), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi Antonio, Jamie,
Thanks both for the explanations. It is understood how crypto headers are handled in TF-M and why.
However this approach is causing issues when using non-make based systems which are commonly used for microcontroller development.
I have explained already what the issue is and Andrej provided even more details in T428.
Please keep track of all issues that have been reported initially in this thread.
Thanks,
Robert
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: Friday 13 September 2019 09:08
To: Antonio De Angelis <Antonio.DeAngelis(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Antonio,
If you do not want to change the file name, could you at least change the include name?
For example, from #include "psa/crypto.h" to #include "tfm/psa/crypto.h"
It works in our port. Is it possible for you?
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: Thursday, September 12, 2019 10:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…);reserved=0), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi,
I was trying to fix some typos in this document before, so I just create a short commit; but after couple times of updating I added more content into it, so called a review on this part.
The changed part is, involving the RoT Service API implementation into SPRTL to simplify the caller usage. The RoT Service API is proposed in PSA FF 1.0.0, and I think this is the ideal place for putting it.
The link:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1886
Thanks.
/Ken
Hi Robert,
I'm failing to see how TFM and mbed-crypto can be both components in a TF-M system. I would expect that when I call e.g. "psa_import_key " from the NSPE, that must resolve to a single implementation, and it must be the TF-M client api that passes the request to the SPE crypto service - i.e. the code from interface/src/tfm_crypto_*_api.c. Can you describe how you see both being utilized simultaneously?
Thanks,
Christian.
On 2019-09-13, 3:07 AM, "TF-M on behalf of Andrej Butok via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
Hi Antonio,
If you do not want to change the file name, could you at least change the include name?
For example, from #include "psa/crypto.h" to #include "tfm/psa/crypto.h"
It works in our port. Is it possible for you?
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: Thursday, September 12, 2019 10:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…);reserved=0), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
Hi Kevin,
Recently there are two major change in TF-M MCUBoot:
- images signed separately with different keys and concatenated after to make one blob. It drives by MCUBOOT_IMAGE_NUMBER (default is 2 on AN521)
- It's possible to use keys from HW and not hard-code the public key to the MCUBoot code at compile time. It derives by MCUBOOT_HW_KEY (default is True on AN521)
- You can check the bl2/ext/mcuboot/MCUBoot.cmake two see how the scripts are invoked, which order, what kind of attributes. Additional info is in docs/user_guide/tfm_secure_boot.rst
You can revert back to previous behaviour, single(S+NS) signed image(key is: *3072.pem) and public-key is embedded in MCUBoot code base with setting MCUBOOT_IMAGE_NUMBER=1 and MCUBOOT_HW_KEY=False
Tamas
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 13 September 2019 11:48
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Signing merged single image with dual keys
Hi,
Updating to the latest code in the TF-M repo, I noticed that there are now two separates keys for signing images:
- *3072.pem for the S image
- *3072_1.pem for the NS image
It's not clear to me how to make this work with a single merged image, which is what we generally need, with an IPC-based system where the S image is generated via the TF-M repo and the NS image in Zephyr, making calls to the S services via the PSA APIs.
Previously, we used the ASSEMBLE.PY tool in BL2 to merge the TF-M S and Zephyr NS images, outputting a single binary that we then signed via IMGTOOL.PY using the default or user-defined .pem file. This no longer works, and any attempt to use a binary generated via this method results in:
[INF] Starting bootloader
[INF] Swap type: none
[INF] Swap type: none
[ERR] Authentication failed! Image in the primary slot is not valid.
[ERR] Unable to find bootable image
With the latest dual-key TF-M code, when we build the TF-M repo, we get an S image that is signed using the 3072.pem key, but after a bit of trial and error I haven't found the secret handshake on how to sign the NS image and merge them into a single binary and then copy them over to the MPS2+ (or other HW) and have the BL accept them at startup.
Any pointers on how to generate a single merged image with both parts signed using the different keys, or am I going about this the wrong way?
Kevin
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi,
We are working on CMSIS-Zone Utility [1] which is a GUI tool for configuring a complex system. This includes also TrustZone setup (SAU) and device specific MPC and PPC.
This tool can be also used to configure SAU, MPC and PPC in TF-M.
However TF-M currently requires that a specific region number is used for NS_REGION_CODE (0), NS_REGION_DATA (1), ...
Those region numbers are used when SAU is configured in function sau_and_idau_cfg and the code in function tfm_core_memory_permission_check_handler depends on it.
Is it really necessary that a specific region number is being used and why?
I have received indication that this in not really needed and that the code should be redesigned. This would enable the use of CMSIS-Zone to configure TF-M out of the box.
Thanks,
Robert
[1] https://github.com/ARM-software/CMSIS-Zone
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi,
Updating to the latest code in the TF-M repo, I noticed that there are
now two separates keys for signing images:
- *3072.pem for the S image
- *3072_1.pem for the NS image
It's not clear to me how to make this work with a single merged image,
which is what we generally need, with an IPC-based system where the S
image is generated via the TF-M repo and the NS image in Zephyr,
making calls to the S services via the PSA APIs.
Previously, we used the ASSEMBLE.PY tool in BL2 to merge the TF-M S
and Zephyr NS images, outputting a single binary that we then signed
via IMGTOOL.PY using the default or user-defined .pem file. This no
longer works, and any attempt to use a binary generated via this
method results in:
[INF] Starting bootloader
[INF] Swap type: none
[INF] Swap type: none
[ERR] Authentication failed! Image in the primary slot is not valid.
[ERR] Unable to find bootable image
With the latest dual-key TF-M code, when we build the TF-M repo, we
get an S image that is signed using the 3072.pem key, but after a bit
of trial and error I haven't found the secret handshake on how to sign
the NS image and merge them into a single binary and then copy them
over to the MPS2+ (or other HW) and have the BL accept them at
startup.
Any pointers on how to generate a single merged image with both parts
signed using the different keys, or am I going about this the wrong
way?
Kevin
Hi Antonio,
If you do not want to change the file name, could you at least change the include name?
For example, from #include "psa/crypto.h" to #include "tfm/psa/crypto.h"
It works in our port. Is it possible for you?
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: Thursday, September 12, 2019 10:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…);reserved=0), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper…
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
Hi Robert,
TF-M Crypto and Mbed-crypto are both implementations of the same interface, hence the same header names with different contents. Internally, TF-M Crypto uses Mbed-crypto as a library component, and its include path his hidden into the TF-M build system as Jamie explained, but an user application of TF-M is only able to use and include the TF-M Crypto headers, using the TF-M build system, by including psa/crypto.h
If your IDE makes both Mbed-crypto and TF-M Crypto visible to the user application at global level, at build time the IDE must make sure that the right include path is visible, given that the PSA spec currently mandates the name of the header to be included to be psa/crypto.h and neither of the implementations are allowed to rename it without diverging from the spec.
/Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: 12 September 2019 18:53
To: Jamie Fox <Jamie.Fox(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Jamie,
The current solution is limiting how TF-M can be used. This is blocking toolchain and silicon vendors for wider adoption of TF-M. I have explained this already to @Ashutosh Singh and he confirmed that this is an issue.
Yes, you can prebuild mbed-crypto and use it as a library. However in systems based on software components, TF-M is a component and mbed-crypto also. They are built within a single project with all registered includes..
Having different implementations of an API header with the same name is simply not acceptable when components are global.
It would be really good to create a task for each of the issues I have reported in order to track them. I would appreciate if someone from TF-M team can create the tasks and assign to the right person.
Thanks,
Robert
-----Original Message-----
From: Jamie Fox <Jamie.Fox(a)arm.com>
Sent: Thursday 12 September 2019 18:13
To: Andrej Butok <andrey.butok(a)nxp.com>; Robert Rostohar <Robert.Rostohar(a)arm.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: RE: TF-M / CMSIS-Pack Alignment
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://developer.trustedfirmware.org/), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://developer.trustedfirmware.org/T428
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Robert, Andrej,
Regarding the first point, TF-M and Mbed Crypto are two separate projects, both containing a version of the standard "psa/crypto.h" header. Neither project can remove the header, nor rename it because the name is standardised by the PSA specs.
When Mbed Crypto is used as a library by TF-M, we install its PSA headers to "include/mbedcrypto/psa/crypto.h" and then add only the base "include" directory to the include search paths. Then there is no conflict between TF-M and Mbed Crypto headers, because the former can be included with #include "psa/crypto.h" and the latter with #include "mbedcrypto/psa/crypto.h". Only the Crypto service is linked with Mbed Crypto, which it uses as its backend implementation, so that is why it is the only part of TF-M to include Mbed Crypto headers. All other parts of TF-M include the TF-M psa/crypto.h header, which is implemented by service requests to the Crypto service.
The only other simple solution I see to this is not to add the Mbed Crypto include directory to the search path at all. Then Mbed Crypto headers would need to be included with #include "mbed-crypto/include/psa/crypto.h" etc.
I didn't get chance to read the other issues yet, but maybe it would be easier to create a task for each one on Phabricator (https://developer.trustedfirmware.org/), so that we can keep track of the discussion and work for each issue more easily?
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 12 September 2019 11:52
To: Robert Rostohar <Robert.Rostohar(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] TF-M / CMSIS-Pack Alignment
Hi Robert,
Great! I gave up to convince about the first point https://developer.trustedfirmware.org/T428
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Hugues / Nicolas,
Having Rust/LLVM support would be ideal!
Juan
> Hi Nicolas,
>
> Thanks for your mail.
> From the four LLVM patches needed described in [1], the first one (L1) has landed upstream [2]. Regarding the other ones and your other questions, we are waiting for more information and we will keep you updated as soon as possible.
>
> Kind regards,
> Hugues
>
> [2] https://reviews.llvm.org/D59888
>
> -----Original Message-----
> From: TF-M <tf-m-bounces at lists.trustedfirmware.org <https://lists.trustedfirmware.org/mailman/listinfo/tf-m>> On Behalf Of Nicolas Stalder via TF-M
> Sent: 30 August 2019 12:25
> To: tf-m at lists.trustedfirmware.org <https://lists.trustedfirmware.org/mailman/listinfo/tf-m>
> Subject: [TF-M] Rust implementation of the Armv8-M Security Extension
>
> Hi
>
> My company SoloKeys produces open source FIDO2 security tokens (USB + NFC), and we're in the process of a) moving to a Cortex-M33 microcontroller, and
> b) an implementation in Rust.
>
> This is mostly to say that we're very interested in the security extensions [1] landing in LLVM, so embedded Rust can eventually use them, I understand Hugues de Valon from Arm has done some exploratory work on this.
>
> What is the status of this upstreaming process, are there any road blocks, and is there any ETA on public availability?
>
> Regards,
> Nicolas Stalder
> SoloKeys
>
> [1] http://lists.llvm.org/pipermail/llvm-dev/2019-March/131358.html
> --
> TF-M mailing list
> TF-M at lists.trustedfirmware.org <https://lists.trustedfirmware.org/mailman/listinfo/tf-m>
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Robert,
Great! I gave up to convince about the first point https://developer.trustedfirmware.org/T428
As you are from ARM, hope, you will able to push through all your improvements.
Thanks,
Andrej Butok
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Robert Rostohar via TF-M
Sent: Thursday, September 12, 2019 12:34 PM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] TF-M / CMSIS-Pack Alignment
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c #ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[2] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[3] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
[4] https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.keil.c…
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
Hi,
We are looking into providing TF-M as a CMSIS-Pack [1] and have discovered a few issues in TF-M that are currently blocking us.
1. Crypto headers ./interface/include/psa clash with headers from mbed-crypto .include/psa
It seems that TF-M copies the crypto headers from mbed-crypto folder ./include/psa into folder ./mbedcrypto/psa. However TF-M also provides different crypto headers in folder ./interface/include/psa.
TF-M modules typically include "psa/crypto.h" except crypto service modules which include "mbedcrypto/psa/crypto.h" through "tfm_mbedcrypto_include.h".
The problem is that in our tools both include folders (./include from mbed-crypto installation and ./interface/include from TF-M) are in the global search path causing wrong headers being used.
Another issues is the use of "mbedcrypto" prefix in include "mbedcrypto/psa/crypto.h". We have mbed-crypto already installed and copying crypto headers would not be needed when using include "psa/crypto.h".
1. Device header
TF-M currently uses "cmsis.h" as the device header. This is not compliant with CMSIS [2] which defines the naming convention for device headers, startup files and system configuration files.
Silicon vendors typically define header filenames that match their device names.
The device agnostic way proposed by CMSIS is to use a preprocessor define CMSIS_device_header that reflects the actual device name and is provided by the build environment.
We suggest to replace:
#include "cmsis.h"
with:
#include CMSIS_device_header
This would affect the following modules:
./secure_fw/core/arch/tfm_arch_v8m_base.c
./secure_fw/core/arch/tfm_arch_v8m_main.c
./secure_fw/core/arch/include/tfm_arch.h
./platform/ext/target: various target files
1. Conditional inclusion of secure services: Storage, Crypto, Attestation
Our concept is based on software components and we have described each secure service as a single component that is user selectable. This requires conditional inclusion of a secure service based on preprocessor definitions.
TF-M already supports this for secure services Audit Logging (#ifdef TFM_PARTITION_AUDIT_LOG) and Platform (#ifdef TFM_PARTITION_PLATFORM) and also for all test services (#ifdef TFM_PARTITION_TEST_...).
We suggest to add this also to secure services Storage (#ifdef TFM_PARTITION_STORAGE), Crypto (#ifdef TFM_PARTITION_CRYPTO) and Attestation (#ifdef TFM_PARTITION_INITIAL_ATTESTATION).
This would affect the following modules:
./secure_fw/services/tfm_partition_defs.inc
./secure_fw/services/tfm_service_list.inc
./secure_fw/services/tfm_spm_db.inc
./secure_fw/ns_callable/tfm_veneers.c
./interface/include/tfm_veneers.h
We are aware that those file are supposed to be autogenerated however we use them directly at this point. Adding the mentioned preprocessor defines should be trivial and would unblock us.
1. Conditional inclusion of individual test suites
We have described also test suites as individual components that are user selectable. This requires conditional inclusion of test suites based on preprocessor definitions.
TF-M already supports this for some test suites (#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS, ...).
We suggest to add this also for all other test suites.
Adding conditional inclusion for secure test suites: ./test/framework/secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
Adding conditional inclusion for non-secure test suites: ./test/framework/non_secure_suites.c
#ifdef ENABLE_SECURE_STORAGE_SERVICE_TESTS
#ifdef ENABLE_CRYPTO_SERVICE_TESTS
#ifdef ENABLE_INITIAL_ATTESTATION_SERVICE_TESTS
#ifdef ENABLE_QCBOR_TESTS
1. Deprecated Invert Test suite
Invert test suite seems to be deprecated. Tests do nothing and just return. It would make sense to remove it.
When we expose it as a component to the user it unnecessary increases the complexity of having another component that does nothing.
1. Tests on non-secure side include headers from secure side
Non-secure software should not include any secure side internal headers (ex: from ./secure_fw/core/include) but only those that are exposed as APIs (./interface/include).
The following test suites on the non-secure side include internal headers from secure side:
Attestation:
attestation_ns_interface_testsuite.c
#include "secure_fw/services/initial_attestation/attestation.h"
Core Positive:
core_ns_positive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
#include "tfm_plat_test.h // from ./platform/include
Core Interactive:
core_ns_interactive_testsuite.c
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
./app/tfm_integ_test.c:
#include "test/test_services/tfm_core_test/core_test_defs.h"
#include "tfm_core.h" // from ./secure_fw/core/include through core_test_defs.h
This actually causes a compile error in our build because tfm_core.h defines the LOG_MSG macro (through secure_utilities.h) which clashes with the inline static function LOG_MSG defined in tfm_integ_test.h. We had to patch the tfm_integ_test.c by adding #undef LOG_MSG after the secure header is indirectly included.
./app/main_ns.c:
#include "target_cfg.h" // from ./platform/ext/target/<target_name>
target_cfg.h from secure side also contains USART driver definitions for non-secure side. This should be decoupled and non-secure side should not include that header.
1. Dummy platform files
./platform/ext/target/<target_name>/dummy_boot_seed.c
./platform/ext/target/<target_name>/dummy_crypto_keys.c
./platform/ext/target/<target_name>/dummy_device_id.c
./platform/ext/target/<target_name>/dummy_nv_counters.c
./platform/ext/target/<target_name>/attest_hal.c
Dummy platform files are intended for testing only and provide a quick way of starting to test TF-M even when the platform files are not yet ported to the platform that the customer using.
They are identical and duplicated for all existing targets.
We propose to remove the mentioned dummy files from each target and put them in a single folder (./platform/ext/target/template).
This simplifies maintenance of the files and also provides a single location of those files that are being used as a platform independent component.
1. Console via USART
Console on secure side is retargeted to CMSIS USART driver (./platform/ext/common/uart_stdout.c).
USART driver Send function is called also from SVC with highest interrupt priority which blocks the USART interrupt and leads to deadlock. This is not manifested with Musca USART drivers which implement blocking send - not compliant with CMSIS USART Driver [3]. It does occur instantly with any other CMSIS compliant USART driver.
As far as I understand the console on secure side will be redesigned to cope with that.
There are also other issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1409/7/platform/e…
It also tries to address printf retargeting issues however this needs another iteration.
Console on non-secure side is also retargeted to CMSIS USART driver (./app/main_ns.c) however has less constrains.
It has the same issues with using the USART driver:
* missing wait while busy after send
* missing power on/off
This is being address with:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1409/7/app/main_n…
It also tries to address printf retargeting issues however this needs another iteration.
1. USART driver implementations for platforms included in TF-M
As already mentioned all USART drivers implemented for various platforms included in TF-M are not compliant with CMSIS USART Driver specification [3]. They implement blocking send/receive and no power on/off.
Drivers should be rewritten and should pass the CMSIS Driver Validation [4].
Please look into the above issues and help us to overcome them.
Thanks,
Robert
[1] http://www.keil.com/pack/doc/CMSIS/Pack/html/index.html
[2] http://www.keil.com/pack/doc/CMSIS/Core/html/using_pg.html
[3] http://www.keil.com/pack/doc/CMSIS/Driver/html/group__usart__interface__gr.…
[4] http://www.keil.com/pack/doc/CMSIS/Driver/html/driverValidation.html
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi all,
The following change requires a change in TF-M SW requirements:
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1695/
The reason of the change to replace the currently used Python crypto library(pycrypto and pycryptodome) to an actively maintained crypto library (cryptography).
CI was already updated.
BR,
Tamas
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 31 July 2019 16:28
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Outdated pycrypto dependency in BL2's imgtool.py
Hi,
As part of an effort to enable automatic builds of TF-M in Zephyr, I've been trying to get the TF-M + Zephyr S/NS images building and passing on Zephyr's CI system.
The only missing requirements for building TF-M in a clean Zephyr SDK 0.10.1 based environment is the pycrypto module, which is used in the imgtool.py utility, specifically:
https://git.trustedfirmware.org/trusted-firmware-m.git/tree/bl2/ext/mcuboot…
My concern is that this module is no longer actively maintained (last release was 2013!), and it seems like a poor decision to rely on something that isn't actively maintained when more recent alternative are available.
Is there a specific reason to keep this module in the script in favour of something more modern?
Best regards,
Kevin
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
While optimising SST stack usage, we found that we were blocked from reducing it further by the stack usage of the dummy NV counters implementation used by all of the development platforms currently maintained in the repo. SST makes calls to the NV counter interface, so any stack used by this implementation gets allocated from the SST stack.
The current dummy NV counter implementation reads the entire flash sector containing the counters (generally 4KB) into stack memory, so that it can erase the sector and then re-write the same sector with a counter incremented. It needs to do this because the sector might contain some other data, unrelated to NV counters.
I am proposing that we simplify this dummy implementation to assume that the dummy NV counters are the only thing in the sector. Then only the NV counters themselves (currently 28 bytes) need to be read into memory for modification. The downside of this of course is that a whole 4KB flash sector needs to be set aside for the dummy NV counters. This seems bad, but it is worth bearing in mind that this is only a dummy implementation that should never be deployed in a real system. In practice, it seems unlikely to me that we would ever want to make use of the partial-sector left after the dummy NV counters anyway, and no platform currently does.
With this change made, the stack allocated for SST can be reduced from 6KB to 2.5KB (in this patch https://review.trustedfirmware.org/c/trusted-firmware-m/+/1775).
The change is currently on review here https://review.trustedfirmware.org/c/trusted-firmware-m/+/1918/ Feedback and alternative ideas are welcome 😊
Kind regards,
Jamie
+ TF-M mailing list...
Regards,
Shebu
-----Original Message-----
From: Shebu Varghese Kuriakose
Sent: Friday, September 6, 2019 11:17 AM
To: Thomas Törnblom <thomas.tornblom(a)iar.com>
Cc: nd <nd(a)arm.com>; Ryan Arnold <ryan.arnold(a)linaro.org>; scott.bambrough(a)linaro.org; Bill Fletcher <bill.fletcher(a)linaro.org>
Subject: RE: [TF-M] CI
Hi Thomas.
The TF-M CI - https://ci.trustedfirmware.org/ has been out together by Linaro Infrastructure team funded by trutedfirmware.org Adding your tool chain to the CI might be something you can work with Linaro in the next set of CI enhancements that is being planned.
I am copying Linaro team so that they are aware of the request.
Regards,
Shebu
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: Friday, September 6, 2019 7:36 AM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] CI
Who do I talk to about adding our toolchain to the CI build setup?
Cheers,
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Who do I talk to about adding our toolchain to the CI build setup?
Cheers,
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi Thomas,
The twincpu branch is running well on PSoC 6 in *IPC model*.
Please try the configs with IPC model enabled.
For more details and commands, please refer to the document suggested by Chris.
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Christopher Brand via TF-M
Sent: Friday, September 6, 2019 2:11 AM
To: Thomas Törnblom <thomas.tornblom(a)iar.com>; tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] feature-twincpu, unable to configure & build
Hi Thomas,
Are you building from the master branch or feature-twincpu? I'm assuming the latter because psoc6 support hasn't yet made it back to the master branch. Which config(s) did you try to build?
The feature-twincpu branch is being built pretty regularly for psoc6 (with both clang and gcc), so it should work. There's a document at platform/ext/target/psoc6//cypress_psoc_6_spec.rst detailing exactly how to build.
If you can send the details of exactly what commands you're executing and what results you're getting, somebody should be able to help.
Chris
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> Thomas Törnblom via TF-M
> Sent: Thursday, September 5, 2019 6:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] feature-twincpu, unable to configure & build
>
> I have been tasked with making the twincpu feature work with the IAR
> toolchain, and I started out trying to build it with clang and gcc but
> it seems there's some issues with it.
>
> I tried using the psoc6 target, but it appears that none of the v6/v7
> targets are supported in configs/ConfigDefault.cmake. If I add that
> the build then fails with a complaint about "Armv6-M/Armv7-M can only
> support multi-core TF-M now." from tfm_arch_v6m_v7m.h, due to
> TFM_MULTI_CORE_TOPOLOGY not being set, but that appears to be set in
> one of the cmake files so I guess something is currently broken.
>
> Is this a known issue and is there are known fix?
>
> /Thomas
>
> --
>
> *Thomas Törnblom*, /Product Engineer/
> IAR Systems AB
> Box 23051, Strandbodgatan 1
> SE-750 23 Uppsala, SWEDEN
> Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
> E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
> Website: www.iar.com <http://www.iar.com>
> Twitter: www.twitter.com/iarsystems
> <http://www.twitter.com/iarsystems>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi Thomas,
Are you building from the master branch or feature-twincpu? I'm assuming the latter because psoc6 support hasn't yet made it back to the master branch. Which config(s) did you try to build?
The feature-twincpu branch is being built pretty regularly for psoc6 (with both clang and gcc), so it should work. There's a document at platform/ext/target/psoc6//cypress_psoc_6_spec.rst detailing exactly how to build.
If you can send the details of exactly what commands you're executing and what results you're getting, somebody should be able to help.
Chris
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> Thomas Törnblom via TF-M
> Sent: Thursday, September 5, 2019 6:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] feature-twincpu, unable to configure & build
>
> I have been tasked with making the twincpu feature work with the IAR
> toolchain, and I started out trying to build it with clang and gcc but it seems
> there's some issues with it.
>
> I tried using the psoc6 target, but it appears that none of the v6/v7 targets
> are supported in configs/ConfigDefault.cmake. If I add that the build then
> fails with a complaint about "Armv6-M/Armv7-M can only support multi-core
> TF-M now." from tfm_arch_v6m_v7m.h, due to
> TFM_MULTI_CORE_TOPOLOGY not being set, but that appears to be set in
> one of the cmake files so I guess something is currently broken.
>
> Is this a known issue and is there are known fix?
>
> /Thomas
>
> --
>
> *Thomas Törnblom*, /Product Engineer/
> IAR Systems AB
> Box 23051, Strandbodgatan 1
> SE-750 23 Uppsala, SWEDEN
> Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
> E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
> Website: www.iar.com <http://www.iar.com>
> Twitter: www.twitter.com/iarsystems
> <http://www.twitter.com/iarsystems>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
I have been tasked with making the twincpu feature work with the IAR
toolchain, and I started out trying to build it with clang and gcc but
it seems there's some issues with it.
I tried using the psoc6 target, but it appears that none of the v6/v7
targets are supported in configs/ConfigDefault.cmake. If I add that the
build then fails with a complaint about "Armv6-M/Armv7-M can only
support multi-core TF-M now." from tfm_arch_v6m_v7m.h, due to
TFM_MULTI_CORE_TOPOLOGY not being set, but that appears to be set in one
of the cmake files so I guess something is currently broken.
Is this a known issue and is there are known fix?
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
I have just pushed the latest commit for the source cleanup and IAR
integration.
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi Thomas,
If the topic is quite same, you can re-use the existing item. In other case please create a new one.
If the existing item is resolved, you can re-open it with some comments (The history will show the status change of this task, keep same topic in one task makes an easy tracking).
Thanks.
/Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas
> Törnblom via TF-M
> Sent: Friday, August 23, 2019 6:41 PM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] Updated support for IAR toolchain, T398/T413
>
> I have done some more cleanup on a later version of TF-M, which I started in
> T398 and T413.
>
> Should I submit a new task or should I refer to these tasks in my commit?
>
> /Thomas
>
> --
>
> *Thomas Törnblom*, /Product Engineer/
> IAR Systems AB
> Box 23051, Strandbodgatan 1
> SE-750 23 Uppsala, SWEDEN
> Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
> E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
> Website: www.iar.com <http://www.iar.com>
> Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Nicolas,
Thanks for your mail.
From the four LLVM patches needed described in [1], the first one (L1) has landed upstream [2]. Regarding the other ones and your other questions, we are waiting for more information and we will keep you updated as soon as possible.
Kind regards,
Hugues
[2] https://reviews.llvm.org/D59888
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Nicolas Stalder via TF-M
Sent: 30 August 2019 12:25
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] Rust implementation of the Armv8-M Security Extension
Hi
My company SoloKeys produces open source FIDO2 security tokens (USB + NFC), and we're in the process of a) moving to a Cortex-M33 microcontroller, and
b) an implementation in Rust.
This is mostly to say that we're very interested in the security extensions [1] landing in LLVM, so embedded Rust can eventually use them, I understand Hugues de Valon from Arm has done some exploratory work on this.
What is the status of this upstreaming process, are there any road blocks, and is there any ETA on public availability?
Regards,
Nicolas Stalder
SoloKeys
[1] http://lists.llvm.org/pipermail/llvm-dev/2019-March/131358.html
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hello,
I'm proposing to add an option to support code execution from device RAM.
Basically, it comes to defining a new TFM_RAM_CODE SRAM region in gcc and clang linker scripts for code with .*_ramfunc attribute. This region is intended for privileged secure code running from SRAM.
With this, whenever you define an attribute e.g. my_ramfunc, this function will be placed into SRAM instead of Flash.
An example:
_attribute__((section("my_ramfunc")))
void my_function(void)
{};
Implementation:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1815
thanks,
Andrei
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
Hi Thomas,
You can find the memory map in:
- platform/ext/target/<TARGET>/partition/flash_layout.h
Tamas
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: 02 September 2019 17:07
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] mcuboot and blob addresses
I've been trying to find out where the tf-m payload is supposed to be stored at.
In tfm_secure_boot.rst I see a memory map for the AN521, but where do find this for the Musca A, which I'm using?
/Thomas
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
I've been trying to find out where the tf-m payload is supposed to be
stored at.
In tfm_secure_boot.rst I see a memory map for the AN521, but where do
find this for the Musca A, which I'm using?
/Thomas
Hi
My company SoloKeys produces open source FIDO2 security tokens (USB + NFC),
and we're in the process of a) moving to a Cortex-M33 microcontroller, and
b) an implementation in Rust.
This is mostly to say that we're very interested in the security
extensions [1] landing
in LLVM, so embedded Rust can eventually use them, I understand Hugues de Valon
from Arm has done some exploratory work on this.
What is the status of this upstreaming process, are there any road
blocks, and is
there any ETA on public availability?
Regards,
Nicolas Stalder
SoloKeys
[1] http://lists.llvm.org/pipermail/llvm-dev/2019-March/131358.html
Two more patches added under this topic:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1836https://review.trustedfirmware.org/c/trusted-firmware-m/+/1837
BR
/Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu
> (Arm Technology China) via TF-M
> Sent: Thursday, August 15, 2019 3:15 PM
> To: tf-m(a)lists.trustedfirmware.org
> Cc: nd <nd(a)arm.com>
> Subject: Re: [TF-M] [RFC] Code restructure of core/spm
>
> Hi,
> The first patch for moving header files is ready at:
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1561
> Comments are welcome. I had thought to push patches together but looks like it
> would block other patches for a while to show a neat merged list, so I would
> push them one by one.
>
> Will keep you update when incoming patches are ready.
>
> BR
>
> /Ken
>
> > -----Original Message-----
> > From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken
> > Liu (Arm Technology China) via TF-M
> > Sent: Thursday, August 1, 2019 11:12 AM
> > To: tf-m(a)lists.trustedfirmware.org
> > Cc: nd <nd(a)arm.com>
> > Subject: [TF-M] [RFC] Code restructure of core/spm
> >
> > Hi,
> >
> > Several patches for code restructure is coming. Before I post the
> > gerrit items, I want to collect your feedback on this. These changes contain:
> >
> > - Move header files into dedicated directory for easy include, and
> > clean the included headers in sources;
> > - Change some files' name to let them make more sense.
> > - Move SPM related files into 'spm' folder instead of putting them in 'core'.
> > - Move some interface files into 'ns_callable' since they are interfaces.
> > - Remove 'ipc' folder after all files in it are well arranged.
> >
> > I will try to do these patches together so they can be merged together.
> > But before that I want to request for comments about this, feel free
> > to reply in this thread or comment on the task (add yourself if you
> > are missing as
> > subscribers):
> > https://developer.trustedfirmware.org/T426
> >
> > BR
> >
> > /Ken
> >
> >
> > --
> > TF-M mailing list
> > TF-M(a)lists.trustedfirmware.org
> > https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
I have done some more cleanup on a later version of TF-M, which I
started in T398 and T413.
Should I submit a new task or should I refer to these tasks in my commit?
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi,
These patches are based on an old patch:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1686
and the task:
https://developer.trustedfirmware.org/T199
The existing idea is, app needs v8m veneer to go on the building, so make 'secure_fw' as sub-project of 'app'. While Dual-core is involved, this hierarchy does not make sense.
'secure_fw' should be a standalone sub-project of 'tfm' instead of 'app'. This would benefit the coming build configuration changes.
This patch has been put in master branch for quite a while and now call for review again, since in feature branch it has been merged and verified for quite a long time.
Thanks.
/Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrei
> Narkevitch via TF-M
> Sent: Thursday, August 15, 2019 2:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] Build system changes for dual core platforms
>
> Hi,
>
> Please review the proposed build system changes. Intention of those is to lay
> groundwork for building TFM for dual core platforms (aka twincpu).
> The main problem of the existing build system is that it assumes that both tfm_s
> and tfm_ns run on the same core. In dual core systems secure and non-secure
> code runs on two independent cores. Each CPU core can be different in terms of
> architecture, configuration etc, and this adds the requirement of separating out
> secure and non-secure builds..
> The patches basically do the following:
>
> * Introduce TFM_MULTI_CORE_TOPOLOGY, that distinguish single core and
> multicore builds.
> * Split secure and non-secure builds and build both in single building execution.
>
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1747
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1748
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1749
>
> Thanks,
> Andrei
>
> This message and any attachments may contain confidential information from
> Cypress or its subsidiaries. If it has been received in error, please advise the
> sender and immediately delete this message.
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Kevin,
I don't know much about JLink so cannot help with setup, but there is a quick workaround if reset does not work: insert a "B ." instruction on the first line of the reset handler in the startup file. Then the target will sit in an infinite loop while you connect with the debugger, and afterwards you can use the debugger to increment the PC by two to step over the instruction.
The typical debug setup in the TF-M team is to use either a Keil ULINKpro or Arm DSTREAM debugger with Arm Development Studio or Keil uVision. Most issues can be debugged on the FVP too, which runs a debug server when the "-S" option is passed.
Kind regards,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 19 August 2019 13:45
To: Kevin Townsend <kevin.townsend(a)linaro.org>
Cc: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: Re: [TF-M] Debugger setup for MPS2+ AN521
Hi,
Any feedback at all on debugging TF-M on AN521 with a HW debugger, or confirmation someone has a working setup?
I'm curious how people are digging into particularly complex problems, or things that happen very early on (pre-printf) if a standard HW debugger over SWD/JTAG isn't an option?
Many thanks,
Kevin
On Tue, 6 Aug 2019 at 13:50, Kevin Townsend via TF-M <tf-m(a)lists.trustedfirmware.org> wrote:
>
> tl;dr: unable to connect to MPS2+ AN521 with JLink and perform a soft
> reset to halt at NSPE init, and debug an init issue. Connect via SWD
> fails, connect via JTAG seems OK, but soft reset requests consistently
> fail, preventing meaningful debug/trace of the code. Looking for
> advice on known-good debug setup with GDB and Linux.
>
> Full explanation follows:
>
> I'm currently working on an application with the following setup:
>
> - TF-M (latest) running in the secure processing environment
> - Zephyr running in the NSPE
> - PSA FF APIs to communicate between PEs
>
> I've run into a HW problem with the UART peripheral that I need to
> debug, but using a J-Link has been problematic, and I was curious if
> anyone else has had any success with GDB or JLinkExe and the MPS2+.
>
> To debug, I currently do the following:
>
> - Copy a valid TF-M + Zephyr and BL2 image to the MPS2+
> - Physically reset the MPS2+ (AN521)
> - Wait for the image to start up (based on serial output)
> - Connect the debugger
> - Attempt to reset
>
> I get the following output at connect (entering the 'connect' command
> at the J-Link prompt):
>
> NOTE: I've been unable to get SWD to work, and had to fall back to
> JTAG for the interface.
>
> ----------------------------------------
> $ JLinkExe -device Cortex-M33 -if jtag -speed auto SEGGER J-Link
> Commander V6.44i (Compiled May 17 2019 17:38:03) DLL version V6.44i,
> compiled May 17 2019 17:37:52
>
> Connecting to J-Link via USB...O.K.
> Firmware: J-Link V9 compiled May 17 2019 09:50:41 Hardware version:
> V9.10
> S/N: 609100327
> License(s): RDI, FlashBP, FlashDL, JFlash, GDB VTref=3.011V Device
> position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
> JTAGConf>connect
> ERROR while parsing value for IRPre. Using default: -1.
> ERROR while parsing value for DRPre. Using default: -1.
> Device "CORTEX-M33" selected.
>
>
> Connecting to target via JTAG
> TotalIRLen = 4, IRPrint = 0x01
> JTAG chain detection found 1 devices:
> #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP Scanning AP map to
> find all available APs
> AP[3]: Stopped AP scan as end of AP map has been reached
> AP[0]: APB-AP (IDR: 0x54770002)
> AP[1]: AHB-AP (IDR: 0x84770001)
> AP[2]: AHB-AP (IDR: 0x84770001)
> Iterating through AP map to find AHB-AP to use
> AP[0]: Skipped. Not an AHB-AP
> AP[1]: Core found
> AP[1]: AHB-AP ROM base: 0xF0008000
> CPUID register: 0x410FD211. Implementer code: 0x41 (ARM) Found
> Cortex-M33 r0p1, Little endian.
> FPUnit: 8 code (BP) slots and 0 literal slots Security extension:
> implemented Secure debug: enabled CoreSight components:
> ROMTbl[0] @ F0008000
> ROMTbl[0][0]: F0009000, CID: B105900D, PID: 000BB9A4 GPR
> ROMTbl[0][1]: E00FF000, CID: B105100D, PID: 000BB4C9 ROM Table
> ROMTbl[1] @ E00FF000
> ROMTbl[1][0]: E000E000, CID: B105900D, PID: 000BBD21 Cortex-M33
> ROMTbl[1][1]: E0001000, CID: B105900D, PID: 000BBD21 DWT
> ROMTbl[1][2]: E0002000, CID: B105900D, PID: 000BBD21 FPB
> ROMTbl[1][3]: E0000000, CID: B105900D, PID: 000BBD21 ITM
> ROMTbl[1][5]: E0041000, CID: B105900D, PID: 001BBD21 ETM
> ROMTbl[1][6]: E0042000, CID: B105900D, PID: 000BBD21 CTI
> Cortex-M33 identified.
> ----------------------------------------
>
> But any attempt to perform a soft reset fails, which makes debugging
> the init code problematic:
>
> ----------------------------------------
> J-Link>r 0
> Reset delay: 0 ms
> Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via AIRCR.SYSRESETREQ.
> Reset: CPU may have not been reset (DHCSR.S_RESET_ST never gets set).
> Reset: Using fallback: Reset pin.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via reset pin
> Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
> Reset: Reconnecting and manually halting CPU.
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] =
> 0x00 AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] =
> 0x00
>
> **************************
> WARNING: CPU could not be halted
> **************************
>
> Reset: Core did not halt after reset, trying to disable WDT.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via reset pin
> Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
> Reset: Reconnecting and manually halting CPU.
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] =
> 0x00 AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] =
> 0x00
>
> **************************
> WARNING: CPU could not be halted
> **************************
>
>
> ****** Error: Could not find core in Coresight setup
> ----------------------------------------
>
> If anyone is using a J-Link or J-Trace and ideally GDB to do any
> meaningful debugging or tracing on the MPS2+ any suggestions on proper
> setup would be valuable, and I'm happy to document an eventual working
> config for inclusion in the project doc files.
>
> Barring that, an alternative GDB-based setup would be useful if
> someone has a known-good solution?
>
> Best regards,
> Kevin Townsend
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi,
Any feedback at all on debugging TF-M on AN521 with a HW debugger, or
confirmation someone has a working setup?
I'm curious how people are digging into particularly complex problems,
or things that happen very early on (pre-printf) if a standard HW
debugger over SWD/JTAG isn't an option?
Many thanks,
Kevin
On Tue, 6 Aug 2019 at 13:50, Kevin Townsend via TF-M
<tf-m(a)lists.trustedfirmware.org> wrote:
>
> tl;dr: unable to connect to MPS2+ AN521 with JLink and perform a soft
> reset to halt at NSPE init, and debug an init issue. Connect via SWD
> fails, connect via JTAG seems OK, but soft reset requests consistently
> fail, preventing meaningful debug/trace of the code. Looking for
> advice on known-good debug setup with GDB and Linux.
>
> Full explanation follows:
>
> I'm currently working on an application with the following setup:
>
> - TF-M (latest) running in the secure processing environment
> - Zephyr running in the NSPE
> - PSA FF APIs to communicate between PEs
>
> I've run into a HW problem with the UART peripheral that I need to
> debug, but using a J-Link has been problematic, and I was curious if
> anyone else has had any success with GDB or JLinkExe and the MPS2+.
>
> To debug, I currently do the following:
>
> - Copy a valid TF-M + Zephyr and BL2 image to the MPS2+
> - Physically reset the MPS2+ (AN521)
> - Wait for the image to start up (based on serial output)
> - Connect the debugger
> - Attempt to reset
>
> I get the following output at connect (entering the 'connect' command
> at the J-Link prompt):
>
> NOTE: I've been unable to get SWD to work, and had to fall back to
> JTAG for the interface.
>
> ----------------------------------------
> $ JLinkExe -device Cortex-M33 -if jtag -speed auto
> SEGGER J-Link Commander V6.44i (Compiled May 17 2019 17:38:03)
> DLL version V6.44i, compiled May 17 2019 17:37:52
>
> Connecting to J-Link via USB...O.K.
> Firmware: J-Link V9 compiled May 17 2019 09:50:41
> Hardware version: V9.10
> S/N: 609100327
> License(s): RDI, FlashBP, FlashDL, JFlash, GDB
> VTref=3.011V
> Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
> JTAGConf>connect
> ERROR while parsing value for IRPre. Using default: -1.
> ERROR while parsing value for DRPre. Using default: -1.
> Device "CORTEX-M33" selected.
>
>
> Connecting to target via JTAG
> TotalIRLen = 4, IRPrint = 0x01
> JTAG chain detection found 1 devices:
> #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
> Scanning AP map to find all available APs
> AP[3]: Stopped AP scan as end of AP map has been reached
> AP[0]: APB-AP (IDR: 0x54770002)
> AP[1]: AHB-AP (IDR: 0x84770001)
> AP[2]: AHB-AP (IDR: 0x84770001)
> Iterating through AP map to find AHB-AP to use
> AP[0]: Skipped. Not an AHB-AP
> AP[1]: Core found
> AP[1]: AHB-AP ROM base: 0xF0008000
> CPUID register: 0x410FD211. Implementer code: 0x41 (ARM)
> Found Cortex-M33 r0p1, Little endian.
> FPUnit: 8 code (BP) slots and 0 literal slots
> Security extension: implemented
> Secure debug: enabled
> CoreSight components:
> ROMTbl[0] @ F0008000
> ROMTbl[0][0]: F0009000, CID: B105900D, PID: 000BB9A4 GPR
> ROMTbl[0][1]: E00FF000, CID: B105100D, PID: 000BB4C9 ROM Table
> ROMTbl[1] @ E00FF000
> ROMTbl[1][0]: E000E000, CID: B105900D, PID: 000BBD21 Cortex-M33
> ROMTbl[1][1]: E0001000, CID: B105900D, PID: 000BBD21 DWT
> ROMTbl[1][2]: E0002000, CID: B105900D, PID: 000BBD21 FPB
> ROMTbl[1][3]: E0000000, CID: B105900D, PID: 000BBD21 ITM
> ROMTbl[1][5]: E0041000, CID: B105900D, PID: 001BBD21 ETM
> ROMTbl[1][6]: E0042000, CID: B105900D, PID: 000BBD21 CTI
> Cortex-M33 identified.
> ----------------------------------------
>
> But any attempt to perform a soft reset fails, which makes debugging
> the init code problematic:
>
> ----------------------------------------
> J-Link>r 0
> Reset delay: 0 ms
> Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via AIRCR.SYSRESETREQ.
> Reset: CPU may have not been reset (DHCSR.S_RESET_ST never gets set).
> Reset: Using fallback: Reset pin.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via reset pin
> Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
> Reset: Reconnecting and manually halting CPU.
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
>
> **************************
> WARNING: CPU could not be halted
> **************************
>
> Reset: Core did not halt after reset, trying to disable WDT.
> Reset: Halt core after reset via DEMCR.VC_CORERESET.
> Reset: Reset device via reset pin
> Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
> Reset: Reconnecting and manually halting CPU.
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
> AP map detection skipped. Manually configured AP map found.
> AP[0]: CUSTOM-AP (IDR: Not set)
> AP[1]: AHB-AP (IDR: Not set)
> AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
>
> **************************
> WARNING: CPU could not be halted
> **************************
>
>
> ****** Error: Could not find core in Coresight setup
> ----------------------------------------
>
> If anyone is using a J-Link or J-Trace and ideally GDB to do any
> meaningful debugging or tracing on the MPS2+ any suggestions on proper
> setup would be valuable, and I'm happy to document an eventual working
> config for inclusion in the project doc files.
>
> Barring that, an alternative GDB-based setup would be useful if
> someone has a known-good solution?
>
> Best regards,
> Kevin Townsend
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Thomas,
This is a very helpful suggestion. Since I am doing some cleanup these days, let me try this option and see how much we need to improve.
I have created an task for tracking this: https://developer.trustedfirmware.org/T475
And, do you have an error report could be share? You can attch the log in the task if you do have some.
Thanks.
/Ken
________________________________
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> on behalf of Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Sent: Friday, August 16, 2019 4:24 PM
To: tf-m(a)lists.trustedfirmware.org <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Please enable -pedantic-errors for gcc builds
I'm now looking at compilation issues with our standards compliant
compiler, and I run into one issue after another that are due to the use
of non-standard C allowed by gcc and armclang.
Things like zero sized arrays, which are fairly easy to fix by making
sure that they have at least one element, but there are other issues
that may not be as easy to solve.
The latest issue is illegal pointer arithmetic on void * in the IPC code.
---
...
[ 20%] Building C object
app/secure_fw/CMakeFiles/tfm_s_obj_lib.dir/core/ipc/tfm_svcalls.o
msg->invec[invec_idx].base += bytes;
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",595
Error[Pe852]:
expression must be a pointer to a complete object type
msg->invec[invec_idx].base += num_bytes;
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",666
Error[Pe852]:
expression must be a pointer to a complete object type
tfm_memcpy(msg->outvec[outvec_idx].base +
msg->outvec[outvec_idx].len,
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",750
Error[Pe852]:
expression must be a pointer to a complete object type
...
---
I suggest enabling "-pedantic-errors" for gcc, and also for clang, if it
has a similar setting, to avoid having illegal C code creeping into tf-m.
Comments?
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com<http://www.iar.com> <http://www.iar.com>
Twitter: www.twitter.com/iarsystems<http://www.twitter.com/iarsystems> <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
I'm now looking at compilation issues with our standards compliant
compiler, and I run into one issue after another that are due to the use
of non-standard C allowed by gcc and armclang.
Things like zero sized arrays, which are fairly easy to fix by making
sure that they have at least one element, but there are other issues
that may not be as easy to solve.
The latest issue is illegal pointer arithmetic on void * in the IPC code.
---
...
[ 20%] Building C object
app/secure_fw/CMakeFiles/tfm_s_obj_lib.dir/core/ipc/tfm_svcalls.o
msg->invec[invec_idx].base += bytes;
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",595
Error[Pe852]:
expression must be a pointer to a complete object type
msg->invec[invec_idx].base += num_bytes;
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",666
Error[Pe852]:
expression must be a pointer to a complete object type
tfm_memcpy(msg->outvec[outvec_idx].base +
msg->outvec[outvec_idx].len,
^
"C:\Users\thomasto\Projects\tf-m7\trusted-firmware-m\secure_fw\core\ipc\tfm_svcalls.c",750
Error[Pe852]:
expression must be a pointer to a complete object type
...
---
I suggest enabling "-pedantic-errors" for gcc, and also for clang, if it
has a similar setting, to avoid having illegal C code creeping into tf-m.
Comments?
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi,
The first patch for moving header files is ready at:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1561
Comments are welcome. I had thought to push patches together but looks like it would block other patches for a while to show a neat merged list, so I would push them one by one.
Will keep you update when incoming patches are ready.
BR
/Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu
> (Arm Technology China) via TF-M
> Sent: Thursday, August 1, 2019 11:12 AM
> To: tf-m(a)lists.trustedfirmware.org
> Cc: nd <nd(a)arm.com>
> Subject: [TF-M] [RFC] Code restructure of core/spm
>
> Hi,
>
> Several patches for code restructure is coming. Before I post the gerrit items, I
> want to collect your feedback on this. These changes contain:
>
> - Move header files into dedicated directory for easy include, and clean the
> included headers in sources;
> - Change some files' name to let them make more sense.
> - Move SPM related files into 'spm' folder instead of putting them in 'core'.
> - Move some interface files into 'ns_callable' since they are interfaces.
> - Remove 'ipc' folder after all files in it are well arranged.
>
> I will try to do these patches together so they can be merged together.
> But before that I want to request for comments about this, feel free to reply in
> this thread or comment on the task (add yourself if you are missing as
> subscribers):
> https://developer.trustedfirmware.org/T426
>
> BR
>
> /Ken
>
>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Please take a look at the patches I've put together to the linker files for multi-core.
The fundamental issue that necessitates this change is that the ARMv6/v7 MPU is quite constrained in terms of configuration - the size has to be an exact power of 2, and the base address has to be aligned to the size. This means that we need to group data together in memory so that we can minimize the gaps that we have to introduce to meet the MPU* requirements. To that end, I've grouped all the privileged data together and grouped all the unprivileged data together, and introduced a new #define, S_DATA_UNPRIV_START, that (optionally, in multi-core only) allows the start address of the unprivileged secure data to be specified. This then enables configuring a single MPU region to cover all the unprivileged secure data.
Note that only data sections are affected - code is left alone (mostly because the PSoC6 platform has so little Flash that we can't afford any padding at all).
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1731 groups the privileged data separate from the unprivileged
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1732 adds support for S_DATA_UNPRIV_START
Thanks,
Chris
* In this email I've said "MPU". Technically it's the "SMPU (System Memory Protection Unit) on PSoC6, but that has the same limitations as the ARMv6 MPU.
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
Hi,
Please review the proposed build system changes. Intention of those is to lay groundwork for building TFM for dual core platforms (aka twincpu).
The main problem of the existing build system is that it assumes that both tfm_s and tfm_ns run on the same core. In dual core systems secure and non-secure code runs on two independent cores. Each CPU core can be different in terms of architecture, configuration etc, and this adds the requirement of separating out secure and non-secure builds..
The patches basically do the following:
* Introduce TFM_MULTI_CORE_TOPOLOGY, that distinguish single core and multicore builds.
* Split secure and non-secure builds and build both in single building execution.
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1747https://review.trustedfirmware.org/c/trusted-firmware-m/+/1748https://review.trustedfirmware.org/c/trusted-firmware-m/+/1749
Thanks,
Andrei
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
Hi Thomas,
The first variable in a tfm_core_irq_signal_data_t structure is a partition_id. ID 0 is reserved and cannot be a valid entry in this array so it could, in theory, be checked for terminating the loop. I would argue, however, that having a compile time constant loop count variable is better from a performance and optimization point of view. If loop count is const 0 an optimizing compiler can eliminate the loop altogether while if the iteration count depends on the value of an entry in the array, it would be more unlikely to eliminate the unused loop.
The key metrics that TF-M is currently measured against are memory footprint and to a lesser degree latency, and having the extra element in the array and the extra iteration in the loop are both sub-optimal in this respect. I do understand the need, however, to keep the constructs standard C and eliminate deviations. Those can lead to build errors or worse: unexpected runtime behaviour with a simple change in a compiler version or similar, so having a clean, standard, predictable code is essential.
So thank you for your effort and yes, until and unless we find a more optimal way to get around this problem, please do introduce the proposed change, taking into possible consideration my first comment on helping the compiler detect the unused code.
Regards
Miklos
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: 14 August 2019 08:53
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] tfm_core_irq_signals array
Just back from vacation and I notice that a lot seems to have happened while I was away :)
As you may know, I'm adding support for the IAR toolchain to tf-m, and this mostly involve cleaning up and eliminating non-standard C constructs that gcc and armclang seems to accept, but which our toolchain does not and is non-standard.
One thing we don't accept is zero sized arrays, and I cleaned up a few instances before going on vacation and now I see that a new one has crept in, tfm_core_irq_signals.
For the other instances I added a zero initialized element at the end of the array and instead of generating a "count" variable at compile time I used that trailing zero element as a limit while looping over the array.
In those cases it was fairly easy and safe as there was at least one pointer element that was non-null for all elements except the last. In this case all members of the struct are scalars and I'm not sure if there is a value I can assign to any of the members that are guaranteed to never be legal and that I can test for.
Or should I just use the changes below, where I add a dummy trailing element and adjust the tfm_core_irq_signals_count variable for this?
---
/* Definitions of the signals of the IRQs */ const struct tfm_core_irq_signal_data_t tfm_core_irq_signals[] = { #ifdef TFM_PARTITION_TEST_CORE
{ TFM_IRQ_TEST_1_ID, SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ,
TFM_TIMER0_IRQ, 64 },
#endif /* TFM_PARTITION_TEST_CORE */
{0, 0, 0, 0}
};
const size_t tfm_core_irq_signals_count = (sizeof(tfm_core_irq_signals) /
sizeof(*tfm_core_irq_signals)) - 1;
---
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Just back from vacation and I notice that a lot seems to have happened
while I was away :)
As you may know, I'm adding support for the IAR toolchain to tf-m, and
this mostly involve cleaning up and eliminating non-standard C
constructs that gcc and armclang seems to accept, but which our
toolchain does not and is non-standard.
One thing we don't accept is zero sized arrays, and I cleaned up a few
instances before going on vacation and now I see that a new one has
crept in, tfm_core_irq_signals.
For the other instances I added a zero initialized element at the end of
the array and instead of generating a "count" variable at compile time I
used that trailing zero element as a limit while looping over the array.
In those cases it was fairly easy and safe as there was at least one
pointer element that was non-null for all elements except the last. In
this case all members of the struct are scalars and I'm not sure if
there is a value I can assign to any of the members that are guaranteed
to never be legal and that I can test for.
Or should I just use the changes below, where I add a dummy trailing
element and adjust the tfm_core_irq_signals_count variable for this?
---
/* Definitions of the signals of the IRQs */
const struct tfm_core_irq_signal_data_t tfm_core_irq_signals[] = {
#ifdef TFM_PARTITION_TEST_CORE
{ TFM_IRQ_TEST_1_ID, SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ,
TFM_TIMER0_IRQ, 64 },
#endif /* TFM_PARTITION_TEST_CORE */
{0, 0, 0, 0}
};
const size_t tfm_core_irq_signals_count = (sizeof(tfm_core_irq_signals) /
sizeof(*tfm_core_irq_signals)) - 1;
---
/Thomas
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi Chris,
Please note that the master branch does support level 2 isolation, so the grouping of sections according to trust domains is already present both for gcc and armclang there.
I suggest to refer to that implementation and work from that instead of re-doing it from scratch to avoid unnecessary bifurcation of linker scripts and scatter files for the two platform types.
Isolation level 2 readiness was a non-trivial piece of work executed in Q2 so I'd hope that effort can be reused in the twincpu branch.
Regards
Miklos
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Christopher Brand via TF-M
Sent: 07 August 2019 22:04
To: TF-M(a)lists.trustedfirmware.org
Subject: [TF-M] gcc linker script help
Hi,
I'm working on supporting TFM_LVL 2 on the PSoC6 platform in the feature-twincpu branch. To that end, I want to group all the secure data that needs to be accessed by secure unprivileged code separate from the secure data that is privileged-only. I have a patch at https://review.trustedfirmware.org/c/trusted-firmware-m/+/1731 that moves sections around to make this practical and then a patch at https://review.trustedfirmware.org/c/trusted-firmware-m/+/1732 that fixes the start of the unprivileged secure data for the armclang linker. I've been trying to get the same result with the gcc linker, but so far it either hasn't done what I want or it's failed to link.
If anyone more familiar with the gcc linker is able to help, I'd really appreciate it!
And of course review comments are always welcome, too - I don't want this to break anything.
Thanks,
Chris
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi,
I'm working on supporting TFM_LVL 2 on the PSoC6 platform in the feature-twincpu branch. To that end, I want to group all the secure data that needs to be accessed by secure unprivileged code separate from the secure data that is privileged-only. I have a patch at https://review.trustedfirmware.org/c/trusted-firmware-m/+/1731 that moves sections around to make this practical and then a patch at https://review.trustedfirmware.org/c/trusted-firmware-m/+/1732 that fixes the start of the unprivileged secure data for the armclang linker. I've been trying to get the same result with the gcc linker, but so far it either hasn't done what I want or it's failed to link.
If anyone more familiar with the gcc linker is able to help, I'd really appreciate it!
And of course review comments are always welcome, too - I don't want this to break anything.
Thanks,
Chris
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
tl;dr: unable to connect to MPS2+ AN521 with JLink and perform a soft
reset to halt at NSPE init, and debug an init issue. Connect via SWD
fails, connect via JTAG seems OK, but soft reset requests consistently
fail, preventing meaningful debug/trace of the code. Looking for
advice on known-good debug setup with GDB and Linux.
Full explanation follows:
I'm currently working on an application with the following setup:
- TF-M (latest) running in the secure processing environment
- Zephyr running in the NSPE
- PSA FF APIs to communicate between PEs
I've run into a HW problem with the UART peripheral that I need to
debug, but using a J-Link has been problematic, and I was curious if
anyone else has had any success with GDB or JLinkExe and the MPS2+.
To debug, I currently do the following:
- Copy a valid TF-M + Zephyr and BL2 image to the MPS2+
- Physically reset the MPS2+ (AN521)
- Wait for the image to start up (based on serial output)
- Connect the debugger
- Attempt to reset
I get the following output at connect (entering the 'connect' command
at the J-Link prompt):
NOTE: I've been unable to get SWD to work, and had to fall back to
JTAG for the interface.
----------------------------------------
$ JLinkExe -device Cortex-M33 -if jtag -speed auto
SEGGER J-Link Commander V6.44i (Compiled May 17 2019 17:38:03)
DLL version V6.44i, compiled May 17 2019 17:37:52
Connecting to J-Link via USB...O.K.
Firmware: J-Link V9 compiled May 17 2019 09:50:41
Hardware version: V9.10
S/N: 609100327
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=3.011V
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
JTAGConf>connect
ERROR while parsing value for IRPre. Using default: -1.
ERROR while parsing value for DRPre. Using default: -1.
Device "CORTEX-M33" selected.
Connecting to target via JTAG
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
Scanning AP map to find all available APs
AP[3]: Stopped AP scan as end of AP map has been reached
AP[0]: APB-AP (IDR: 0x54770002)
AP[1]: AHB-AP (IDR: 0x84770001)
AP[2]: AHB-AP (IDR: 0x84770001)
Iterating through AP map to find AHB-AP to use
AP[0]: Skipped. Not an AHB-AP
AP[1]: Core found
AP[1]: AHB-AP ROM base: 0xF0008000
CPUID register: 0x410FD211. Implementer code: 0x41 (ARM)
Found Cortex-M33 r0p1, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ F0008000
ROMTbl[0][0]: F0009000, CID: B105900D, PID: 000BB9A4 GPR
ROMTbl[0][1]: E00FF000, CID: B105100D, PID: 000BB4C9 ROM Table
ROMTbl[1] @ E00FF000
ROMTbl[1][0]: E000E000, CID: B105900D, PID: 000BBD21 Cortex-M33
ROMTbl[1][1]: E0001000, CID: B105900D, PID: 000BBD21 DWT
ROMTbl[1][2]: E0002000, CID: B105900D, PID: 000BBD21 FPB
ROMTbl[1][3]: E0000000, CID: B105900D, PID: 000BBD21 ITM
ROMTbl[1][5]: E0041000, CID: B105900D, PID: 001BBD21 ETM
ROMTbl[1][6]: E0042000, CID: B105900D, PID: 000BBD21 CTI
Cortex-M33 identified.
----------------------------------------
But any attempt to perform a soft reset fails, which makes debugging
the init code problematic:
----------------------------------------
J-Link>r 0
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Reset: CPU may have not been reset (DHCSR.S_RESET_ST never gets set).
Reset: Using fallback: Reset pin.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via reset pin
Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
Reset: Reconnecting and manually halting CPU.
AP map detection skipped. Manually configured AP map found.
AP[0]: CUSTOM-AP (IDR: Not set)
AP[1]: AHB-AP (IDR: Not set)
AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP map detection skipped. Manually configured AP map found.
AP[0]: CUSTOM-AP (IDR: Not set)
AP[1]: AHB-AP (IDR: Not set)
AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
**************************
WARNING: CPU could not be halted
**************************
Reset: Core did not halt after reset, trying to disable WDT.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via reset pin
Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
Reset: Reconnecting and manually halting CPU.
AP map detection skipped. Manually configured AP map found.
AP[0]: CUSTOM-AP (IDR: Not set)
AP[1]: AHB-AP (IDR: Not set)
AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP map detection skipped. Manually configured AP map found.
AP[0]: CUSTOM-AP (IDR: Not set)
AP[1]: AHB-AP (IDR: Not set)
AP[1]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
**************************
WARNING: CPU could not be halted
**************************
****** Error: Could not find core in Coresight setup
----------------------------------------
If anyone is using a J-Link or J-Trace and ideally GDB to do any
meaningful debugging or tracing on the MPS2+ any suggestions on proper
setup would be valuable, and I'm happy to document an eventual working
config for inclusion in the project doc files.
Barring that, an alternative GDB-based setup would be useful if
someone has a known-good solution?
Best regards,
Kevin Townsend
Hi Minos,
Thanks for the detailed reply/explanation. This sounds similar to the
CI setup for Zephyr where I test changes locally first.
I'm happy to put together a change request for this, based on any
feedback here (if it's deemed worth merging in, etc.):
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
Best regards,
Kevin
On Mon, 5 Aug 2019 at 15:34, Minos Galanakis via TF-M
<tf-m(a)lists.trustedfirmware.org> wrote:
>
> The CI comprises of three modules. The Jenkins logic, the Python Scripts and the docker build slave.
>
>
> The environment is provided by the docker build slave and provisioned into the pipeline flow when the venv is created for each stage:
>
> virtualenv -p python3 ${VENV_P3_NAME} --system-site-packages
>
> No requirements are installed at the Jenkins Stage, but if needed as an one-off (i.e. for staging purposes), the design supports it.
>
>
> The case for installing Python requirements on the fly using requirements.txt
>
>
> Extending requirements dynamically on the fly, can be quite a challenge due to the way Jenkins handles the absolute resolution of workspace directory on each step. In short Python’s virtual-environment stores the configuration paths in absolute format, while Jenkins is not guaranteed to give you the same reference to a working directory in consecutive calls in the pipeline.
>
> So if you create a venv at stage 1, which evaluates ~/ as /server/workspace/fubar-job/venv/.. and then attempt to call it in a following parallel step, the code may be located at /server/workspace/1/fubar-job/venv
>
> At this point you can either create the VENV in each stage, and reinstall the requirements, effectively wasting bandwidth or hack it by piping everything in SED before activating to ensure the path is resolved correctly.
>
> For that purposes the ci-scripts level requirements.txt will be deprecated in the next feature update.
>
>
> How should a user access or modify the TF-M Build environment.
>
>
> Environment will be established at the docker build stage.
>
> https://review.trustedfirmware.org/admin/repos/ci/dockerfiles
>
> And more specifically the requirements for Python3 in this file:
>
> https://git.trustedfirmware.org/ci/dockerfiles.git/tree/xenial-amd64-tf-m-b…
>
> After it has been updated and merged you should raise a ticket and request the image to get rebuilt, or if it is not very critical, wait for some other party change to trigger the build.
>
> The process requires creating local docker image, meant to test your changes but also allowing you to access the TF-M build environment as deployed on the CI. You can do that following the steps below:
>
>
> # Get the docker image
>
> $ git clone https://review.trustedfirmware.org/ci/dockerfiles && cd dockerfiles/xenial-amd64-tf-m-build
>
> # Edit the entry point to convert it not to be a jenkins-slave
>
> $ vi Dockerfile
>
> # change ENTRYPOINT ["/usr/local/bin/jenkins-slave"] to ENTRYPOINT [/bin/bash"], save exit
>
> # Build the image
>
> $ docker build ./
>
> # Find the image hash id
>
> $ docker image ls
>
> # Run an interactive bash shell, mounting a local directory as /opt/openci in instance (if required to share files)
>
> $ docker run -it --name tf-m-build-env -v /YOUR_CUSTOM_PATH:/opt/openci 10bcb173cd39
>
> # You can relaunch that instance in the future by starting it again.
>
> $ docker start && docker -exec -it tf-m-build-env /bin/bash
>
>
>
> Please let me know if you need more clarity or guidance on how to handle modifications on the CI.
>
>
> Regards,
>
> Minos Galanakis
>
> ________________________________
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> on behalf of Antonio De Angelis via TF-M <tf-m(a)lists.trustedfirmware.org>
> Sent: 02 August 2019 14:57
> To: tf-m(a)lists.trustedfirmware.org <tf-m(a)lists.trustedfirmware.org>
> Cc: nd <nd(a)arm.com>
> Subject: Re: [TF-M] Changes to CI for python dependencies
>
> +Minos now
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
> Sent: 02 August 2019 14:47
> To: tf-m(a)lists.trustedfirmware.org
> Subject: Re: [TF-M] Changes to CI for python dependencies
>
> Minos, could you have a look at this?
>
> Thanks,
> Antonio
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
> Sent: 02 August 2019 12:44
> To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
> Subject: [TF-M] Changes to CI for python dependencies
>
> In an effort to migrate to the more modern 'cryptography' module in imgtool.py (which mcuboot has already switched to upstream), I created a change request here:
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
>
> The change fails in CI, however, due to the missing cryptography module in the CI build environment:
> https://ci.trustedfirmware.org/job/tf-m-build-test-review/1740/artifact/bui…
>
> This brings up the following issues:
>
> - How can/should changes be made to the CI build environment?
> - Can the overall TF-M installation process be improved automating
> Python module installation via a requirements.txt file?
>
> Adding a requirements.txt file means that file could be run when the CI environment starts a new test build, taking into account any dependency changes that are part of the change request (version updates, etc.).
>
> This would also have the positive side effect of users no longer having to scan through tfm_sw_requirement.rst to see what they don't have installed, or parse build failures for missing module names.
>
> I'm happy to make a new change request adding a requirements.txt file, and update the documentation accordingly, but t's not clear to me how to propose the required changes to the CI setup?
>
> Best regards,
> Kevin Townsend
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Manoj,
Please elaborate on the problem you are seeing and the steps you want to take so we can consider if it's something TF-M is in the process of addressing or if it is out of scope.
On first read I feel there's a contradiction:
The point of having TF-M - or any secure "supervising entity" - in the system is that it has awareness of the goings-on in the system, understands the states of parallel contexts that are supported by the hardware, to control its security aspects. Having a device driver "not plugged in TF-M" would, on the face of it, defeat the purpose of TF-M as a management entity, and the device driver would need not only to handle its own threat vectors, but any potential collisions with TF-M's understanding and control of the system state, making it, in effect, part of the management entity.
So rather than the driver being not plugged in, I guess what we need to work out is how TF-M can be extended to cover the type of use case you are working on, without compromising the holistic security model that TF-M implements - but there's no one-size-fits-all solution.
Thanks and regards
Miklos
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of R, Manoj via TF-M
Sent: 05 July 2019 10:24
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] independent device driver model working along side SPM
Hi,
Is there a design guideline available for device driver which is working on secure side alongside SPM.
I do not want to plug my driver in TF-M due to latency considerations.
Basically my plan is to introduce non secure callable veneers for calling the interfaces of the driver which I am introducing.
Any thoughts on this will be helpful.
Regards
Manoj
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
The CI comprises of three modules. The Jenkins logic, the Python Scripts and the docker build slave.
The environment is provided by the docker build slave and provisioned into the pipeline flow when the venv is created for each stage:
virtualenv -p python3 ${VENV_P3_NAME} --system-site-packages
No requirements are installed at the Jenkins Stage, but if needed as an one-off (i.e. for staging purposes), the design supports it.
The case for installing Python requirements on the fly using requirements.txt
Extending requirements dynamically on the fly, can be quite a challenge due to the way Jenkins handles the absolute resolution of workspace directory on each step. In short Python’s virtual-environment stores the configuration paths in absolute format, while Jenkins is not guaranteed to give you the same reference to a working directory in consecutive calls in the pipeline.
So if you create a venv at stage 1, which evaluates ~/ as /server/workspace/fubar-job/venv/.. and then attempt to call it in a following parallel step, the code may be located at /server/workspace/1/fubar-job/venv
At this point you can either create the VENV in each stage, and reinstall the requirements, effectively wasting bandwidth or hack it by piping everything in SED before activating to ensure the path is resolved correctly.
For that purposes the ci-scripts level requirements.txt will be deprecated in the next feature update.
How should a user access or modify the TF-M Build environment.
Environment will be established at the docker build stage.
https://review.trustedfirmware.org/admin/repos/ci/dockerfiles
And more specifically the requirements for Python3 in this file:
https://git.trustedfirmware.org/ci/dockerfiles.git/tree/xenial-amd64-tf-m-b…
After it has been updated and merged you should raise a ticket and request the image to get rebuilt, or if it is not very critical, wait for some other party change to trigger the build.
The process requires creating local docker image, meant to test your changes but also allowing you to access the TF-M build environment as deployed on the CI. You can do that following the steps below:
# Get the docker image
$ git clone https://review.trustedfirmware.org/ci/dockerfiles && cd dockerfiles/xenial-amd64-tf-m-build
# Edit the entry point to convert it not to be a jenkins-slave
$ vi Dockerfile
# change ENTRYPOINT ["/usr/local/bin/jenkins-slave"] to ENTRYPOINT [/bin/bash"], save exit
# Build the image
$ docker build ./
# Find the image hash id
$ docker image ls
# Run an interactive bash shell, mounting a local directory as /opt/openci in instance (if required to share files)
$ docker run -it --name tf-m-build-env -v /YOUR_CUSTOM_PATH:/opt/openci 10bcb173cd39
# You can relaunch that instance in the future by starting it again.
$ docker start && docker -exec -it tf-m-build-env /bin/bash
Please let me know if you need more clarity or guidance on how to handle modifications on the CI.
Regards,
Minos Galanakis
________________________________
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> on behalf of Antonio De Angelis via TF-M <tf-m(a)lists.trustedfirmware.org>
Sent: 02 August 2019 14:57
To: tf-m(a)lists.trustedfirmware.org <tf-m(a)lists.trustedfirmware.org>
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] Changes to CI for python dependencies
+Minos now
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: 02 August 2019 14:47
To: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] Changes to CI for python dependencies
Minos, could you have a look at this?
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 02 August 2019 12:44
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Changes to CI for python dependencies
In an effort to migrate to the more modern 'cryptography' module in imgtool.py (which mcuboot has already switched to upstream), I created a change request here:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
The change fails in CI, however, due to the missing cryptography module in the CI build environment:
https://ci.trustedfirmware.org/job/tf-m-build-test-review/1740/artifact/bui…
This brings up the following issues:
- How can/should changes be made to the CI build environment?
- Can the overall TF-M installation process be improved automating
Python module installation via a requirements.txt file?
Adding a requirements.txt file means that file could be run when the CI environment starts a new test build, taking into account any dependency changes that are part of the change request (version updates, etc.).
This would also have the positive side effect of users no longer having to scan through tfm_sw_requirement.rst to see what they don't have installed, or parse build failures for missing module names.
I'm happy to make a new change request adding a requirements.txt file, and update the documentation accordingly, but t's not clear to me how to propose the required changes to the CI setup?
Best regards,
Kevin Townsend
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Andrej,
Alignment with the PSA 1.0.0 APIs is on the TF-M roadmap for next quarter: https://developer.trustedfirmware.org/w/tf_m/planning/
The "release" branch of the psa-arch-tests repo should be used for functional API certification. TF-M is compatible with that branch.
Best wishes,
Jamie
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 05 August 2019 12:47
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] PSA Storage API
Just only FYI:
The latest PSA Test Suite has been switched to a newer version of PSA Storage API:
https://github.com/ARM-software/psa-arch-tests/issues/105
Best regards,
Andrej Butok
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
+Minos now
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Antonio De Angelis via TF-M
Sent: 02 August 2019 14:47
To: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] Changes to CI for python dependencies
Minos, could you have a look at this?
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 02 August 2019 12:44
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Changes to CI for python dependencies
In an effort to migrate to the more modern 'cryptography' module in imgtool.py (which mcuboot has already switched to upstream), I created a change request here:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
The change fails in CI, however, due to the missing cryptography module in the CI build environment:
https://ci.trustedfirmware.org/job/tf-m-build-test-review/1740/artifact/bui…
This brings up the following issues:
- How can/should changes be made to the CI build environment?
- Can the overall TF-M installation process be improved automating
Python module installation via a requirements.txt file?
Adding a requirements.txt file means that file could be run when the CI environment starts a new test build, taking into account any dependency changes that are part of the change request (version updates, etc.).
This would also have the positive side effect of users no longer having to scan through tfm_sw_requirement.rst to see what they don't have installed, or parse build failures for missing module names.
I'm happy to make a new change request adding a requirements.txt file, and update the documentation accordingly, but t's not clear to me how to propose the required changes to the CI setup?
Best regards,
Kevin Townsend
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Minos, could you have a look at this?
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 02 August 2019 12:44
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Changes to CI for python dependencies
In an effort to migrate to the more modern 'cryptography' module in imgtool.py (which mcuboot has already switched to upstream), I created a change request here:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
The change fails in CI, however, due to the missing cryptography module in the CI build environment:
https://ci.trustedfirmware.org/job/tf-m-build-test-review/1740/artifact/bui…
This brings up the following issues:
- How can/should changes be made to the CI build environment?
- Can the overall TF-M installation process be improved automating
Python module installation via a requirements.txt file?
Adding a requirements.txt file means that file could be run when the CI environment starts a new test build, taking into account any dependency changes that are part of the change request (version updates, etc.).
This would also have the positive side effect of users no longer having to scan through tfm_sw_requirement.rst to see what they don't have installed, or parse build failures for missing module names.
I'm happy to make a new change request adding a requirements.txt file, and update the documentation accordingly, but t's not clear to me how to propose the required changes to the CI setup?
Best regards,
Kevin Townsend
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
In an effort to migrate to the more modern 'cryptography' module in
imgtool.py (which mcuboot has already switched to upstream), I created
a change request here:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1695
The change fails in CI, however, due to the missing cryptography module in the
CI build environment:
https://ci.trustedfirmware.org/job/tf-m-build-test-review/1740/artifact/bui…
This brings up the following issues:
- How can/should changes be made to the CI build environment?
- Can the overall TF-M installation process be improved automating
Python module installation via a requirements.txt file?
Adding a requirements.txt file means that file could be run when the CI
environment starts a new test build, taking into account any dependency
changes that are part of the change request (version updates, etc.).
This would also have the positive side effect of users no longer having
to scan through tfm_sw_requirement.rst to see what they don't have installed,
or parse build failures for missing module names.
I'm happy to make a new change request adding a requirements.txt file,
and update
the documentation accordingly, but t's not clear to me how to propose
the required
changes to the CI setup?
Best regards,
Kevin Townsend
Hi,
I made some changes to the tfm_ns_interface_ functions.
They have common implementations that call os_wrapper_ functions.
With these changes, RTOSes only need to implement the OS dependent functions defined in os_wrappers rather than the tfm_ns_interface_ functions.
There are several changes with a same topic:
https://review.trustedfirmware.org/q/topic:%22refine_ns_interface_functions…
Please help on reviewing. Thanks.
- Kevin
[from thread: RE: Adding a platform specific tfm_svc_number_t]
Hi Andrej,
Please note that non-secure SVC handling is independent of secure SVC handling - the two are implemented separately in the code base and hardware resources are banked for their execution.
The original discussion is about secure SVC handling type and functions, which are unrelated to NS RTOS dependency on (NS) SVC.
I'm starting a separate discussion thread for NS SVC occupancy to avoid blurring the lines between the two.
Please note that any example code in the TF-M repository on NS SVC handling is for demonstration purposes and not, strictly speaking, part of TF-M core implementation. It shows how a non-secure privileged entity needs to register a client ID to the SPM on task creation, if multiple client IDs are managed by the RTOS. Whether a specific implementation uses SVC or another method for running the corresponding privileged code is out of scope of the design, only one possible option is shown, but this is an RTOS-specific problem.
Meaning that in an RTOS where the adaptation layer mustn't use SVC and is relying on some other method, there's no design limitation in TF-M that is in conflict with that - the implementation can be adjusted in line with the RTOS's method of choice, but where the NS RTOS has no such restriction, the adaptation layer can rely on SVC for this feature.
Thanks
Miklos
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: 26 July 2019 08:29
To: Ken Liu (Arm Technology China) <Ken.Liu(a)arm.com>; DeMars, Alan <ademars(a)ti.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] Adding a platform specific tfm_svc_number_t
Just another use-case,
FreeRTOS is using the non-secure SVC. It does not expect that it may be used by somebody else (not RTOS).
Ideally, if TFM will not occupy SVC.
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu (Arm Technology China) via TF-M
Sent: Friday, July 26, 2019 3:49 AM
To: DeMars, Alan <ademars(a)ti.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] Adding a platform specific tfm_svc_number_t
Hi Alan,
Can you share us your usage details? This could help us on defining the svc number things you mentioned.
Thanks.
-Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> DeMars, Alan via TF-M
> Sent: Friday, July 26, 2019 6:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] Adding a platform specific tfm_svc_number_t
>
> I need to define platform specific SPM APIs that will be invoked by our SPs.
>
> Is there a convention for 'cleanly' adding platform specific SVC
> enumerations to the tfm_svc_number_t typedef in tfm_svc.h as well as
> platform specific 'case's to SVCHandler_main() and/or SVC_Handler_IPC()?
>
> Alan
>
>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.trustedfirmware.org%2Fmailman%2Flistinfo%2Ftf-m&data=02%7C01%7Ca
> ndrey.butok%40nxp.com%7C42c1df29f3b84ac62f5708d7116b749e%7C686ea1d3bc2
> b4c6fa92cd99c5c301635%7C0%7C0%7C636997025530401902&sdata=vO0tq34jt
> zFFn9D3cnrDP3a4fnrkq4h5jvzZmob2HnU%3D&reserved=0
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi,
Several patches for code restructure is coming. Before I post the gerrit items, I want to collect your feedback on this. These changes contain:
- Move header files into dedicated directory for easy include, and clean the included headers in sources;
- Change some files' name to let them make more sense.
- Move SPM related files into 'spm' folder instead of putting them in 'core'.
- Move some interface files into 'ns_callable' since they are interfaces.
- Remove 'ipc' folder after all files in it are well arranged.
I will try to do these patches together so they can be merged together.
But before that I want to request for comments about this, feel free to reply in this thread or comment on the task (add yourself if you are missing as subscribers):
https://developer.trustedfirmware.org/T426
BR
/Ken
As a follow-up, mcuboot has removed the pycrypto dependency, so I
will put an update together for TF-M for review:
https://github.com/JuulLabs-OSS/mcuboot/tree/master/scripts/imgtool
Best regards,
Kevin
On Wed, 31 Jul 2019 at 16:27, Kevin Townsend via TF-M
<tf-m(a)lists.trustedfirmware.org> wrote:
>
> Hi,
>
> As part of an effort to enable automatic builds of TF-M in Zephyr,
> I've been trying to get the TF-M + Zephyr S/NS images building and
> passing on Zephyr's CI system.
>
> The only missing requirements for building TF-M in a clean
> Zephyr SDK 0.10.1 based environment is the pycrypto module, which
> is used in the imgtool.py utility, specifically:
>
> https://git.trustedfirmware.org/trusted-firmware-m.git/tree/bl2/ext/mcuboot…
>
> My concern is that this module is no longer actively maintained
> (last release was 2013!), and it seems like a poor decision to rely
> on something that isn't actively maintained when more recent
> alternative are available.
>
> Is there a specific reason to keep this module in the script in favour
> of something more modern?
>
> Best regards,
> Kevin
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Kevin,
We are open to scope what would be needed to move to more supported alternatives, for example: https://pypi.org/project/cryptography/
If you have any specific idea, please submit it. As far as I can see now, there is not a specific reason to stick with the old pycrypto module.
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Kevin Townsend via TF-M
Sent: 31 July 2019 15:28
To: Thomas Törnblom via TF-M <tf-m(a)lists.trustedfirmware.org>
Subject: [TF-M] Outdated pycrypto dependency in BL2's imgtool.py
Hi,
As part of an effort to enable automatic builds of TF-M in Zephyr, I've been trying to get the TF-M + Zephyr S/NS images building and passing on Zephyr's CI system.
The only missing requirements for building TF-M in a clean Zephyr SDK 0.10.1 based environment is the pycrypto module, which is used in the imgtool.py utility, specifically:
https://git.trustedfirmware.org/trusted-firmware-m.git/tree/bl2/ext/mcuboot…
My concern is that this module is no longer actively maintained (last release was 2013!), and it seems like a poor decision to rely on something that isn't actively maintained when more recent alternative are available.
Is there a specific reason to keep this module in the script in favour of something more modern?
Best regards,
Kevin
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi,
As part of an effort to enable automatic builds of TF-M in Zephyr,
I've been trying to get the TF-M + Zephyr S/NS images building and
passing on Zephyr's CI system.
The only missing requirements for building TF-M in a clean
Zephyr SDK 0.10.1 based environment is the pycrypto module, which
is used in the imgtool.py utility, specifically:
https://git.trustedfirmware.org/trusted-firmware-m.git/tree/bl2/ext/mcuboot…
My concern is that this module is no longer actively maintained
(last release was 2013!), and it seems like a poor decision to rely
on something that isn't actively maintained when more recent
alternative are available.
Is there a specific reason to keep this module in the script in favour
of something more modern?
Best regards,
Kevin
I cherry-picked the commit into my build area and confirmed that it behaves properly.
Alan
> On Jul 29, 2019, at 7:57 PM, DeMars, Alan via TF-M <tf-m(a)lists.trustedfirmware.org> wrote:
>
> Looks fine to me!
>
> On Jul 29, 2019, at 7:19 PM, Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com<mailto:Summer.Qin@arm.com>> wrote:
>
> Hi,
>
> The related patch is pushed into https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1669/
> Please help to review if you have time.
>
> Thanks,
> Summer
> ________________________________
> From: DeMars, Alan <ademars(a)ti.com<mailto:ademars@ti.com>>
> Sent: Tuesday, July 30, 2019 6:45 AM
> To: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com<mailto:Summer.Qin@arm.com>>
> Cc: tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org> <tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org>>; nd <nd(a)arm.com<mailto:nd@arm.com>>
> Subject: RE: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
>
>
> It would be good to get this fix into master ASAP so master doesn’t remain broken for long.
>
>
>
> Alan
>
>
>
> From: Summer Qin (Arm Technology China) [mailto:Summer.Qin@arm.com]
> Sent: Sunday, July 28, 2019 11:18 PM
> To: DeMars, Alan
> Cc: tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org>; nd
> Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
>
>
>
> Hi Alan,
>
>
>
> Yeah, I see your proposed changes in the email.
>
> We will make the corrections under my task T435.
>
>
>
>
>
> Thanks,
>
> Summer
>
>
>
> ________________________________
>
> From: DeMars, Alan <ademars(a)ti.com<mailto:ademars@ti.com>>
> Sent: Monday, July 29, 2019 11:30 AM
> To: Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com<mailto:Summer.Qin@arm.com>>
> Cc: tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org> <tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org>>; nd <nd(a)arm.com<mailto:nd@arm.com>>
> Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
>
>
>
> Summer,
>
> The email I sent with the attachment was bounced back so I sent another one afterwards that detailed the changes I had to make. I’d rather someone on your team make the corrections to make sure they’re sufficient.
>
> Alan
>
>> On Jul 28, 2019, at 7:41 PM, Summer Qin (Arm Technology China) <Summer.Qin(a)arm.com<mailto:Summer.Qin@arm.com>> wrote:
>>
>> Hi Alan,
>>
>> Thanks for pointing out this issue.
>>
>> The patch related to PSA APIs alignment task is the first patch to align the PSA APIs, we will have some following patches to update.
>> In your last email, I didn't see the attachment, maybe blocked by the system. If it is convenient for you, could you push your patch to https://review.trustedfirmware.org , or you can create one ticket in https://developer.trustedfirmware.org and upload your changes as attachment in the new created task. Attached the change under my task T435 is also OK. We can help to submit the changes for you.
>>
>>
>> Thanks,
>> Summer
>>
>> On 7/28/19, 4:39 PM, "TF-M on behalf of DeMars, Alan via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org<mailto:tf-m-bounces@lists.trustedfirmware.org> on behalf of tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org>> wrote:
>>
>> I found several other code points in tfm_svcalls.c that need to be enhanced to handle 'type' >= PSA_IPC_CALL.
>>
>> Attached is my modified tfm_svcalls.c file. With these modifications, the 'type' argument makes its way through the system without causing tfm_panic() to be invoked.
>>
>> Alan
>>
>> -----Original Message-----
>> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
>> Sent: Friday, July 26, 2019 2:28 PM
>> To: Ken Liu (Arm Technology China)
>> Cc: tf-m(a)lists.trustedfirmware.org<mailto:tf-m@lists.trustedfirmware.org>
>> Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
>>
>> In order to pass along the new ‘type’ argument in psa_call, it seems that this line in tfm_svcalls.c:
>>
>> msg = tfm_spm_create_msg(service, handle, PSA_IPC_CALL, ns_caller, invecs,
>> in_num, outvecs, out_num, outptr);
>>
>> Should be:
>>
>> msg = tfm_spm_create_msg(service, handle, type, ns_caller, invecs,
>> in_num, outvecs, out_num, outptr);
>>
>> Otherwise the receiving SP will always see msg.type == PSA_IPC_CALL.
>>
>> Alan
>>
>> From: Summer-ARM (Summer Qin) [mailto:noreply@developer.trustedfirmware.org]
>> Sent: Thursday, July 25, 2019 7:14 PM
>> To: DeMars, Alan
>> Subject: [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
>>
>> Summer-ARM closed this task as "Resolved".
>>
>>
>> TASK DETAIL
>> https://developer.trustedfirmware.org/T435
>>
>> EMAIL PREFERENCES
>> https://developer.trustedfirmware.org/settings/panel/emailpreferences/
>>
>> To: Summer-ARM
>> Cc: edison-ai, matetothpal, adeaarm, wmnt, ashutoshksingh, KenLSoft, Summer-ARM, akiannillo, ademars, zhengwang721, BabaYB, karl-zh, shebuk, zbh, qixiang, DarshpreetSabharwal, jamesking1, mmorenobarm, abhishek-pandit
>> --
>> TF-M mailing list
>> TF-M(a)lists.trustedfirmware.org<mailto:TF-M@lists.trustedfirmware.org>
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
>> --
>> TF-M mailing list
>> TF-M(a)lists.trustedfirmware.org<mailto:TF-M@lists.trustedfirmware.org>
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
>>
>>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
The interface call from ' tfm_core_init() ' to 'tfm_spm_hal_set_secure_irq_priority()' is planned to be left there as it is now. If a certain platform implementation doesn't allow interrupt priorities to be set, it can leave the implementation of 'tfm_spm_hal_set_secure_irq_priority()' function empty.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
Sent: 30 July 2019 01:10
To: Adrian Shaw <Adrian.Shaw(a)arm.com>
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] including platform specific interrupt definitions
Adrian,
Yes, I noticed this.
I guess that means that the handler name will be derived from the 'source' string. Sadly, it appears that the CMSIS convention for naming IRQ numbers is 'PeripheralX_IRQn'. Given your handler naming convention, that means that the handler names I have to put in my platform's vector table must be 'PeripheralX_IRQn_Handler'. I prefer 'PeripheralX_Handler' myself and that is what I've telegraphed to our development team.
I'm thinking we will honor the PSA FF convention that if ONLY the 'source' attribute is provided for an IRQ, your name mangling rule will be followed for generating the ISR function name.
Additionally, we will modify the template such that if a custom attribute of 'handler_name' (or some such) is ALSO provided, we will use our own name mangling rules for generating the ISR function name so that we are free to populate the vector table with whatever function names we want.
Similarly, it appears that support for the 'tfm_irq_priority' attribute will be a platform-specific extension. Does this mean that the logic currently in tfm_core_init() that calls tfm_spm_hal_set_secure_irq_priority() for each interrupt will be removed from the standard code base?
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Adrian Shaw via TF-M
Sent: Monday, July 29, 2019 7:49 AM
To: TF-M(a)lists.trustedfirmware.org
Cc: nd
Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
Just as a heads up for future consideration. In the final version of the PSA-FF spec we replaced the `line_num` and `line_name` attributes with a new single attribute called “source”. You can use numbers or string identifiers with it (see change log in Appendix E of PSA-FF 1.0.0).
Best,
Adrian
> On 29 Jul 2019, at 15:37, Mate Toth-Pal via TF-M <tf-m(a)lists.trustedfirmware.org> wrote:
>
> Hi Alan,
>
> When I created the templates, I was thinking that it is a good idea to have the '_Handler' postfix on the privileged interrupt handler names in both cases (e.g. 'line_num' or 'line_name' is provided.). This would keep the names aligned to the current pattern applied in the existing platform implementations.
>
> If I understand your proposal correctly, that means, in case a 'line_name' is provided in the partition manifest, there would be two different entities in the code, which are referred by the same name:
> - The IRQ handler function
> - A macro which is substituted to the number of that IRQ line
>
> I'm not completely sure that it will not happen that the header file containing the macro gets included in a file that defines or declares the function which would break the privileged handler declaration or definition. Although I didn't check this situation occurs in the current implementation.
>
> Is my understanding correct? Is there a benefit of this proposal that I missed?
>
> Thanks,
> Mate
>
> -----Original Message-----
> From: DeMars, Alan <ademars(a)ti.com>
> Sent: 22 July 2019 17:23
> To: tf-m(a)lists.trustedfirmware.org; Mate Toth-Pal
> <Mate.Toth-Pal(a)arm.com>
> Subject: RE: including platform specific interrupt definitions
>
> After pulling in all the latest commits, I have the following suggestion regarding the use of the 'irqs' manifest properties:
>
> 1) Use the 'line_num' property unchanged within the 'tfm_core_irq_signals[]' structure array and as the third argument to tfm_irq_handler(). This is consistent with the PSA FF definition for this property: "line_num: A valid IRQ number for the platform"
>
> 2) When/if it is provided, use the 'line_name' property UNCHANGED as the name of the privileged IRQ handler functions. This is consistent with the PSA FF definition for this property: "line_name: A named IRQ, represented by a string identifier. The string identifier references an external definition, which is resolved in an IMPLEMENTATION DEFINED manner. This is helpful for implementations that do not wish to duplicate information already provided by an existing platform abstraction layer. The string identifiers are not defined in this specification and, as a result, are not portable"
>
> 3) Only if the 'line_name' property is NOT provided, derive the privileged IRQ handler function name by appending '_Handler' to the 'line_num' property.
>
> I achieved the above functionality by simply changing this logic in 'tfm_secure_irq_handlers_ipc.inc.template':
>
> {% if handler.line_num %}
> void irq_{{handler.line_num}}_Handler(void)
> {% elif handler.line_name %} void
> {{handler.line_name}}_Handler(void)
>
> To this:
>
> {% if handler.line_name %}
> void {{handler.line_name}}(void)
> {% elif handler.line_num %} void
> {{handler.line_num}}_Handler(void)
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf
> Of DeMars, Alan via TF-M
> Sent: Friday, July 19, 2019 1:36 PM
> To: Mate Toth-Pal
> Cc: tf-m(a)lists.trustedfirmware.org
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt
> definitions
>
> Mate,
>
> Thank you for your response. I discovered not long after I posted my inquiry that recent merges to master should resolve the problem I'm having. I'm in the process of pulling in those commits locally.
>
> Thanks again,
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf
> Of Mate Toth-Pal via TF-M
> Sent: Friday, July 19, 2019 1:22 PM
> To: TF-M(a)lists.trustedfirmware.org
> Cc: nd
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt
> definitions
>
> Hi Alan,
>
> I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
>
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
> This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
>
> Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
> This replaces the manually created IPC model signal definitions to the generated signals:
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
>
> This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
>
> This, and the related changes remove the manually created signal files.
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
>
> So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
>
> As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
>
> Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
>
> Regards,
> Mate
>
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> DeMars, Alan via TF-M
> Sent: 19 July 2019 18:35
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] including platform specific interrupt definitions
>
> I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
>
> What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
>
> Alan
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
Currently there are no plans to deprecate the 'tfm_irq_priority' optional attribute.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu (Arm Technology China) via TF-M
Sent: 25 July 2019 04:44
To: DeMars, Alan <ademars(a)ti.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] [EXTERNAL] RE: PSA API prototype update
Hi Alan,
These attributes should be already included in 'test/test_services/tfm_irq_test_service_1' of latest master, you can check the sources.
The alignment is a big task and the patch mentioned in this mail thread is the first one of prototype change. The whole FF 1.0.0 alignment (behaviors change e.g.) would come step by step later on.
And the interrupt priority -- let me check with interrupt designers to know more details. Current from my point of view it is platform defined setting which is out of FF scope.
Thanks.
-Ken
> -----Original Message-----
> From: DeMars, Alan <ademars(a)ti.com>
> Sent: Thursday, July 25, 2019 9:53 AM
> To: Ken Liu (Arm Technology China) <Ken.Liu(a)arm.com>
> Cc: tf-m(a)lists.trustedfirmware.org; nd <nd(a)arm.com>
> Subject: Re: [EXTERNAL] RE: PSA API prototype update
>
> Ken,
>
> Will support for the new “source” attribute in “irqs” be included in
> this API alignment? If not, when might it be supported? Also, is the “irqs” “priority”
> attribute being deprecated?
>
> Alan
>
> > On Jul 24, 2019, at 6:12 PM, Ken Liu (Arm Technology China)
> <Ken.Liu(a)arm.com> wrote:
> >
> > Hi Alan,
> >
> > Should by this weekend or early next week, depends on if there are
> > new
> comments.
> >
> > Thanks.
> >
> > -Ken
> >
> >> -----Original Message-----
> >> From: DeMars, Alan <ademars(a)ti.com>
> >> Sent: Wednesday, July 24, 2019 11:17 PM
> >> To: Ken Liu (Arm Technology China) <Ken.Liu(a)arm.com>
> >> Cc: tf-m(a)lists.trustedfirmware.org
> >> Subject: RE: PSA API prototype update
> >>
> >> When do you anticipate that this patch will be merged to master?
> >>
> >> -----Original Message-----
> >> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On
> >> Behalf Of Ken Liu (Arm Technology China) via TF-M
> >> Sent: Tuesday, July 23, 2019 11:17 PM
> >> To: tf-m(a)lists.trustedfirmware.org
> >> Cc: nd
> >> Subject: [EXTERNAL] [TF-M] PSA API prototype update
> >>
> >> Hi,
> >>
> >> A patch is pushed for couple of days reveals the update on PSA API
> >> prototype and its related caller change:
> >> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1572
> >>
> >> The most obvious part is a new parameter member 'type' is
> >> introduced in 'psa_call'. This is the first step of our upgrading
> >> to the latest PSA Firmware Framework Specification. The API
> >> internal behavior would come step by step later and now we can call PSA FF API in 1.0.0 prototypes.
> >>
> >> The callers included in TF-M has been updated in this patch.
> >> Developers who developed extra services should mention this change
> >> and update PSA API related sources.
> >> Any feedback please comment under the patch, or reply to this mail thread.
> >>
> >> Thanks.
> >>
> >> -Ken
> >> --
> >> TF-M mailing list
> >> TF-M(a)lists.trustedfirmware.org
> >> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
Yes, this should happen as part of the FF 1.0.0 alignment effort.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
Sent: 25 July 2019 23:59
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] Uniform Secure Service Signature
With the introduction of the 'type' argument in psa_call(), will the 'Uniform Secure Service Signature' also be updated to include 'type' as its first argument?
https://developer.trustedfirmware.org/w/tf_m/design/uniform_secure_service_…
Alan
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
Thanks for pointing out this issue.
The patch related to PSA APIs alignment task is the first patch to align the PSA APIs, we will have some following patches to update.
In your last email, I didn't see the attachment, maybe blocked by the system. If it is convenient for you, could you push your patch to https://review.trustedfirmware.org , or you can create one ticket in https://developer.trustedfirmware.org and upload your changes as attachment in the new created task. Attached the change under my task T435 is also OK. We can help to submit the changes for you.
Thanks,
Summer
On 7/28/19, 4:39 PM, "TF-M on behalf of DeMars, Alan via TF-M" <tf-m-bounces(a)lists.trustedfirmware.org on behalf of tf-m(a)lists.trustedfirmware.org> wrote:
I found several other code points in tfm_svcalls.c that need to be enhanced to handle 'type' >= PSA_IPC_CALL.
Attached is my modified tfm_svcalls.c file. With these modifications, the 'type' argument makes its way through the system without causing tfm_panic() to be invoked.
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
Sent: Friday, July 26, 2019 2:28 PM
To: Ken Liu (Arm Technology China)
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
In order to pass along the new ‘type’ argument in psa_call, it seems that this line in tfm_svcalls.c:
msg = tfm_spm_create_msg(service, handle, PSA_IPC_CALL, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Should be:
msg = tfm_spm_create_msg(service, handle, type, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Otherwise the receiving SP will always see msg.type == PSA_IPC_CALL.
Alan
From: Summer-ARM (Summer Qin) [mailto:noreply@developer.trustedfirmware.org]
Sent: Thursday, July 25, 2019 7:14 PM
To: DeMars, Alan
Subject: [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
Summer-ARM closed this task as "Resolved".
TASK DETAIL
https://developer.trustedfirmware.org/T435
EMAIL PREFERENCES
https://developer.trustedfirmware.org/settings/panel/emailpreferences/
To: Summer-ARM
Cc: edison-ai, matetothpal, adeaarm, wmnt, ashutoshksingh, KenLSoft, Summer-ARM, akiannillo, ademars, zhengwang721, BabaYB, karl-zh, shebuk, zbh, qixiang, DarshpreetSabharwal, jamesking1, mmorenobarm, abhishek-pandit
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Adrian,
Yes, I noticed this.
I guess that means that the handler name will be derived from the 'source' string. Sadly, it appears that the CMSIS convention for naming IRQ numbers is 'PeripheralX_IRQn'. Given your handler naming convention, that means that the handler names I have to put in my platform's vector table must be 'PeripheralX_IRQn_Handler'. I prefer 'PeripheralX_Handler' myself and that is what I've telegraphed to our development team.
I'm thinking we will honor the PSA FF convention that if ONLY the 'source' attribute is provided for an IRQ, your name mangling rule will be followed for generating the ISR function name.
Additionally, we will modify the template such that if a custom attribute of 'handler_name' (or some such) is ALSO provided, we will use our own name mangling rules for generating the ISR function name so that we are free to populate the vector table with whatever function names we want.
Similarly, it appears that support for the 'tfm_irq_priority' attribute will be a platform-specific extension. Does this mean that the logic currently in tfm_core_init() that calls tfm_spm_hal_set_secure_irq_priority() for each interrupt will be removed from the standard code base?
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Adrian Shaw via TF-M
Sent: Monday, July 29, 2019 7:49 AM
To: TF-M(a)lists.trustedfirmware.org
Cc: nd
Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
Just as a heads up for future consideration. In the final version of the PSA-FF spec we replaced the `line_num` and `line_name` attributes with a new single attribute called “source”. You can use numbers or string identifiers with it (see change log in Appendix E of PSA-FF 1.0.0).
Best,
Adrian
> On 29 Jul 2019, at 15:37, Mate Toth-Pal via TF-M <tf-m(a)lists.trustedfirmware.org> wrote:
>
> Hi Alan,
>
> When I created the templates, I was thinking that it is a good idea to have the '_Handler' postfix on the privileged interrupt handler names in both cases (e.g. 'line_num' or 'line_name' is provided.). This would keep the names aligned to the current pattern applied in the existing platform implementations.
>
> If I understand your proposal correctly, that means, in case a 'line_name' is provided in the partition manifest, there would be two different entities in the code, which are referred by the same name:
> - The IRQ handler function
> - A macro which is substituted to the number of that IRQ line
>
> I'm not completely sure that it will not happen that the header file containing the macro gets included in a file that defines or declares the function which would break the privileged handler declaration or definition. Although I didn't check this situation occurs in the current implementation.
>
> Is my understanding correct? Is there a benefit of this proposal that I missed?
>
> Thanks,
> Mate
>
> -----Original Message-----
> From: DeMars, Alan <ademars(a)ti.com>
> Sent: 22 July 2019 17:23
> To: tf-m(a)lists.trustedfirmware.org; Mate Toth-Pal <Mate.Toth-Pal(a)arm.com>
> Subject: RE: including platform specific interrupt definitions
>
> After pulling in all the latest commits, I have the following suggestion regarding the use of the 'irqs' manifest properties:
>
> 1) Use the 'line_num' property unchanged within the 'tfm_core_irq_signals[]' structure array and as the third argument to tfm_irq_handler(). This is consistent with the PSA FF definition for this property: "line_num: A valid IRQ number for the platform"
>
> 2) When/if it is provided, use the 'line_name' property UNCHANGED as the name of the privileged IRQ handler functions. This is consistent with the PSA FF definition for this property: "line_name: A named IRQ, represented by a string identifier. The string identifier references an external definition, which is resolved in an IMPLEMENTATION DEFINED manner. This is helpful for implementations that do not wish to duplicate information already provided by an existing platform abstraction layer. The string identifiers are not defined in this specification and, as a result, are not portable"
>
> 3) Only if the 'line_name' property is NOT provided, derive the privileged IRQ handler function name by appending '_Handler' to the 'line_num' property.
>
> I achieved the above functionality by simply changing this logic in 'tfm_secure_irq_handlers_ipc.inc.template':
>
> {% if handler.line_num %}
> void irq_{{handler.line_num}}_Handler(void)
> {% elif handler.line_name %} void {{handler.line_name}}_Handler(void)
>
> To this:
>
> {% if handler.line_name %}
> void {{handler.line_name}}(void)
> {% elif handler.line_num %}
> void {{handler.line_num}}_Handler(void)
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
> Sent: Friday, July 19, 2019 1:36 PM
> To: Mate Toth-Pal
> Cc: tf-m(a)lists.trustedfirmware.org
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
>
> Mate,
>
> Thank you for your response. I discovered not long after I posted my inquiry that recent merges to master should resolve the problem I'm having. I'm in the process of pulling in those commits locally.
>
> Thanks again,
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Mate Toth-Pal via TF-M
> Sent: Friday, July 19, 2019 1:22 PM
> To: TF-M(a)lists.trustedfirmware.org
> Cc: nd
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
>
> Hi Alan,
>
> I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
>
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
> This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
>
> Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
> This replaces the manually created IPC model signal definitions to the generated signals:
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
>
> This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
>
> This, and the related changes remove the manually created signal files.
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
>
> So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
>
> As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
>
> Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
>
> Regards,
> Mate
>
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
> Sent: 19 July 2019 18:35
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] including platform specific interrupt definitions
>
> I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
>
> What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
>
> Alan
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Just as a heads up for future consideration. In the final version of the PSA-FF spec we replaced the `line_num` and `line_name` attributes with a new single attribute called “source”. You can use numbers or string identifiers with it (see change log in Appendix E of PSA-FF 1.0.0).
Best,
Adrian
> On 29 Jul 2019, at 15:37, Mate Toth-Pal via TF-M <tf-m(a)lists.trustedfirmware.org> wrote:
>
> Hi Alan,
>
> When I created the templates, I was thinking that it is a good idea to have the '_Handler' postfix on the privileged interrupt handler names in both cases (e.g. 'line_num' or 'line_name' is provided.). This would keep the names aligned to the current pattern applied in the existing platform implementations.
>
> If I understand your proposal correctly, that means, in case a 'line_name' is provided in the partition manifest, there would be two different entities in the code, which are referred by the same name:
> - The IRQ handler function
> - A macro which is substituted to the number of that IRQ line
>
> I'm not completely sure that it will not happen that the header file containing the macro gets included in a file that defines or declares the function which would break the privileged handler declaration or definition. Although I didn't check this situation occurs in the current implementation.
>
> Is my understanding correct? Is there a benefit of this proposal that I missed?
>
> Thanks,
> Mate
>
> -----Original Message-----
> From: DeMars, Alan <ademars(a)ti.com>
> Sent: 22 July 2019 17:23
> To: tf-m(a)lists.trustedfirmware.org; Mate Toth-Pal <Mate.Toth-Pal(a)arm.com>
> Subject: RE: including platform specific interrupt definitions
>
> After pulling in all the latest commits, I have the following suggestion regarding the use of the 'irqs' manifest properties:
>
> 1) Use the 'line_num' property unchanged within the 'tfm_core_irq_signals[]' structure array and as the third argument to tfm_irq_handler(). This is consistent with the PSA FF definition for this property: "line_num: A valid IRQ number for the platform"
>
> 2) When/if it is provided, use the 'line_name' property UNCHANGED as the name of the privileged IRQ handler functions. This is consistent with the PSA FF definition for this property: "line_name: A named IRQ, represented by a string identifier. The string identifier references an external definition, which is resolved in an IMPLEMENTATION DEFINED manner. This is helpful for implementations that do not wish to duplicate information already provided by an existing platform abstraction layer. The string identifiers are not defined in this specification and, as a result, are not portable"
>
> 3) Only if the 'line_name' property is NOT provided, derive the privileged IRQ handler function name by appending '_Handler' to the 'line_num' property.
>
> I achieved the above functionality by simply changing this logic in 'tfm_secure_irq_handlers_ipc.inc.template':
>
> {% if handler.line_num %}
> void irq_{{handler.line_num}}_Handler(void)
> {% elif handler.line_name %} void {{handler.line_name}}_Handler(void)
>
> To this:
>
> {% if handler.line_name %}
> void {{handler.line_name}}(void)
> {% elif handler.line_num %}
> void {{handler.line_num}}_Handler(void)
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
> Sent: Friday, July 19, 2019 1:36 PM
> To: Mate Toth-Pal
> Cc: tf-m(a)lists.trustedfirmware.org
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
>
> Mate,
>
> Thank you for your response. I discovered not long after I posted my inquiry that recent merges to master should resolve the problem I'm having. I'm in the process of pulling in those commits locally.
>
> Thanks again,
>
> Alan
>
> -----Original Message-----
> From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Mate Toth-Pal via TF-M
> Sent: Friday, July 19, 2019 1:22 PM
> To: TF-M(a)lists.trustedfirmware.org
> Cc: nd
> Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
>
> Hi Alan,
>
> I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
>
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
> This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
>
> Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
> This replaces the manually created IPC model signal definitions to the generated signals:
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
>
> This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
>
> This, and the related changes remove the manually created signal files.
> https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
>
> So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
>
> As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
>
> Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
>
> Regards,
> Mate
>
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
> Sent: 19 July 2019 18:35
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] including platform specific interrupt definitions
>
> I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
>
> What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
>
> Alan
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
After pulling in all the latest commits, I have the following suggestion regarding the use of the 'irqs' manifest properties:
1) Use the 'line_num' property unchanged within the 'tfm_core_irq_signals[]' structure array and as the third argument to tfm_irq_handler(). This is consistent with the PSA FF definition for this property: "line_num: A valid IRQ number for the platform"
2) When/if it is provided, use the 'line_name' property UNCHANGED as the name of the privileged IRQ handler functions. This is consistent with the PSA FF definition for this property: "line_name: A named IRQ, represented by a string identifier. The string identifier references an external definition, which is resolved in an IMPLEMENTATION DEFINED manner. This is helpful for implementations that do not wish to duplicate information already provided by an existing platform abstraction layer. The string identifiers are not defined in this specification and, as a result, are not portable"
3) Only if the 'line_name' property is NOT provided, derive the privileged IRQ handler function name by appending '_Handler' to the 'line_num' property.
I achieved the above functionality by simply changing this logic in 'tfm_secure_irq_handlers_ipc.inc.template':
{% if handler.line_num %}
void irq_{{handler.line_num}}_Handler(void)
{% elif handler.line_name %}
void {{handler.line_name}}_Handler(void)
To this:
{% if handler.line_name %}
void {{handler.line_name}}(void)
{% elif handler.line_num %}
void {{handler.line_num}}_Handler(void)
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
Sent: Friday, July 19, 2019 1:36 PM
To: Mate Toth-Pal
Cc: tf-m(a)lists.trustedfirmware.org
Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
Mate,
Thank you for your response. I discovered not long after I posted my inquiry that recent merges to master should resolve the problem I'm having. I'm in the process of pulling in those commits locally.
Thanks again,
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Mate Toth-Pal via TF-M
Sent: Friday, July 19, 2019 1:22 PM
To: TF-M(a)lists.trustedfirmware.org
Cc: nd
Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
Hi Alan,
I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
This replaces the manually created IPC model signal definitions to the generated signals:
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
This, and the related changes remove the manually created signal files.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
Sent: 19 July 2019 18:35
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] including platform specific interrupt definitions
I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
Alan
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
I'm going to merge the multi-core topology improvement patches on feature-twincpu branch on Thursday.
Could you please help review the following patches from https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 to https://review.trustedfirmware.org/c/trusted-firmware-m/+/1603/2?
Please let me know if there is any issue or improper modification to single Armv8-M scenario. I'd like to fix conflict as much as possible before merging feature-twincpu back to master branch, which may bring a lot of inconvenience to master branch development.
Thank you.
Best regards,
Hu Ziji
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of David Hu (Arm Technology China) via TF-M
Sent: Monday, July 22, 2019 6:57 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: Hao Chuan Chu <charley.chu(a)cypress.com>; nd <nd(a)arm.com>; Andrei Narkevitch <Andrei.Narkevitch(a)cypress.com>; Alamy Liu <Alamy.Liu(a)cypress.com>
Subject: [TF-M] Please review multi-core TF-M topology improvement patches
Sorry. Switch into plain text and correct the bad format. Something was wrong with the Outlook.
Hi all,
Could you please take a look at the following patches to improve topology implementation on `feature-twincpu` branch?
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 ~ https://review.trustedfirmware.org/c/trusted-firmware-m/+/1549 and https://review.trustedfirmware.org/c/trusted-firmware-m/+/1603/
As you know, we are bringing up TF-M on multi-core topology platform. Currently, preprocessor directives TFM_MULTI_CORE_TOPOLOGY are used to comment/uncomment the functionalities here and there to fit different scenarios. It can work but makes code difficult to be understood or maintained, in both single Armv8-M and multi-core topologies.
The above patches try to eliminate multi-core directives from common sequence and functions shared by single Armv8-M and multi-core topologies. It is expected to not only improve the code readability, but also protect one topology from being affected by changes to another.
Although those changes are for twincpu feature branch, I'd like to ask for review and comment since they also impact the single Armv8-M scenario. Merging feature-twincpu branch back to master would be more smooth if we can figure out and fix issues now on `feature-twincpu`.
I'd like to summarize the common basic ideas of the topology implementation.
1. If single Armv8-M and multi-core topology both call the same API but require different implementations
a. If that API can be classified to a specific functionality/module, separate the implementations into topology exclusive files.
Take https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 as an example. Add multi-core specific NS Client ID implementations in tfm_multi_core.c. Thus multi-core topology doesn't rely on the single Armv8-M implementations in tfm_nspm.c.
Then all the multi-core directives can be removed from tfm_nspm.c and tfm_nspm.c can be clearly excluded from multi-core topology build.
b. If that API don't belong to a specific functionality/module, extract it out and organize the implementations in topology abstraction file.
For example, in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1545, tfm_core_topology_set_pendsv_priority() is defined to wrap the PendSV settings in diverse topologies. The implementations are selected according to current topology in tfm_core_topology.h.
It help maintain a more clear and uniform sequence by removing multi-core directives from tfm_core.c.
2. In common sequence, if an API is called in single Armv8-M but not used in multi-core topology, add an empty function for this API in multi-core topology in the header file and vice versa.
For example, secure core in multi-core topology doesn't need to configure_ns_code().
As show in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1543, instead of placing several multi-core directives in tfm_core.c, move configure_ns_code() implementation to tfm_nspm.c and define an empty function in header file tfm_nspm.h in multi-core topology for configure_ns_code().
Any comment or suggestion is welcome. Please kindly let me know if the above changes may cause troubles in single Armv8-M scenario.
Thank you.
Best regards,
Hu Ziji
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
Can you share us your usage details? This could help us on defining the svc number things you mentioned.
Thanks.
-Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars,
> Alan via TF-M
> Sent: Friday, July 26, 2019 6:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] Adding a platform specific tfm_svc_number_t
>
> I need to define platform specific SPM APIs that will be invoked by our SPs.
>
> Is there a convention for 'cleanly' adding platform specific SVC enumerations to
> the tfm_svc_number_t typedef in tfm_svc.h as well as platform specific 'case's
> to SVCHandler_main() and/or SVC_Handler_IPC()?
>
> Alan
>
>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
I found four additional code points in tfm_svcalls.c that needed to be enhanced to handle msg.type >= PSA_IPC_CALL.
3 of the four were like this:
if (msg->msg.type != PSA_IPC_CALL) {
Which I changed to:
if (msg->msg.type < PSA_IPC_CALL) {
The 4th occurrence was in the switch statement within 'tfm_svcall_psa_reply()'.
I moved the 'case PSA_IPC_CALL:' logic into the default block and surrounded it with:
if (msg->msg.type >= PSA_IPC_CALL) {
...
}
else {
tfm_panic();
}
With these changes in place, the new psa_call() 'type' argument appears to make its way peacefully and effectively through the plumbing.
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
Sent: Friday, July 26, 2019 2:28 PM
To: Ken Liu (Arm Technology China)
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
In order to pass along the new ‘type’ argument in psa_call, it seems that this line in tfm_svcalls.c:
msg = tfm_spm_create_msg(service, handle, PSA_IPC_CALL, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Should be:
msg = tfm_spm_create_msg(service, handle, type, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Otherwise the receiving SP will always see msg.type == PSA_IPC_CALL.
Alan
From: Summer-ARM (Summer Qin) [mailto:noreply@developer.trustedfirmware.org]
Sent: Thursday, July 25, 2019 7:14 PM
To: DeMars, Alan
Subject: [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
Summer-ARM closed this task as "Resolved".
TASK DETAIL
https://developer.trustedfirmware.org/T435
EMAIL PREFERENCES
https://developer.trustedfirmware.org/settings/panel/emailpreferences/
To: Summer-ARM
Cc: edison-ai, matetothpal, adeaarm, wmnt, ashutoshksingh, KenLSoft, Summer-ARM, akiannillo, ademars, zhengwang721, BabaYB, karl-zh, shebuk, zbh, qixiang, DarshpreetSabharwal, jamesking1, mmorenobarm, abhishek-pandit
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
I found several other code points in tfm_svcalls.c that need to be enhanced to handle 'type' >= PSA_IPC_CALL.
Attached is my modified tfm_svcalls.c file. With these modifications, the 'type' argument makes its way through the system without causing tfm_panic() to be invoked.
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of DeMars, Alan via TF-M
Sent: Friday, July 26, 2019 2:28 PM
To: Ken Liu (Arm Technology China)
Cc: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
In order to pass along the new ‘type’ argument in psa_call, it seems that this line in tfm_svcalls.c:
msg = tfm_spm_create_msg(service, handle, PSA_IPC_CALL, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Should be:
msg = tfm_spm_create_msg(service, handle, type, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Otherwise the receiving SP will always see msg.type == PSA_IPC_CALL.
Alan
From: Summer-ARM (Summer Qin) [mailto:noreply@developer.trustedfirmware.org]
Sent: Thursday, July 25, 2019 7:14 PM
To: DeMars, Alan
Subject: [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
Summer-ARM closed this task as "Resolved".
TASK DETAIL
https://developer.trustedfirmware.org/T435
EMAIL PREFERENCES
https://developer.trustedfirmware.org/settings/panel/emailpreferences/
To: Summer-ARM
Cc: edison-ai, matetothpal, adeaarm, wmnt, ashutoshksingh, KenLSoft, Summer-ARM, akiannillo, ademars, zhengwang721, BabaYB, karl-zh, shebuk, zbh, qixiang, DarshpreetSabharwal, jamesking1, mmorenobarm, abhishek-pandit
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
In order to pass along the new ‘type’ argument in psa_call, it seems that this line in tfm_svcalls.c:
msg = tfm_spm_create_msg(service, handle, PSA_IPC_CALL, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Should be:
msg = tfm_spm_create_msg(service, handle, type, ns_caller, invecs,
in_num, outvecs, out_num, outptr);
Otherwise the receiving SP will always see msg.type == PSA_IPC_CALL.
Alan
From: Summer-ARM (Summer Qin) [mailto:noreply@developer.trustedfirmware.org]
Sent: Thursday, July 25, 2019 7:14 PM
To: DeMars, Alan
Subject: [EXTERNAL] [Maniphest] [Closed] T435: PSA APIs alignment
Summer-ARM closed this task as "Resolved".
TASK DETAIL
https://developer.trustedfirmware.org/T435
EMAIL PREFERENCES
https://developer.trustedfirmware.org/settings/panel/emailpreferences/
To: Summer-ARM
Cc: edison-ai, matetothpal, adeaarm, wmnt, ashutoshksingh, KenLSoft, Summer-ARM, akiannillo, ademars, zhengwang721, BabaYB, karl-zh, shebuk, zbh, qixiang, DarshpreetSabharwal, jamesking1, mmorenobarm, abhishek-pandit
Hi,
There are a series of patches under "remove_isolation_level_3" topic: https://review.trustedfirmware.org/#/q/topic:remove_isolation_level_3+(stat… aim to remove isolation level 3 (TFM_LVL=3) from the library model.
These patches will not affect curent isolation level 1 and level 2 for both library model and IPC model.
Please help to review them and give comments if you find any problems or anywhere need to enhancement.
Thanks,
Edison
Just another use-case,
FreeRTOS is using the non-secure SVC. It does not expect that it may be used by somebody else (not RTOS).
Ideally, if TFM will not occupy SVC.
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu (Arm Technology China) via TF-M
Sent: Friday, July 26, 2019 3:49 AM
To: DeMars, Alan <ademars(a)ti.com>; tf-m(a)lists.trustedfirmware.org
Cc: nd <nd(a)arm.com>
Subject: Re: [TF-M] Adding a platform specific tfm_svc_number_t
Hi Alan,
Can you share us your usage details? This could help us on defining the svc number things you mentioned.
Thanks.
-Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> DeMars, Alan via TF-M
> Sent: Friday, July 26, 2019 6:59 AM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] Adding a platform specific tfm_svc_number_t
>
> I need to define platform specific SPM APIs that will be invoked by our SPs.
>
> Is there a convention for 'cleanly' adding platform specific SVC
> enumerations to the tfm_svc_number_t typedef in tfm_svc.h as well as
> platform specific 'case's to SVCHandler_main() and/or SVC_Handler_IPC()?
>
> Alan
>
>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.trustedfirmware.org%2Fmailman%2Flistinfo%2Ftf-m&data=02%7C01%7Ca
> ndrey.butok%40nxp.com%7C42c1df29f3b84ac62f5708d7116b749e%7C686ea1d3bc2
> b4c6fa92cd99c5c301635%7C0%7C0%7C636997025530401902&sdata=vO0tq34jt
> zFFn9D3cnrDP3a4fnrkq4h5jvzZmob2HnU%3D&reserved=0
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
I need to define platform specific SPM APIs that will be invoked by our SPs.
Is there a convention for 'cleanly' adding platform specific SVC enumerations to the tfm_svc_number_t typedef in tfm_svc.h as well as platform specific 'case's to SVCHandler_main() and/or SVC_Handler_IPC()?
Alan
When do you anticipate that this patch will be merged to master?
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Ken Liu (Arm Technology China) via TF-M
Sent: Tuesday, July 23, 2019 11:17 PM
To: tf-m(a)lists.trustedfirmware.org
Cc: nd
Subject: [EXTERNAL] [TF-M] PSA API prototype update
Hi,
A patch is pushed for couple of days reveals the update on PSA API prototype and its related caller change:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1572
The most obvious part is a new parameter member 'type' is introduced in 'psa_call'. This is the first step of our upgrading to the latest PSA Firmware Framework Specification. The API internal behavior would come step by step later and now we can call PSA FF API in 1.0.0 prototypes.
The callers included in TF-M has been updated in this patch. Developers who developed extra services should mention this change and update PSA API related sources.
Any feedback please comment under the patch, or reply to this mail thread.
Thanks.
-Ken
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi,
A patch is pushed for couple of days reveals the update on PSA API prototype and its related caller change:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1572
The most obvious part is a new parameter member 'type' is introduced in 'psa_call'. This is the first step of our upgrading to the latest PSA Firmware Framework Specification. The API internal behavior would come step by step later and now we can call PSA FF API in 1.0.0 prototypes.
The callers included in TF-M has been updated in this patch. Developers who developed extra services should mention this change and update PSA API related sources.
Any feedback please comment under the patch, or reply to this mail thread.
Thanks.
-Ken
Hi all,
As you may be aware, implementing the PSA Internal Trusted Storage (ITS) APIs is on the TF-M roadmap for this quarter (https://developer.trustedfirmware.org/w/tf_m/planning/). We plan to implement these APIs with a new TF-M Internal Trusted Storage service.
The design proposal for the new TF-M ITS service is now available for design review here: https://review.trustedfirmware.org/c/trusted-firmware-m/+/1604 . The design is currently in "draft" state, which means further refinements are to be expected, and feedback is welcome.
For more information about the PSA ITS APIs themselves, the PSA Storage API document may be downloaded from here: https://pages.arm.com/PSA-APIs
Kind regards,
Jamie
Sorry. Switch into plain text and correct the bad format. Something was wrong with the Outlook.
Hi all,
Could you please take a look at the following patches to improve topology implementation on `feature-twincpu` branch?
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 ~ https://review.trustedfirmware.org/c/trusted-firmware-m/+/1549 and https://review.trustedfirmware.org/c/trusted-firmware-m/+/1603/
As you know, we are bringing up TF-M on multi-core topology platform. Currently, preprocessor directives TFM_MULTI_CORE_TOPOLOGY are used to comment/uncomment the functionalities here and there to fit different scenarios. It can work but makes code difficult to be understood or maintained, in both single Armv8-M and multi-core topologies.
The above patches try to eliminate multi-core directives from common sequence and functions shared by single Armv8-M and multi-core topologies. It is expected to not only improve the code readability, but also protect one topology from being affected by changes to another.
Although those changes are for twincpu feature branch, I'd like to ask for review and comment since they also impact the single Armv8-M scenario. Merging feature-twincpu branch back to master would be more smooth if we can figure out and fix issues now on `feature-twincpu`.
I'd like to summarize the common basic ideas of the topology implementation.
1. If single Armv8-M and multi-core topology both call the same API but require different implementations
a. If that API can be classified to a specific functionality/module, separate the implementations into topology exclusive files.
Take https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 as an example. Add multi-core specific NS Client ID implementations in tfm_multi_core.c. Thus multi-core topology doesn't rely on the single Armv8-M implementations in tfm_nspm.c.
Then all the multi-core directives can be removed from tfm_nspm.c and tfm_nspm.c can be clearly excluded from multi-core topology build.
b. If that API don't belong to a specific functionality/module, extract it out and organize the implementations in topology abstraction file.
For example, in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1545, tfm_core_topology_set_pendsv_priority() is defined to wrap the PendSV settings in diverse topologies. The implementations are selected according to current topology in tfm_core_topology.h.
It help maintain a more clear and uniform sequence by removing multi-core directives from tfm_core.c.
2. In common sequence, if an API is called in single Armv8-M but not used in multi-core topology, add an empty function for this API in multi-core topology in the header file and vice versa.
For example, secure core in multi-core topology doesn't need to configure_ns_code().
As show in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1543, instead of placing several multi-core directives in tfm_core.c, move configure_ns_code() implementation to tfm_nspm.c and define an empty function in header file tfm_nspm.h in multi-core topology for configure_ns_code().
Any comment or suggestion is welcome. Please kindly let me know if the above changes may cause troubles in single Armv8-M scenario.
Thank you.
Best regards,
Hu Ziji
Hi all,
Could you please take a look at the following patches to improve topology implementation on `feature-twincpu` branch?
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 ~ https://review.trustedfirmware.org/c/trusted-firmware-m/+/1549 and https://review.trustedfirmware.org/c/trusted-firmware-m/+/1603/
As you know, we are bringing up TF-M on multi-core topology platform. Currently, preprocessor directives TFM_MULTI_CORE_TOPOLOGY are used to comment/uncomment the functionalities here and there to fit different scenarios. It can work but makes code difficult to be understood or maintained, in both single Armv8-M and multi-core topologies.
The above patches try to eliminate multi-core directives from common sequence and functions shared by single Armv8-M and multi-core topologies. It is expected to not only improve the code readability, but also protect one topology from being affected by changes to another.
Although those changes are for twincpu feature branch, I'd like to ask for review and comment since they also impact the single Armv8-M scenario. Merging feature-twincpu branch back to master would be more smooth if we can figure out and fix issues now on `feature-twincpu`.
I'd like to summarize the common basic ideas of the topology implementation.
1. If single Armv8-M and multi-core topology both call the same API but require different implementations
* If that API can be classified to a specific functionality/module, separate the implementations into topology exclusive files.
Take https://review.trustedfirmware.org/c/trusted-firmware-m/+/1542 as an example. Add multi-core specific NS Client ID implementations in tfm_multi_core.c. Thus multi-core topology doesn't rely on the single Armv8-M implementations in tfm_nspm.c.
Then all the multi-core directives can be removed from tfm_nspm.c and tfm_nspm.c can be clearly excluded from multi-core topology build.
* If that API don't belong to a specific functionality/module, extract it out and organize the implementations in topology abstraction file.
For example, in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1545, tfm_core_topology_set_pendsv_priority() is defined to wrap the PendSV settings in diverse topologies. The implementations are selected according to current topology in tfm_core_topology.h.
It help maintain a more clear and uniform sequence by removing multi-core directives from tfm_core.c.
1. In common sequence, if an API is called in single Armv8-M but not used in multi-core topology, add an empty function for this API in multi-core topology in the header file and vice versa.
For example, secure core in multi-core topology doesn't need to configure_ns_code().
As show in https://review.trustedfirmware.org/c/trusted-firmware-m/+/1543, instead of placing several multi-core directives in tfm_core.c, move configure_ns_code() implementation to tfm_nspm.c and define an empty function in header file tfm_nspm.h in multi-core topology for configure_ns_code().
Any comment or suggestion is welcome. Please kindly let me know if the above changes may cause troubles in single Armv8-M scenario.
Thank you.
Best regards,
Hu Ziji
Hi,
The hotfix has been merged.
/Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Ken Liu
> (Arm Technology China) via TF-M
> Sent: Monday, July 22, 2019 4:37 PM
> To: tf-m(a)lists.trustedfirmware.org
> Cc: nd <nd(a)arm.com>
> Subject: [TF-M] Hotfix for auto-merge caused build error
>
> Hi,
> The gerrit merge with auto rebase on this patch caused the function type change
> and a build error is generated:
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1560
>
> A hotfix is on the way for fixing this:
> https://review.trustedfirmware.org/c/trusted-firmware-m/+/1602
>
> Sorry for the troublesome.
>
> /Ken
>
>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi all,
Could you please help review the design of TF-M memory access check in multi-core topology on https://review.trustedfirmware.org/c/trusted-firmware-m/+/1601 ?
Since CMSE support is likely to be unavailable on multi-core platforms, that design proposes a general memory access check process for multi-core topology and corresponding HAL APIs to retrieve platform specific memory attribute configurations.
Any comment would be gratefully received. If this design may not work in certain use cases, it would be very helpful if you can let me know the details.
Thank you.
Best regards,
Hu Ziji
Mate,
Thank you for your response. I discovered not long after I posted my inquiry that recent merges to master should resolve the problem I'm having. I'm in the process of pulling in those commits locally.
Thanks again,
Alan
-----Original Message-----
From: TF-M [mailto:tf-m-bounces@lists.trustedfirmware.org] On Behalf Of Mate Toth-Pal via TF-M
Sent: Friday, July 19, 2019 1:22 PM
To: TF-M(a)lists.trustedfirmware.org
Cc: nd
Subject: [EXTERNAL] Re: [TF-M] including platform specific interrupt definitions
Hi Alan,
I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
This replaces the manually created IPC model signal definitions to the generated signals:
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
This, and the related changes remove the manually created signal files.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
Sent: 19 July 2019 18:35
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] including platform specific interrupt definitions
I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
Alan
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Hi Alan,
I'm not sure on what version of TF-M is your base. This part of TF-M changed recently.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1354/
This change introduced the generated manifest header files. For each partition a header file is generated, which contains the signals for the partition. Both IRQ signals, and normal signals in case of IPC mode.
Up to the following change all the signals (except for IRQ) had to be defined manually in a header file tfm_spm_signal_defs.h.
This replaces the manually created IPC model signal definitions to the generated signals:
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1356/
This does the same to the IRQ signals (up until this change, IRQ signals had to be defined in tfm_irq_signal_defs.h):
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1589/
This, and the related changes remove the manually created signal files.
https://review.trustedfirmware.org/#/c/trusted-firmware-m/+/1382/
So depending on your base you either need to manually define the signals, or should have it automatically once the generator script is run.
As a general advice I would suggest to look at the IRQ signal 'SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ' which is the IRQ signal for one of the test services, and see where it appears and compare it to yours.
Also if you could publish some of your code in the gerrit, we might be able help to find out what is the problem.
Regards,
Mate
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars, Alan via TF-M
Sent: 19 July 2019 18:35
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] including platform specific interrupt definitions
I'm trying to add s secure interrupt to my secure partition manifest but am getting a compile error because there are no definitions of my secure interrupt IRQ name and SIGNAL name.
What is the mechanism for including a platform-specific header that defines platform specific interrupts when compiling "secure_fw/core/ipc/tfm_svcalls.c"?
Alan
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m