Emulated hardware division hw_divider_divmod_u/s32_start discards result #2287

Closed
opened 2025-02-17 14:08:20 -06:00 by DDoS · 1 comment
DDoS commented 2025-02-17 14:08:20 -06:00 (Migrated from github.com)

Title says it all. In fact only hw_divider_restore_state ever writes to the emulated hw_divider_results, so all the async functions are broken.

static inline void hw_divider_divmod_u32_start(uint32_t a, uint32_t b) {
#if !PICO_EMULATE_DIVIDER
    ...
#else
    hw_divider_divmod_u32(a, b); // <- this returns a divmod_result_t but discards it
#endif
}

https://github.com/raspberrypi/pico-sdk/blob/2.1.0/src/rp2_common/hardware_divider/include/hardware/divider.h#L113

Title says it all. In fact only `hw_divider_restore_state` ever writes to the emulated `hw_divider_results`, so all the async functions are broken. ```c static inline void hw_divider_divmod_u32_start(uint32_t a, uint32_t b) { #if !PICO_EMULATE_DIVIDER ... #else hw_divider_divmod_u32(a, b); // <- this returns a divmod_result_t but discards it #endif } ``` https://github.com/raspberrypi/pico-sdk/blob/2.1.0/src/rp2_common/hardware_divider/include/hardware/divider.h#L113
kilograham commented 2025-02-18 13:02:10 -06:00 (Migrated from github.com)

fix merged into develop

fix merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#2287
No description provided.