Skip to content

Conversation

TacoGrandeTX
Copy link
Contributor

For single-threaded apps __iar_Initlocks() is not required and must not be called because the proper IAR library is brought in only if --threaded_lib is defined in the linker command.

Description

If one doesn't link with --threaded_lib then an IAR run-time library is brought in which doesn't include __iar_Initlocks() and a linker error is generated when building:

Error[Li005]: no definition for "__iar_Initlocks" [referenced from C:\_nrf\ble_
          project\BUILD\NRF52840_DK\IAR-TOOLCHAINS_PROFILE\mbed-os\r
          tos\TARGET_CORTEX\TOOLCHAIN_IAR\mbed_boot_iar.o]

So calls to __iar_Initlocks() now need to be protected by "MBED_RTOS_SINGLE_THREAD".

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

This was discovered on an internal BLE project which used the following toolchains_profile.json:

"IAR": {
    "common": [
        "--no_wrap_diagnostics", "-e",
        "--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-Ohz", "-DMBED_RTOS_SINGLE_THREAD", "--enable_restrict"],
    "asm": [],
    "c": ["--vla"],
    "cxx": ["--guard_calls", "--no_static_destruction", 
            "--no_exceptions", "--no_rtti", "--no_static_destruction"],
    "ld": ["--skip_dynamic_initialization", "--inline", "--merge_duplicate_sections", "--no_exceptions", "--basic_heap"]
}

For single-threaded apps __iar_Initlocks() is not required and must
not be called because the proper IAR library is brought in only if
"--threaded_lib" is defined in the linker command.
@TacoGrandeTX TacoGrandeTX requested a review from SenRamakri March 8, 2019 22:10
@TacoGrandeTX
Copy link
Contributor Author

@paul-szczepanek-arm This will fix the build issue you experienced.

@ciarmcom ciarmcom requested review from a team March 9, 2019 00:00
@ciarmcom
Copy link
Member

ciarmcom commented Mar 9, 2019

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

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.

Good catch !

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

@SenRamakri Mind taking a quick look?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 5, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 5, 2019

Test run: SUCCESS

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

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.

5 participants