Skip to content
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

Musca B1/S1: memory layout headers out of date #14762

Closed
LDong-Arm opened this issue Jun 10, 2021 · 2 comments · Fixed by #15050
Closed

Musca B1/S1: memory layout headers out of date #14762

LDong-Arm opened this issue Jun 10, 2021 · 2 comments · Fixed by #15050

Comments

@LDong-Arm
Copy link
Contributor

Description of defect

The headers flash_layout.h and region_defs.h for TF-M targets are directly imported from the trusted-firmware-m repository and should be upgraded along with TF-M. But they are currently one version behind (v1.2 instead of v1.3) for Musca B1 and two versions behind (v1.1) for Musca S1 in Mbed OS. The TF-M project has already changed parts of the layout.

It happened, because both files are not covered by the mbed-os-tf-m-regression-test's import script. We left them out because of a workaround for the passing of the BL2 macro to ARMC6, as explain in 0ccf4db.

So we need to update those files to those from the latest release (TF-M v1.3 at the time of writing). It would be better to find a permanent solution to not need the BL2 workaround, so we can add them to the import script.

Target(s) affected by this defect ?

ARM_MUSCA_S1
ARM_MUSCA_B1

Toolchain(s) (name and version) displaying this defect ?

N/A

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.11.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

N/A

How is this defect reproduced ?

Check the git histories of the files (linked above).

@hazzlim
Copy link
Contributor

hazzlim commented Aug 6, 2021

Permanent solution (passing macros to armlink using --predefine="<MACRO>") requires changes to frozen /tools.
This can be picked up following TF-M v1.4.0 upgrade, at which point BL2 macro workaround will need to be added to upgraded headers.

@LDong-Arm
Copy link
Contributor Author

LDong-Arm commented Aug 23, 2021

Even though the BL2 workaround is still needed because of frozen tools, I think there's a better one.
Hardcoding it in region_defs.h prevents us from using our automated script to import this from from the trusted-firmware-m repo, which is why the headers became outdated. We should instead hardcode this macro in linker scripts that include this header, allowing the header itself to be unmodified and automatically importable. The linker scripts themselves are specific to Mbed OS only and permanent.

Anyway, we'll make this change during the TF-M v1.4.0 upgrade.

rwalton-arm added a commit to rwalton-arm/mbed-os that referenced this issue Sep 14, 2021
We worked around an issue with mbed-cli1 not recognising the BL2 macro
from targets.json by adding patched versions of region_defs.h and
flash_layout.h for ARM_MUSCA targets. In the patched headers we defined
the BL2 macro to ensure it can be picked up by the ARM scatter files
that include the headers.

The current solution is not robust, because it means that the
aforementioned headers easily become out of date. A workaround of
defining the macros in the scatter files which need them was suggested
in ARMmbed#14762

This commit applies the suggested changes to the ARM_MUSCA scatter
files.
@rwalton-arm rwalton-arm linked a pull request Sep 14, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants