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.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to