ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.66k stars 2.97k forks source link

TFM cannot be compiled with GCC 6 #10887

Closed jeromecoutant closed 4 years ago

jeromecoutant commented 5 years ago

Description

TFM cannot be compiled with GCC version 6: (GNU Tools for ARM Embedded Processors 6-2017-q2-update)

Compile [  4.2%]: tfm_nspm.c
C:\xxx\AppData\Local\Temp\cc353dof.s: Assembler messages:
C:\xxx\AppData\Local\Temp\cc353dof.s:566: Error: branch out of range
[DEBUG] Return: 1

Setting GCC version 7 solves the issue. (GNU Tools for Arm Embedded Processors 7-2018-q2-update)

Compile [  6.5%]: tfm_nspm.c
[DEBUG] Return: 0

Issue requested by @devran01 in order to follow the point.

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug
jeromecoutant commented 5 years ago

Reference: https://git.trustedfirmware.org/trusted-firmware-m.git/tree/docs/user_guides/tfm_sw_requirement.rst#n124

The currently supported compiler versions are:

ciarmcom commented 5 years ago

Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-1324

0xc0170 commented 5 years ago

Strange, should work according to the requirements but fails

arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]

6-2017-q2 - gcc 6.3.1.

@jeromecoutant is this issue also in the upstream repository or just ours (our import issue) ?

jeromecoutant commented 5 years ago

Hi I have only mbed environment, I don't have any "pure" TFM.

Patater commented 5 years ago

Looking at the latest version of tfm_nspm.c in TF-M upstream, there are only minor differences with what we have in Mbed OS. I don't see why this problem wouldn't also exist in upstream TF-M.

Please raise an issue at https://developer.trustedfirmware.org

jeromecoutant commented 5 years ago

Please raise an issue at https://developer.trustedfirmware.org

I can't know if compile issue comes from MBED port or if it is pure TFM So, I will not raise any ticket... And to be honest, GCC6 issue is a bit outdated...

urutva commented 5 years ago

Hi @jeromecoutant, @Patater and I looked into this issue and it is a GCC6.3 compiler issue. It looks like the compiler is generating a branch instruction before expanding CMSE related instructions which is causing the assembler to fail with "branch out of range". We'd recommend switching to GCC7 or higher while compiling the secure side.

kjbracey commented 4 years ago

I believe this can be closed - we now use GCC 9.