lwIP | stm32h7: Add Ethernet driver for STM32H743ZI Nucleo (!37)

Claudio Grasso (@ClaudioGrasso) gitlab at rtems.org
Fri May 1 15:37:45 UTC 2026




Claudio Grasso commented on a discussion on stm32h7/include/lwipbspopts.h: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/37#note_149380

 > +#define ETH_PAD_SIZE 2
 > +
 > +/* Strongly byte-by-byte MEMCPY for STM32H7 to avoid all hardware traps.
 > + * Optimized library versions of memcpy() may use word-aligned instructions (LDR/STR)
 > + * even on byte-access paths, which can trigger usage faults in certain memory regions.
 > + */
 > +static inline void stm32h7_byte_memcpy(void *dst, const void *src, size_t len) {
 > +    uint8_t *d = (uint8_t *)dst;
 > +    const uint8_t *s = (const uint8_t *)src;
 > +    while (len--) {
 > +        *d++ = *s++;
 > +    }
 > +}
 > +#define MEMCPY(dst, src, len)  stm32h7_byte_memcpy(dst, src, len)
 > +#define SMEMCPY(dst, src, len) stm32h7_byte_memcpy(dst, src, len)
 > +#define MEMMOVE(dst, src, len) stm32h7_byte_memcpy(dst, src, len)

You are right that it is a broader issue — any application using this driver will face the same SMEMCPY fault in ACD/ARP parsing. We tested bulk `memcpy()` and confirmed it is safe. However, `SMEMCPY` specifically needs the byte-by-byte override because GCC generates `LDRD`/`LDM` for 4-byte copies from unaligned IP/ARP header fields in Ethernet packet data. This faults on Cortex-M7 regardless of `CCR.UNALIGN_TRP`. Confirmed by hard fault diagnosis on the physical STM32H743ZI Nucleo board.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/37#note_149380
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/20260501/837da50b/attachment-0001.htm>


More information about the bugs mailing list