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

Feature: Make changes for Cortex-A5 support #14718

Merged
merged 5 commits into from
Jul 1, 2021
Merged

Conversation

Meano
Copy link
Contributor

@Meano Meano commented Jun 1, 2021

Summary of changes

It's a PR that add Cortex-A5 support for mbed-os custom targets.
Unify some __CORTEX_A macros.
__MBED_CMSIS_RTOS_CM and __MBED_CMSIS_RTOS_CA9 have been removed from CMake as they're not used anymore.

Impact of changes

Migration actions required

Documentation

None


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom
Copy link
Member

ciarmcom commented Jun 1, 2021

@Meano, thank you for your changes.
@ARMmbed/mbed-os-hal @ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@ciarmcom
Copy link
Member

ciarmcom commented Jun 1, 2021

@Meano, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

0xc0170
0xc0170 previously requested changes Jun 1, 2021
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Otherwise looks good to me

Copy link
Contributor

@LDong-Arm LDong-Arm left a comment

Choose a reason for hiding this comment

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

@Meano Thanks for the addition!

Checking what we have for A9 (grep -rnI CORTEX_A9), I also found the following

  • hal/tests/TESTS/mbed_hal/critical_section/main.cpp
  • platform/include/platform/mbed_application.h
  • platform/source/mbed_sdk_boot.c
  • platform/source/mbed_application.c
  • platform/tests/TESTS/mbed_platform/stats_cpu/main.cpp
  • cmsis/device/rtos/source/mbed_boot.c
  • rtos/tests/TESTS/mbed_rtos/threads/main.cpp

I think at least some (most?) of them would also need to be done for A5.

@ARMmbed/mbed-os-maintainers Who is the best to help with Cortex-A support? Is it possible to unify (at least some of) the macro checks to Cortex-A in general rather than targeting A9 and A5 specifically?

@mergify mergify bot dismissed 0xc0170’s stale review June 1, 2021 09:24

Pull request has been modified.

@LDong-Arm
Copy link
Contributor

LDong-Arm commented Jun 1, 2021

As a verification, it'd be really helpful to run Greentea tests on the following inside mbed-os

  • hal-tests-TESTS-mbed_hal-critical_section
  • platform-tests-TESTS-mbed_platform-stats_cpu
  • rtos-tests-TESTS-mbed_rtos-threads

with

mbed test -t <toolchain> -m <your custom target> -n <test name>

as those test cases contain Cortex-A specifics. Thanks!

Comment on lines 4 to 19
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
list(APPEND common_options
"-mthumb-interwork"
"-marm"
"-mfpu=vfpv3"
"-mfloat-abi=softfp"
"-mno-unaligned-access"
"-mcpu=cortex-a5"
)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
list(APPEND common_options
"-mfpu=vfpv3"
"-mfloat-abi=hard"
"-mcpu=cortex-a5"
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

@ARMmbed/mbed-os-maintainers If we can get some expert to check the architectural features specific to A5, it'd be nice. But otherwise the flags look fairly generic and okay to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I compared with m cores and one a core we currently have, no difference.

Comment on lines 23 to 29
INTERFACE
__CORTEX_A5
ARM_MATH_CA5
__FPU_PRESENT
__CMSIS_RTOS
__EVAL
__MBED_CMSIS_RTOS_CA5
Copy link
Contributor

Choose a reason for hiding this comment

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

(More of a note to the Mbed team for future reference: at some point we might check if all of them are still used and do a clean-up. They are defined for A9 too, so okay to keep for consistency)

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required, lets remove it.

The old symbols are not used anymore neither (__MBED_CMSIS_RTOS_CA9 or __MBED_CMSIS_RTOS_CM)

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 1, 2021

@ARMmbed/mbed-os-maintainers Who is the best to help with Cortex-A support? Is it possible to unify (at least some of) the macro checks to Cortex-A in general rather than targeting A9 and A5 specifically?

@Meano + @ARMmbed/team-renesas-rz would be the best bet to align them. I'll rereview and find better macro to be used, good point

@@ -26,7 +26,7 @@ static bool state_saved = false;

static bool are_interrupts_enabled(void)
{
#if defined(__CORTEX_A9)
#if defined(__CORTEX_A9) || defined(__CORTEX_A5)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can become __CORTEX_A only in all where we distinguish cortex-m vs cortex-a cores. CMSIs headers provide __CORTEX_A and __CORTEX_M definition for each, it should be sufficient to check for these.

Comment on lines 4 to 19
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
list(APPEND common_options
"-mthumb-interwork"
"-marm"
"-mfpu=vfpv3"
"-mfloat-abi=softfp"
"-mno-unaligned-access"
"-mcpu=cortex-a5"
)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
list(APPEND common_options
"-mfpu=vfpv3"
"-mfloat-abi=hard"
"-mcpu=cortex-a5"
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

I compared with m cores and one a core we currently have, no difference.

Comment on lines 23 to 29
INTERFACE
__CORTEX_A5
ARM_MATH_CA5
__FPU_PRESENT
__CMSIS_RTOS
__EVAL
__MBED_CMSIS_RTOS_CA5
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required, lets remove it.

The old symbols are not used anymore neither (__MBED_CMSIS_RTOS_CA9 or __MBED_CMSIS_RTOS_CM)

@Meano
Copy link
Contributor Author

Meano commented Jun 1, 2021

@LDong-Arm @0xc0170 I'll try to unify the macro and run Greentea tests.

@Meano
Copy link
Contributor Author

Meano commented Jun 2, 2021

The CA9 board passed Greentea tests. Our CA5 chip will be tested as soon as possible.

LDong-Arm
LDong-Arm previously approved these changes Jun 3, 2021
Copy link
Contributor

@LDong-Arm LDong-Arm 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 to me. The main purpose of this PR is adding Cortex-A5 support, so any further refactoring can be done by the Mbed team in the future if we need.

The Travis failure is okay to ignore. The path tools/targets is for compatibility with the old build system and frozen from major changes, but we can allow it case by case.

Comment on lines 71 to 100
"Cortex-M0": ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"Cortex-M1": ["__CORTEX_M3", "ARM_MATH_CM1", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"Cortex-M3": ["__CORTEX_M3", "ARM_MATH_CM3", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"Cortex-M4": ["__CORTEX_M4", "ARM_MATH_CM4", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"Cortex-M0": ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS"],
"Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS", "__CMSIS_RTOS"],
"Cortex-M1": ["__CORTEX_M3", "ARM_MATH_CM1", "__CMSIS_RTOS"],
"Cortex-M3": ["__CORTEX_M3", "ARM_MATH_CM3", "__CMSIS_RTOS"],
"Cortex-M4": ["__CORTEX_M4", "ARM_MATH_CM4", "__CMSIS_RTOS"],
"Cortex-M4F": ["__CORTEX_M4", "ARM_MATH_CM4", "__FPU_PRESENT=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"Cortex-M7": ["__CORTEX_M7", "ARM_MATH_CM7", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"__CMSIS_RTOS"],
"Cortex-M7": ["__CORTEX_M7", "ARM_MATH_CM7", "__CMSIS_RTOS"],
"Cortex-M7F": ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"__CMSIS_RTOS"],
"Cortex-M7FD": ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"__CMSIS_RTOS"],
"Cortex-A9": ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT",
"__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"],
"__CMSIS_RTOS", "__EVAL"],
"Cortex-M23-NS": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "DOMAIN_NS=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"Cortex-M23": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"__CMSIS_RTOS"],
"Cortex-M23": ["__CORTEX_M23", "ARM_MATH_ARMV8MBL", "__CMSIS_RTOS"],
"Cortex-M33-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "DOMAIN_NS=1",
"__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
"Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"__CMSIS_RTOS"],
"Cortex-M33": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "__CMSIS_RTOS"],
"Cortex-M33F-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "DOMAIN_NS=1",
"__FPU_PRESENT=1U", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"__FPU_PRESENT=1U", "__CMSIS_RTOS"],
"Cortex-M33F": ["__CORTEX_M33", "ARM_MATH_ARMV8MML",
"__FPU_PRESENT=1U", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM"],
"__FPU_PRESENT=1U", "__CMSIS_RTOS"],
"Cortex-M33FE-NS": ["__CORTEX_M33", "ARM_MATH_ARMV8MML", "DOMAIN_NS=1",
"__FPU_PRESENT=1U", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM", "__DSP_PRESENT=1U"],
"__DSP_PRESENT=1U"],
"Cortex-M33FE": ["__CORTEX_M33", "ARM_MATH_ARMV8MML",
"__FPU_PRESENT=1U", "__CMSIS_RTOS",
"__MBED_CMSIS_RTOS_CM", "__DSP_PRESENT=1U"],
"__DSP_PRESENT=1U"],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Patater Revert this file in this commit?

Comment on lines +83 to +90
"Cortex-A5": ["__CORTEX_A5", "ARM_MATH_CA5", "__FPU_PRESENT",
"__CMSIS_RTOS", "__EVAL"],
Copy link
Contributor Author

@Meano Meano Jun 21, 2021

Choose a reason for hiding this comment

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

Are these changes to mbed_toolchain.py could be approved? @Patater

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a new core added without changing existing ones, so it should be okay

@Meano
Copy link
Contributor Author

Meano commented Jun 23, 2021

The modifications to "tools/toolchains/mbed_toolchain.py" aren't functionally necessary, right?

Please remove changes to "tools/toolchains/mbed_toolchain.py", as it needs to support even older versions of Mbed OS (online) that may still use the __MBED_CMSIS_RTOS_CM define.

OK to remove __MBED_CMSIS_RTOS_CM from CMake, assuming we don't have some out-of-tree libraries that depend on that define.

I have reverted the changes of __MBED_CMSIS_RTOS_CM/A9 in "tools/toolchains/mbed_toolchain.py", but the modifications of the frozen files to support Cortex-A5 are kept (These can be removed at any time if necessary).

@LDong-Arm @0xc0170 @Patater Please review again.

Comment on lines +83 to +90
"Cortex-A5": ["__CORTEX_A5", "ARM_MATH_CA5", "__FPU_PRESENT",
"__CMSIS_RTOS", "__EVAL"],
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a new core added without changing existing ones, so it should be okay

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 24, 2021

CI started (while waiting for the approval)

@mbed-ci
Copy link

mbed-ci commented Jun 24, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@ciarmcom ciarmcom added the stale Stale Pull Request label Jun 30, 2021
@ciarmcom
Copy link
Member

This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-hal, please complete review of the changes to move the PR forward. Thank you for your contributions.

@0xc0170 0xc0170 requested a review from Patater June 30, 2021 14:45
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 30, 2021

@Patater If you approve it, this should be ready for integration

@ciarmcom ciarmcom removed the stale Stale Pull Request label Jun 30, 2021
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.

7 participants