Skip to content

Fix baremetal heap and stack initialisation #12225

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 21, 2020

Conversation

evedon
Copy link
Contributor

@evedon evedon commented Jan 9, 2020

Summary of changes

Fixed baremetal heap and stack initialisation and enabled heap_and_stack test for baremetal.
Added a test to check that global variables are initialised.

In mbed_sdk_boot:

  • Added initialisation for mbed_stack_isr_start/size and mbed_heap_start/size for all toolchains.
  • ARM toolchain:
    • Added call to mbed_toolchain_init() to initialise global variables.
    • Moved microlib initialisation code from mbed_retarget.cpp to mbed_sdk_boot.c.
  • IAR toolchain: there is no equivalent to a software init hook that can be called. __low_level_init() was used but since this function is called before RAM initialisation, it cannot be used to initialize global variables. Defined a new __mbed_init() function called from IAR startup file instead.

Impact of changes

Heap & stack test is enabled in baremetal mode.

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)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Reviewers


@evedon evedon force-pushed the ed-heap-stack-test branch from aa6d977 to 252eec2 Compare January 9, 2020 15:07
@ciarmcom ciarmcom requested review from a team January 9, 2020 16:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 9, 2020

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

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 13, 2020

Please add "Summary of changes" to the commit itself, would be good to have it in git as well.

@0xc0170 0xc0170 changed the title Fixed baremetal heap and stack initialisation Fix baremetal heap and stack initialisation Jan 13, 2020
@evedon evedon force-pushed the ed-heap-stack-test branch from 252eec2 to 2c363af Compare January 13, 2020 13:56
@evedon
Copy link
Contributor Author

evedon commented Jan 13, 2020

Please add "Summary of changes" to the commit itself, would be good to have it in git as well.

Done

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.

Summary of changes:

First line of the commit should contain the "headline" in this case, would be something like : heap stack: initialization fix

Enabled heap_and_stack test for baremetal.
Added a test to check that global variables are initialised.

In mbed_sdk_boot:
- Added initialisation for mbed_stack_isr_start/size and mbed_heap_start/size for all toolchains.
- ARM toolchain:
   - Added call to mbed_toolchain_init() to initialise global variables.
   - Moved microlib initialisation code from mbed_retarget.cpp to mbed_sdk_boot.c.
- IAR toolchain: there is no equivalent to a software init hook that can be called. __low_level_init() was used but since this function is called before RAM initialisation, it cannot be used to initialize global variables. Defined a new __mbed_init() function called from IAR startup file instead.
@evedon evedon force-pushed the ed-heap-stack-test branch from 2c363af to 3e3af70 Compare January 21, 2020 10:16
@evedon
Copy link
Contributor Author

evedon commented Jan 21, 2020

Summary of changes:

First line of the commit should contain the "headline" in this case, would be something like : heap stack: initialization fix

Done.

@mergify mergify bot dismissed 0xc0170’s stale review January 21, 2020 10:35

Pull request has been modified.

@adbridge
Copy link
Contributor

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 21, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@adbridge adbridge added ready for merge release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 and removed needs: CI labels Jan 21, 2020
@adbridge adbridge merged commit 40a0b28 into ARMmbed:master Jan 21, 2020
@evedon evedon deleted the ed-heap-stack-test branch January 21, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants