Skip to content

Is malloc() thread-safe in ARMC6? #6396

Closed
@ccli8

Description

@ccli8

Description

  • Type: Question
  • Priority: Major

Question

Target
NUMAKER_PFM_NUC472

Toolchain:
ARM|ARMC6

Toolchain version:
ARM: 5.06
ARMC6: 6.9

mbed-cli version:
1.4.0

mbed-os sha:
f6bcbfe Merge pull request #6356 from hug-dev/asm-include-flags

How to?
According to Arm C and C++ Libraries and Floating-Point Support User Guide, malloc() can be made thread-safe by implementing the _mutex_*() functions. I want to check its validity in ARMC6.

I compile Greentea test code mbed-os-tests-mbedmicro-rtos-mbed-malloc with ARM toolchain and check generated MAP file malloc.map. I can find _mutex_*() functions (_mutex_initialize/acquire/release/free) are included, so I am convinced malloc() is thread-safe.

mbed test -m NUMAKER_PFM_NUC472 -t ARM -n mbed-os-tests-mbedmicro-rtos-mbed-malloc --compile

But then I compile the same code with ARMC6 toolchain and check generated MAP file malloc.map. I just find _mutex_initialize and doesn't find _mutex_acquuire/release/free. Is malloc thread-safe in ARMC6, or there's some other mechanism?

mbed test -m NUMAKER_PFM_NUC472 -t ARMC6 -n mbed-os-tests-mbedmicro-rtos-mbed-malloc --compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions