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

Build tool fixes for Musca support #7792

Merged
merged 5 commits into from
Aug 28, 2018
Merged

Conversation

deepikabhavnani
Copy link

Description

Typos and minor fixes required to support Cortex-M33 devices. Support of M33 was not tested since we didn;t had any target. This PR will be tested internally with MUSCA.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Feature
[ ] Breaking change

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

LGTM, just some questions

self.flags['common'].append("-mcpu=%s" % target.core.lower())
self.flags['ld'].append("--cpu=%s" % target.core.lower())
self.SHEBANG += " -mcpu=%s" % target.core.lower()
if not target.core.startswith("Cortex-M23") and not target.core.startswith("Cortex-M33"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, so I take it building for the NS side no longer needs to be differentiated?

Copy link
Author

Choose a reason for hiding this comment

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

Differentiation is still there, here we are just not setting ‘-mcpu’ parameter for any of v8M device. If we set cpu as cortex-m33 in flags, compiler enables dsp as well which is optional. Hence we just set ‘-march’

Copy link
Contributor

Choose a reason for hiding this comment

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

Please collapse the

else:
    if: ...

into

elif:

@@ -256,8 +256,6 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
# Exec command
self.notify.cc_verbose("Link: %s" % ' '.join(cmd))
self.default_cmd(cmd)
if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this output no longer needed? (Commit only mentioned something about a build issue)

Copy link
Author

Choose a reason for hiding this comment

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

Code for creation of ‘secure_file’ was initially in this section and later moved to other part. Variable ‘secure_file’ is not available here and hence throws error

-mcpu option if set for v8M CPU;s it will add DSP feature as default
which is optional. Hence setting just the architecture for Cortex-M23
and Cortex-M33
As per the link below, options for clang and armlink are diferrent for Cortex-M33
armlink --cpu 8-M.Main --import-cmse-lib-out importlib_v1.o
armclang -march=armv8-m.main -mcmse

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0773h/pge1452794854109.html
@deepikabhavnani
Copy link
Author

deepikabhavnani commented Aug 16, 2018

Fix in 6366452 : Options for clang and armlink are diferrent for Cortex-M33

armlink --cpu 8-M.Main --import-cmse-lib-out importlib_v1.o
armclang -march=armv8-m.main -mcmse

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0773h/pge1452794854109.html

cc @gaborkertesz

@deepikabhavnani
Copy link
Author

@theotherjimmy - We have few issues while building ASM files. All the C flags are added to asm build, as a result .o generated is not correct.

Compile: C:\Program Files\ARMCompiler6.10\bin\armasm --cpu=8-M.Main --cpreproc --**cpreproc_opts=-c**,--target=arm-arm-none-eabi,-mthumb,-Os,-Wno-armcc-pragma-push-pop,-Wno-armcc-pragma-anon-unions,-DMULADDC_CANNOT_USE_R7,-fdata-sections,-fno-exceptions,-MMD,-D_LIBCPP_EXTERN_TEMPLATE(...)=,-D__STARTUP_COPY_MULTIPLE,-D__CORTEX_M33,-DMBED_FAULT_HANDLER_DISABLED,-D__MBED_CMSIS_RTOS_CM,-D__STARTUP_CLEAR_BSS,-D__CMSIS_RTOS,-DARM_MATH_ARMV8MML,-I.,-I.\mbed-os,-I.\mbed-os\cmsis,-I.\mbed-os\cmsis\TARGET_CORTEX_M,-I.\mbed-os\drivers,-I.\mbed-os\events,-I.\mbed-os\events\equeue,-I.\mbed-os\features,-I.\mbed-os\features\cellular,-I.\mbed-os\features\cellular\easy_cellular,

[DEBUG] Output: armclang.exe: warning: .\mbed-os\targets\TARGET_ARM_SSG\TARGET_MUSCA_A1\TOOLCHAIN_ARMC6\startup_cmsdk_musca.s: 'assembler' input unused [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-Wno-armcc-pragma-push-pop' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-Wno-armcc-pragma-anon-unions' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-D MULADDC_CANNOT_USE_R7' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-fdata-sections' [-Wunused-command-line-argument]
[DEBUG] Output: armclang.exe: warning: argument unused during compilation: '-fno-exceptions' [-Wunused-command-line-argument]

Resolved below warnings
Warning: L3912W: Option 'legacyalign' is deprecated.
Warning: L3912W: Option 'no_strict_wchar_size' is deprecated.
Warning: L3912W: Option 'no_strict_enum_size' is deprecated.
@deepikabhavnani
Copy link
Author

We have few issues while building ASM files. All the C flags are added to asm build, as a result .o generated is not correct.

Issue relate to ASM file build was related to assembly file extension ".s", and is resolved by updating it to be caps .S

@deepikabhavnani
Copy link
Author

@theotherjimmy @gaborkertesz - Please review

@gaborkertesz
Copy link
Contributor

Basic hello world example has been tested with armclang and gcc on Musca and working as expected as a secure only application.

@deepikabhavnani
Copy link
Author

@theotherjimmy @cmonr - Please review

self.flags['c'].append("-mcpu=cortex-m33+nodsp")
self.flags['c'].append("-mfpu=none")
self.flags['cxx'].append("-mcpu=cortex-m33+nodsp")
self.flags['cxx'].append("-mfpu=none")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be added to common?

Copy link
Author

Choose a reason for hiding this comment

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

Done 👍


if target.core == "Cortex-M23" or target.core == "Cortex-M33":
self.flags['common'].append("-mcmse")
self.flags['cxx'].append("-mcmse")
self.flags['c'].append("-mcmse")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be added to common?

Copy link
Author

Choose a reason for hiding this comment

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

This flag gives warning with linker and armasm.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 23, 2018

I got one question - removing those legacy flags from linker command - the warning is for ARMC6 only (can't be seen in ARMC5) ? This is safe to remove, no functionality change?

@deepikabhavnani
Copy link
Author

deepikabhavnani commented Aug 23, 2018

I got one question - removing those legacy flags from linker command

Legacy linker flags are not present for ARM 5 compiler,
https://github.com/ARMmbed/mbed-os/pull/7792/files#diff-84bdeb5b184eec3910a5d6a23df9ceccL35

I don;t see those flags even in history of ARM 5 compiler, @theotherjimmy - any idea why those flags were added for ARMC6.

This is safe to remove

Should be, as they have no impact. Deprecated as per this link http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0381b/CHDHCGGF.html

Change shared by @gabor Kertesz

Hard-fault on Musca was because of enabled floating point instructions,
disabling DSP and FPU.
@deepikabhavnani
Copy link
Author

@theotherjimmy - I also see below warning in detail build dumps, not sure what is causing this.

[DEBUG] Errors: warning: 'armv4t' is unsupported in this version of the product

@deepikabhavnani
Copy link
Author

Can we start the build for this PR?

@cmonr
Copy link
Contributor

cmonr commented Aug 27, 2018

Does #7792 (comment) not need to be addressed?

@deepikabhavnani
Copy link
Author

deepikabhavnani commented Aug 27, 2018

Does #7792 (comment) not need to be addressed?

Its warning, can be fixed later as well. Musca is dependent on this fix for now. Added issue to handle it later #7900

@cmonr
Copy link
Contributor

cmonr commented Aug 27, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Aug 27, 2018

Build : SUCCESS

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

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Aug 27, 2018

@mbed-ci
Copy link

mbed-ci commented Aug 28, 2018

@cmonr cmonr merged commit 14319ad into ARMmbed:master Aug 28, 2018
@0xc0170 0xc0170 removed the needs: CI label Aug 28, 2018
@cmonr cmonr removed the risk: G label Sep 2, 2018
@deepikabhavnani deepikabhavnani deleted the fix_m33 branch September 28, 2018 19:32
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.

None yet

6 participants