Skip to content

K_SEM_DEFINE is not a static initializer (requires runtime k_sem_init) #26

@swoisz

Description

@swoisz

Boreas's K_SEM_DEFINE requires a runtime k_sem_init() call after the macro; upstream's produces a fully-initialized struct usable before main(). SYS_INIT-time and constructor-time consumers hit this as a silent (or crashing) ordering dependency.

Fix: a real compile-time initializer, the way K_TIMER_DEFINE already does it. Depends on whether StaticSemaphore_t can be made constructor-free (e.g. lazy xSemaphoreCreateCountingStatic on first use behind an init-flag, or init via a Boreas SYS_INIT at PRE_KERNEL priority as a stopgap).

Metadata

Metadata

Assignees

No one assigned

    Labels

    zephyr-parityDivergence from upstream Zephyr API/semantics

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions