Skip to content

NRF52840_DK: Fix baremetal linker error #12166

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 1 commit into from
Feb 14, 2020

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Dec 22, 2019

Summary of changes

Fixes #11428
Compile in the inclusion of cryptocell310 only if the library is included
in the build

Impact of changes

It is now possible to build MCU_NRF52840 targets with the baremetal profile.
i.e It is now possible to build mbed-os-example-blinky-baremetal with $ mbed compile -t <TOOLCHAIN> -m NRF52840_DK

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom
Copy link
Member

@hugueskamba, thank you for your changes.
@ARMmbed/mbed-os-crypto @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested review from a team December 23, 2019 00:00
Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Why is this necessary? Why isn't the FEATURE_CRYPTOCELL310 test that's already there sufficient?

Note that this change also makes the cryptocell "opt-in", as apps will now need requires: "cryptocell".

Not saying that this change is wrong, just not quite clear about it.

Is it the case that the cryptocell stuff doesn't compile bare-metal, so doing this takes it out, and then blinky works? Would requires: "cryptocell" break it again?

@bulislaw
Copy link
Member

Yeah I don't like to have double flag for hiding one thing. Is there something fundamentally stopping cryptocell working without RTOS? Answer "I don't know" is acceptable for now as we don't officially support TLS in baremetal, I would say would be ok to remove cryptocell from features in baremetal. I guess it could be done by the .lib we have in baremetal.

@hugueskamba
Copy link
Collaborator Author

hugueskamba commented Dec 23, 2019

Why is this necessary? Why isn't the FEATURE_CRYPTOCELL310 test that's already there sufficient?

Note that this change also makes the cryptocell "opt-in", as apps will now need requires: "cryptocell".

Not saying that this change is wrong, just not quite clear about it.

Is it the case that the cryptocell stuff doesn't compile bare-metal, so doing this takes it out, and then blinky works? Would requires: "cryptocell" break it again?

FEATURE_CRYPTOCELL31 is defined because the target is listed has supporting cryptocell in targets.json. What has been added is to check if the library is included in the build. A target can support a feature without using that feature as is the case with the bare metal profile. We have targets that support all kinds of features but not all the features are currently supported with the bare metal profile.
We do not modify the features that are supported by a target when using the bare metal. This PR clearly identifies the cryptocell lib and makes sure that the code that references it is included only if the library is present.

@kjbracey-arm Please see the impact of changes in the PR description. Without this PR it is not possible to build for that target using the bare metal profile.

@bulislaw
Copy link
Member

bulislaw commented Jan 2, 2020

As a quick fix maybe it would be better to not build cryptocell if we are in baremetal mode (without introducing new flags, but by testing the existing ones). Longer term I don't see why that shouldn't be possible.

@hugueskamba
Copy link
Collaborator Author

As a quick fix maybe it would be better to not build cryptocell if we are in baremetal mode (without introducing new flags, but by testing the existing ones). Longer term I don't see why that shouldn't be possible.

I am not sure there is an existing flag to use as the cryptocell code. The cryptocell code is not currently identified as a separate library.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 7, 2020

It was discussed previously here #11428 - this PR is a fix for this issue.

How do we remove tls for instance? The same could be applied to cryptocell ? Or do just need to remove this feature from the target itself and let an app to add it ?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2020

@hugueskamba Please review

@hugueskamba
Copy link
Collaborator Author

It was discussed previously here #11428 - this PR is a fix for this issue.

How do we remove tls for instance? The same could be applied to cryptocell ? Or do just need to remove this feature from the target itself and let an app to add it ?

From what I read in the GitHub issue, there was no proposed flag to use. Removing the feature was not seen as an option as it will also remove it for non-baremetal builds.

@hugueskamba hugueskamba force-pushed the hk-baremetal-NRF52840_DK-fix branch from ceb85fd to 89ecc81 Compare January 31, 2020 15:05
@0xc0170 0xc0170 requested review from kjbracey and bulislaw February 5, 2020 14:50
bulislaw
bulislaw previously approved these changes Feb 10, 2020
@mergify mergify bot added needs: CI and removed needs: review labels Feb 10, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 10, 2020

CI started

0xc0170
0xc0170 previously approved these changes Feb 10, 2020
@mergify mergify bot added needs: work and removed needs: CI labels Feb 10, 2020
@mbed-ci
Copy link

mbed-ci commented Feb 10, 2020

Test run: FAILED

Summary: 2 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

Compile in the inclusion of cryptocell310 only if the library is included
in the build
@hugueskamba hugueskamba force-pushed the hk-baremetal-NRF52840_DK-fix branch from 89ecc81 to 65fbee1 Compare February 10, 2020 15:18
@mergify mergify bot dismissed bulislaw’s stale review February 10, 2020 15:19

Pull request has been modified.

@mergify mergify bot dismissed 0xc0170’s stale review February 10, 2020 15:19

Pull request has been modified.

@hugueskamba
Copy link
Collaborator Author

Test run: FAILED

Summary: 2 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@0xc0170 ,
This force-push should fix it. Please re-start CI.
Thanks

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 10, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Feb 10, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 11, 2020

This shall be now ready and can go in today.

@0xc0170 0xc0170 added the release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 label Feb 14, 2020
@0xc0170 0xc0170 merged commit a8188bf into ARMmbed:master Feb 14, 2020
@hugueskamba hugueskamba deleted the hk-baremetal-NRF52840_DK-fix branch February 14, 2020 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NRF52480: baremetal build fails due to cryptocell dependency on mbedtls
6 participants