Claudio Grasso commented on a discussion on stm32h7/include/lwipbspopts.h: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/37#note_150821 > +#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) Not specifically. The D2 SRAM placement (LWIP_RAM_HEAP_POINTER) is there for DMA accessibility — the Ethernet DMA can only reach D2 SRAM, not AXI SRAM. The byte-by-byte override is a separate concern: ETH_PAD_SIZE 2 aligns the IP header to a 4-byte boundary within each received pbuf, but when lwIP extracts individual IP address fields it uses SMEMCPY via IPADDR_WORDALIGNED_COPY_TO_IP4_ADDR_T, where the source pointer can be at a 2-byte-aligned offset inside the packet. On Cortex-M7, LDRD and LDM instructions always fault on non-4-byte-aligned addresses regardless of CCR.UNALIGN_TRP — this is an instruction-set constraint, not a memory-region constraint. Moving the heap to AXI SRAM wouldn't help. The current MR (as on origin) already restricts the override to SMEMCPY only, which is the call site where this matters. MEMCPY and MEMMOVE operate on properly aligned buffers and don't need the override. The comment in that older diff is slightly imprecise ("LDR/STR... usage faults in certain memory regions") — LDR/STR do handle unaligned accesses in hardware on Cortex-M7; the real culprits are LDRD/LDM, which are instruction-level regardless of region. -- View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/37#note_150821 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
