Skip to content

Apollo3: Fix heap size formula and stack start address in scatter file #14132

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 1 commit into from
Jan 20, 2021

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Jan 8, 2021

Summary of changes

The heapsize was incorrectly calculated.
This fixes it by subtracting the Stack size, any memory chunks allocated
before the start of the application (for vectors and/or crash report), and
finally the size of the application from the total RAM size.

The stack start address should be the top of the RAM which is also fixed.

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] 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


@hugueskamba hugueskamba requested a review from a team January 8, 2021 18:42
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Jan 8, 2021
@ciarmcom ciarmcom requested a review from a team January 8, 2021 19:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 8, 2021

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

0xc0170
0xc0170 previously approved these changes Jan 11, 2021
@mbed-ci
Copy link

mbed-ci commented Jan 11, 2021

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
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_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM
jenkins-ci/mbed-os-ci_build-example-ARM
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 11, 2021

Jenkins error, CI restarted

@mbed-ci
Copy link

mbed-ci commented Jan 11, 2021

Jenkins CI Test : ❌ FAILED

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_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2021

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-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_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2021

I've asked test team to help reviewing logs to find what failed (the targets are related so it might be real failures but I could not locate them in the console/logs).

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2021

"BUILD/tests/SFE_ARTEMIS/ARM/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TOOLCHAIN_ARM_STD/AMA3B1KK.sct", line 39 (column 11): Warning: L6314W: No section matches pattern *(*nvictable).
        Error: L6221E: Execution region ARM_LIB_HEAP with Execution range [0x100071c0,0x1005fc00) overlaps with Execution region ARM_LIB_STACK with Execution range [0x1005fbf8,0x1005fff8).
        Finished: 0 information, 2 warning and 1 error messages.

@kjbracey
Copy link
Contributor

Error is due to the random -8 in the start address of ARM_LIB_STACK. No idea what that's supposed to be doing.

The heapsize was incorrectly calculated.
This fixes it by subtracting the Stack size, any memory chunks allocated
before the start of the application (for vectors and/or crash report), and
finally the size of the application from the total RAM size.

The stack start address should be the top of the RAM which is also fixed.
@hugueskamba hugueskamba force-pushed the hk_heap_size_fix_apollo3 branch from 7f0ef5e to f00aeea Compare January 12, 2021 11:35
@mergify mergify bot dismissed 0xc0170’s stale review January 12, 2021 11:36

Pull request has been modified.

@hugueskamba hugueskamba changed the title Apollo3: Fix heap size formula in scatter files Apollo3: Fix heap size formula and stack start address in scatter file Jan 12, 2021
@hugueskamba
Copy link
Collaborator Author

Error is due to the random -8 in the start address of ARM_LIB_STACK. No idea what that's supposed to be doing.

Thanks. This has now been fixed.

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.

LGTM

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2021

CI started

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 19, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented Jan 20, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 7 | 🔒 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-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️

@0xc0170 0xc0170 merged commit 96aa1bb into ARMmbed:master Jan 20, 2021
@hugueskamba hugueskamba deleted the hk_heap_size_fix_apollo3 branch January 20, 2021 15:18
@mbedmain mbedmain added release-version: 6.7.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jan 25, 2021
@idea--list
Copy link
Contributor

idea--list commented Feb 11, 2021

This merge should be rolled back ASAP!

Since the release of V6.7 i was updating my code to work again with MAX32630FTHR...

Then today turning back to the Apollo3 Thing Plus board i face some of my code not working with the Artemis board and Mbed V6.7...

OK, it might be my code, so i try the official blinky which is also very basic...even that fails with V6.7.
Wow, things are really exciting with Mbed OS but HOW COME that recently added targets begin to fail?!

So i go and look for what has been changed for the Apollo3 platform in V6.7. Luckily i found only this PR.
Revert back the changes in targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TOOLCHAIN_ARM_STD/AMA3B1KK.sct

And everything works again.

May i just question how all this PR has been tested? Has it been tested at all on the target itself?
Or someone looked at some documents thought they found a bug, modified code without testing it on the board and that got merged into core. Sorry guys, but this is so frustrating as it is a long tradition...as of now i began too look for alternatives.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 12, 2021

Did this break stack alignment ? We shall fix this in the upcoming release.

May i just question how all this PR has been tested? Has it been tested at all on the target itself?
Or someone looked at some documents thought they found a bug, modified code without testing it on the board and that got merged into core. Sorry guys, but this is so frustrating as it is a long tradition...as of now i began too look for alternative

Not every board is plugged in CI, partners test the changes themselves or users should. In this case, the change was not tested locally.
Not all targets are equal unfortunately at the moment. We will address this in the upcoming weeks to improve the story and make them equal as much as we can with help of all of us (community, Mbed OS teams or partner teams). The changes should be tested (providing tests logs).

@ARMmbed/team-sparkfun ^^

@idea--list
Copy link
Contributor

Not every board is plugged in CI, partners test the changes themselves or users should.

Ok, i understand. I know you are making up/introduce working groups for the public. Why don't you try to organize such groups of users of different boards who could then test those boards physically?

I only have 2 boards supported by Mbed, but as i perceive there is a general tendency that vendors just put their products to the market and they make an initial effort to get it Mbed enabled, but after then they almost abandon their products. Combined with the fast pace how Mbed itself evolves it leads to no good. I do not know how you involve new vendors, but maybe i would require them to have ongoing commitment to support their boards. Here i do not mean they shall find and fix all the bugs on their own, but i find it eye-opening how many times they just do not react on approval requests. Mbed already supports tons of different platforms, you do not need to support all the boards. For QA reasons you could simply drop those boards where the vendor does not review PRs before merging and it must be clear to them from the beginning of the partnership. However you should take care and think of the reasons why vendors tend to act like that. You really should not stay on the current path in this regard.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 12, 2021

thanks for the feedback, we will improve the process to set proper expectations and improve how targets are tested.

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.

8 participants