Skip to content

LPC55S69_NS: Fix baremetal compilation error #11978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/TARGET_PSA/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "psa"
"name": "psa",
"config": {
"present": 1
Copy link
Contributor

@Patater Patater Nov 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this new present or could we use #ifdef TARGET_PSA?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro you mentioned is always present for a given target that supports PSA regardless of whether we build with or without baremetal as it is a property of the target.

What is added in this PR is to indicate the presence of the PSA library.

TARGET_PSA = Target supports PSA
MBED_CONF_PSA_PRESENT = The PSA library is included in the build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not include PSA in bare metal? I don't see how this target is very useful without PSA.

Copy link
Collaborator Author

@hugueskamba hugueskamba Nov 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the baremetal documentation, (see PR description) PSA is not currently included in baremetal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to mbedtls, we should review these and fix in the next release if possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for PSA is not a specification, but just explanation of current state of things. I don't see anything preventing us having PSA in bare metal mode. Will this even work without the secure image present? Maybe it makes more sense to not build PSA targets in bare metal for now?
@maclobdell @mmahadevan108

Copy link
Contributor

@evedon evedon Nov 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare metal mode is enabled by using "requires": ["bare-metal"] and this turns the build system into an "opt-in" build system i.e. any library needed by the application needs to be listed in requires. So there is probably nothing that prevents a PSA target to run in bare metal mode but it does not work out-of-the-box. Until we fix this and have a proper "bare metal mode" then we need to guard PSA code with a flag like MBED_CONF_PSA_PRESENT

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

#if MBED_CONF_PSA_PRESENT

#include "cmsis_nvic_virtual.h"
#include "mbed_toolchain.h"

Expand All @@ -25,3 +27,5 @@ void __NVIC_TFMSystemReset(void)
{
mbed_psa_system_reset();
}

#endif // MBED_CONF_PSA_PRESENT
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@ extern "C" {
#define NVIC_GetActive __NVIC_GetActive
#define NVIC_SetPriority __NVIC_SetPriority
#define NVIC_GetPriority __NVIC_GetPriority
#if MBED_CONF_PSA_PRESENT
#define NVIC_SystemReset __NVIC_TFMSystemReset
#else
#define NVIC_SystemReset __NVIC_SystemReset
#endif // MBED_CONF_PSA_PRESENT


#if MBED_CONF_PSA_PRESENT
/**
* \brief Overriding the default CMSIS system reset implementation by calling
* secure TFM service.
*
*/
void __NVIC_TFMSystemReset(void);

#endif // MBED_CONF_PSA_PRESENT

#ifdef __cplusplus
}
#endif
Expand Down