Skip to content

I2C STM32WL Debug : Unable to link because inline are not inlined #15379

@hallard

Description

@hallard

Description of defect

Depending on code, sometimes unable to link using I2C on STM32WL because looks like inline not inlined and thus linker fail to find the function

Target(s) affected by this defect ?

STM32WL (may be other)

Toolchain(s) (name and version) displaying this defect ?

image

What version of Mbed-os are you using (tag or sha) ?

master since @multiplemonomials commit 0751932

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed studio 1.4.4.1

How is this defect reproduced ?

Not really sure sometimes in happens with some code other not.
I suspect compiler defect under certain circonstances depending on code, in my case target use mbed-cryptoauthlib for I2C secure element and another I2C device. in that case it always happen (in debug only the one that do not have --inline flag on profile)
develop and releaseprofiles have no issues

In my case i2c_is_ready_for_transaction_start() is not created (not inlined) failed to link (makes sense)

[Error] @0,0: L6218E: Undefined symbol i2c_is_ready_for_transaction_start (referred from BUILD/EVOLY_T_V12/ARMC6/mbed-os/targets/TARGET_STM/i2c_api.o).
Warning: L3912W: Option 'legacyalign' is deprecated.
Error: L6218E: Undefined symbol i2c_is_ready_for_transaction_start (referred from BUILD/EVOLY_T_V12/ARMC6/mbed-os/targets/TARGET_STM/i2c_api.o).
Finished: 0 information, 1 warning and 1 error messages.
[ERROR] Warning: L3912W: Option 'legacyalign' is deprecated.
Error: L6218E: Undefined symbol i2c_is_ready_for_transaction_start (referred from BUILD/EVOLY_T_V12/ARMC6/mbed-os/targets/TARGET_STM/i2c_api.o).
Finished: 0 information, 1 warning and 1 error messages.

anyway changing to always_inline with solve the issue (not sure it's the best option)

inline bool i2c_is_ready_for_transaction_start(stm_i2c_state state)
{
    // Note: We can safely send a transaction start in the middle of any single byte operation; this creates a
    // repeated start.

    return state == STM_I2C_IDLE || STM_I2C_PENDING_START == state
           || state == STM_I2C_SB_READ_IN_PROGRESS || state == STM_I2C_SB_WRITE_IN_PROGRESS;
}
MBED_FORCEINLINE bool i2c_is_ready_for_transaction_start(stm_i2c_state state)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions