Skip to content

ARMC5+6: Specify CPU for ARM scatter file preprocessor #5797

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 5 commits into from
Feb 7, 2018

Conversation

hosse005
Copy link
Contributor

@hosse005 hosse005 commented Jan 5, 2018

Fixes #5796

Description

Fix for targets which include the c preprocessor in the ARM and ARMC6 scatter file.

Status

READY

Migrations

NO

Steps to test or reproduce

  1. Pull the mbed-os-example-blinky app
  2. Import the latest mbed-os (>= mbed-os-5.5.4)
  3. Compile with either the ARM or ARMC6 compiler and target the MultiTech xDot
    (e.g. mbed compile -t ARMC6 -m xdot_l151cc)
  4. Verify the app builds

@hosse005
Copy link
Contributor Author

hosse005 commented Jan 5, 2018

/cc @maclobdell

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@hosse005
Copy link
Contributor Author

hosse005 commented Jan 8, 2018

Looks like this is related to issue #5421 as well, but this solution is giving some problems with the k64f target saying ARM Compiler does not support '-mcpu=cortex-m4f' just for the arm 6 compiler. Maybe some additional string massaging needed here?

@theotherjimmy theotherjimmy changed the title ARM: ARMC6: Specify CPU for ARM scatter file preprocessor ARMC6: Specify CPU for ARM scatter file preprocessor Jan 8, 2018
@theotherjimmy theotherjimmy changed the title ARMC6: Specify CPU for ARM scatter file preprocessor ARMC5+6: Specify CPU for ARM scatter file preprocessor Jan 8, 2018
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2018

@hosse005
Copy link
Contributor Author

hosse005 commented Jan 8, 2018

@0xc0170 Yes, I just accepted

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 9, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2018

Build failed for one target, RZ_A1H, with the error [DEBUG] Errors: Error: L6636E: Pre-processor step failed for '/builds/ws/mbed-os-build-matrix/826/RZ_A1H_ARM/sources/mbed-os/BUILD/tests/RZ_A1H/ARM/./TESTS/netsocket/udp_echo/.link_script.sct' it complains about not finding a header file earlier in the log, can you please verify?

@hosse005
Copy link
Contributor Author

hosse005 commented Jan 9, 2018

My license doesn't allow me to compile for an A9, so my help maybe limited here. Are we sure this ci job doesn't fail without these changes? Maybe the "mem_RZ_A1H.h" file isn't being copied into the build directory along with the MBRZA1H.sct file?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 10, 2018

I could reproduce it. The same linker failure. Master is OK, it's only this branch.

        [DEBUG] Errors: Error: L6636E: Pre-processor step failed for 'mbed-os/BUILD/tests/RZ_A1H/ARM/./TESTS/mbedmicro-rtos-mbed/mutex/.link_script.sct'

This is the top of the link_script.sct

#! armcc -E --cpu=Cortex-A9
;**************************************************
; Copyright (c) 2017 ARM Ltd.  All rights reserved.
;**************************************************

; Scatter-file for RTX Example on Versatile Express

; This scatter-file places application code, data, stack and heap at suitable addresses in the memory map.

#include "mem_RZ_A1H.h"

The only change when I compare those 2 is --cpu flag that is being added here. In the build dir, the header file is there. Could this cpu flag affect include dirs? I checked include dirs that are in the build file, the path is there for that header (in the include paths). Also in the build dir, it is present.

Why this cpu flag is added to the linker script file and not into .profile-asm ? (the cpu flag for C is in the .profile-c file). Does not help thought with this, fails anyway the same way.

* Need to copy headers into the build directory as well when also
  writing an updated linker scatter file to the build directory
@hosse005
Copy link
Contributor Author

I was able to get a hold of an eval license so I could reproduce the issue. I don't think headers were getting copied over from the script source directory when we needed to update the scatter file shebang. I made some change which should address this issue.

@0xc0170 , I added the cpu arg to the scatter file shebang because this is where I was seeing compile errors coming from, and it seemed to be needed at least for ARMC6 according to the ARM compiler v5 -> v6 migration app note (http://www.keil.com/appnotes/files/apnt_298.pdf)

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 11, 2018

@0xc0170 , I added the cpu arg to the scatter file shebang because this is where I was seeing compile errors coming from, and it seemed to be needed at least for ARMC6 according to the ARM compiler v5 -> v6 migration app note (http://www.keil.com/appnotes/files/apnt_298.pdf)

👍 for the reference

I was able to get a hold of an eval license so I could reproduce the issue. I don't think headers were getting copied over from the script source directory when we needed to update the scatter file shebang. I made some change which should address this issue.

I was checking locally and to me the header files were there? I still have the build locally, BUILD\tests\RZ_A1H\ARM\targets\TARGET_RENESAS\TARGET_RZ_A1H\device\TOOLCHAIN_ARM_STD\ this is where mem_RZ_A1H header file is. What am I missing ?

@hosse005
Copy link
Contributor Author

Hmm.., @0xc0170 can you try to replicate my test setup? I am just building the mbed-os-example-blinky app with the ARM compiler targeting the RZ_A1H with the mbed-os changes in this PR. Without the last commit I see the same failures observed from the ci job logs, and with the last change it is resolved.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2018

I tested this fix with blinky , and also mutex test, both compiles on my machine.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

Build : SUCCESS

Build number : 848
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5797/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 23, 2018

@hosse005
Copy link
Contributor Author

I think abspath maybe needed here for the build machine as follows:
self.SHEBANG += " -I %s" % dirname(abspath(scatter_file))

@theotherjimmy , do you agree?

@theotherjimmy
Copy link
Contributor

@hosse005 I do not. When you export a project from the online compile, an absolute path will always be incorrect.

We will have to make the path relative to the project file location, so relpath(scatter_file, self.build_dir) may be necessary

@mbed-ci
Copy link

mbed-ci commented Jan 23, 2018

@hosse005
Copy link
Contributor Author

@theotherjimmy , I think just relpath(dirname(scatter_file)) should work. The linker isn't executing from the build directory directly so that failed for me, but the above code relative to the current working directory worked for me, just not sure about the build machine? Thought I would ask first before pushing it up.

@theotherjimmy
Copy link
Contributor

@hosse005 I don't think that relpath(dirname(scatter_file)) is an option either. When exporting in the online compiler, the tools are not executed from a project root, and projects do not have a single root. Instead, the tools are given a list of directories and where these directories will be in the final zip file. This makes changes like this one quite complicated.

@theotherjimmy
Copy link
Contributor

I think the "right solution" will have to be relpath(dirnname(scatter_file), resources.file_basepath[scatter_file]), and the resources object will have to be passed in.

@hosse005
Copy link
Contributor Author

@theotherjimmy , I may need some help with this one then, not sure how to do this.

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Jan 31, 2018

@hosse005 I think that'll do everything I need it to; offline, online export and online compile. Sorry that took so long.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 1, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 1, 2018

Build : SUCCESS

Build number : 1038
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5797/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Feb 1, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 1, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 1, 2018

Exporters fail as we saw earlier for Cortex A targets, please review

restarting uvisor

/morph uvisor-test

@orenc17
Copy link
Contributor

orenc17 commented Feb 1, 2018

/morph uvisor-test

@cmonr
Copy link
Contributor

cmonr commented Feb 3, 2018

Dunno why results aren't being shown. Rebuilding.

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 3, 2018

Build : SUCCESS

Build number : 1056
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5797/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Feb 3, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 3, 2018

@cmonr cmonr merged commit 779ee84 into ARMmbed:master Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants