Skip to content

Added documentation for using ARM Compiler 5 with 5.12 release #999

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
36 changes: 36 additions & 0 deletions docs/tools/tools_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,39 @@ For more information, please see the [Online Compiler page](developing-mbed-onli

You can export your project from any of our tools to third party tools. For instructions, as well as tool-specific information, see [the Exporting to third party toolchains page](exporting.html).

#### Forcing compilation with ARM Compiler 5 for targets already supporting ARM Compiler 6
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this a note and shorten it?

Maybe something like:

Note: We encourage you to switch to Arm Compiler 6 soon because we will deprecate Arm Compiler 5 support in the future. However, if you need to update to Mbed OS 5.12 but still require compiling with Arm Compiler 5 until you are in possession of Arm Compiler 6, we provide methods to override the Arm toolchain version. If you do this, your target may not be able to compile with Arm Compiler 5, or you may see undefined behaviors.

To force Arm Compiler 5, you can use the following options:

  • Create or update your mbed_app.json with:
{
  "target_overrides": {
      "*": {
          "target.supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"]
      }
  }
}
  • Modify the supported_toolchains entry in targets.json to replace all ARM, ARMC6 entries with ARMC5:
"MY_TARGET_NAME": {
        "supported_form_factors": [...],
        "core": "Cortex-M4",
        "supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"],
        ...
}

Copy link
Contributor

Choose a reason for hiding this comment

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

See my comment below about targets.json modifications. I think that bit may need to move to target porting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ChiefBureaucraticOfficer @screamerbg - Please review if the shortened note of the content provided by @AnotherButler above works.

@theotherjimmy - I don't think this belongs in porting section just because we refer targets.json. Also it makes hard to find if its in porting section as this would be the page most people would land on to find compiler info.

Copy link

@TeroJaasko TeroJaasko Mar 14, 2019

Choose a reason for hiding this comment

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

Should a modification above to mbed_app.json be enough? Just testing mbed-os-example-blinky with that on mbed OS master (b80c961da) and it still fails to build on ARMC5.

mbed compile -m K64F -t ARMC5
<..>
make.py: error: argument -t/--tool: ARMC5 is not a supported toolchain. Supported toolchains are:
ARM,     ARMC6,   GCC_ARM, IAR,     uARM     
[mbed] ERROR: "/usr/bin/python" returned error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TeroJaasko - Yes, please follow the changes as mentioned here to enable ARMC5 and try. By the way "-t ARMC5" is an invalid option. After adding ARMC5 to supported_toolchains you should still do "-t ARM". Please let me know if you need help with making the changes.

Choose a reason for hiding this comment

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

I already copied the "target.supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"] to mbed_app.json and the results are no better with "-t ARM".

mbed compile -m K64F -t ARM
<..>
make.py: error: Could not find executable for ARMC6.

Diff on mbed-os-example-blinky:

mbed-os-example-blinky$ git diff
diff --git i/mbed_app.json w/mbed_app.json
index 3b191ff..c106c06 100644
--- i/mbed_app.json
+++ w/mbed_app.json
@@ -1,6 +1,7 @@
 {
     "target_overrides": {
         "*": {
+            "target.supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"],
             "platform.stack-stats-enabled": true,
             "platform.heap-stats-enabled": true,
             "platform.cpu-stats-enabled": true,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TeroJaasko - Although we tested this in past, I tried the same thing again with the exact version you are using(b80c961da) and it appears to be working fine on my machine, and yes, the compilation works with ARMC5. And yet, I don't see anything wrong with what you are trying to do.

Copy link
Contributor Author

@SenRamakri SenRamakri Mar 14, 2019

Choose a reason for hiding this comment

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

I also tried the same on Ubuntu and that worked fine as well. So I wonder whats causing your failure :-(. One thing you can make sure is that you are in mbeb-os-example-blinky dir and not in mbed-os when doing mbed compile.

Choose a reason for hiding this comment

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

Have you tried removing ARMC6 from paths? I don't have ARMC6 at my paths by default, there are at least one ticket open where wrong compiler is used: ARMmbed/mbed-os#10069

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok, that makes sense if you dont have ARMC6 configured. I believe the tools would check for ARMC6 as in this PR ARMmbed/mbed-os#10044 , have you tried adding ARMC6 and see if that fixes the problem?


It's possible that some developers may need to update to Mbed 5.12 release but still requires compiling with ARM Compiler 5 until they are in possession of ARM Compiler 6.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a list of currently known targets that cannot be used with ARMC6 yet (IIRC.. PSoC6, KW24D, any others) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ashok-rao - I think we should not capture that list explicitly here as we plan to move the rest of the targets to ARMC6 soon, updating the list as each target gets moved into ARMC6 might be error-prone or we may miss it and docs also need re-publishing. Instead, the mbed_targets.md captures the fact that if the supported_toolchains contains ARMC5 the target uses ARMC5. In addition you can also list the toolchain support for targets using the command "mbed config -S" which is already documented.

In those cases, you may still be able to use ARM Compiler 5 depending on the target. If your target uses any ARM Compiler 6 specific binaries or code, then it may not
be able to compile with ARM Compiler 5 or you may see undefined behaviors. In other cases, if you want to try force ARM Compiler 5 you can do so with the following options:

##### By creating a mbed_app.json to override `supported_toolchains`

In this method, you can create or update your `mbed_app.json` with the following content. Note that you can still keep other entries such as `GCC_ARM` or `IAR` while overriding `supported_toolchains` as below.

```
{
"target_overrides": {
"*": {
"target.supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"]
}
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

I moved the porting content out in another PR: #1013


##### By local modifications to `targets.json`
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't recommend that applications modify Mbed OS elsewhere in the documentation. Perhaps this needs to be in a porting targets section instead.


In this method, you have to modify the `supported_toolchains` entry for your target in targets.json to remove all `ARM`, `ARMC6` entries and replace it with `ARMC5`. Note that you can still keep other entries such as `GCC_ARM` or `IAR`.

See below for example:
```
"MY_TARGET_NAME": {
"supported_form_factors": [...],
"core": "Cortex-M4",
"supported_toolchains": ["ARMC5", "GCC_ARM", "IAR"],
...
}
```

<span class="note"> **Note:** The above methods to override ARM toolchain version is made available only to enable developers migrating from ARM Compiler 5 to ARM Compiler 6. Future releases of Mbed OS may remove

Choose a reason for hiding this comment

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

Can this be rephrased to reflect the Product Management direction, e.g. "We encourage you to plan to make use of ARM Compiler 6 soon. We do plan to deprecate ARM Compiler 5 support in the future and this migration would ensure that your software is compatible with it."

Copy link

Choose a reason for hiding this comment

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

Agree with softening of tone, but still pressing the message.

this option and thus developers are strongly encouraged to move to ARM Compiler 6.</span>