RTEMS | bsps/arm/stm32f4: Fix multiple OTGFS header bugs (!1134)

Mohamed Ayman (@mohamedayman23) gitlab at rtems.org
Sun Mar 15 15:11:28 UTC 2026



Mohamed Ayman created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1134

Project:Branches: mohamedayman23/rtems:fix-multiple-OTGFS-header-bugs to rtems/rtos/rtems:main
Author:   Mohamed Ayman



bsps/arm/stm32f4: Fix multiple OTGFS header bugs

**Duplicate bit definition in GINTSTS**

- STM32F4_OTGFS_GINTSTS_IPXFR and STM32F4_OTGFS_GINTSTS_IISOOXFR were both defined as bit 21.
- Corrected IISOOXFR to bit 20 per STM32F4 reference manual.

**Wrong macro used for INEPTFSAV_GET**

- STM32F4_OTGFS_DTXFSTS_INEPTFSAV_GET previously used BSP_FLD32, which is for field construction, not extraction.
- Updated to use BSP_FLD32GET to correctly extract bits 0..15.

**Wrong macro reference / ordering for DIEPCTL EP0_MPSIZ**

- STM32F4_OTGFS_DIEPCTL_EP0_MPSIZ_8..64 referenced STM32F4_OTGFS_DIEPCTL_MPSIZ before it was defined.
- Moved STM32F4_OTGFS_DIEPCTL_MPSIZ above all EP0_MPSIZ macros to ensure correct macro expansion.

**Critical bug: missing padding in OUT endpoint struct**

- In `stm32f4_otgfs_outepregs_s`, the 4-byte reserved space at offset 0x0C was missing.
- With `__attribute__((packed))`, `doeptsiz` was misaligned at 0x0C instead of 0x10, making the struct size 28 bytes instead of 32.
- Added `resv0C` field to ensure correct register offsets and struct size, preserving memory stride for arrays of endpoint registers.

**Typo in GRXSTSP Data PID macro**

- The Data PID mask macro was incorrectly named `DPIG`.
- Corrected to `DPID` to match the subsequent `_GET` macros and hardware reference manual.

These fixes resolve copy-paste errors, incorrect field access, macro ordering issues, struct layout problems, and macro naming typos, ensuring the OTGFS headers match the hardware reference manual and operate correctly on STM32F4 devices.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1134
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260315/56f5db65/attachment-0001.htm>


More information about the bugs mailing list