NetX Duo DHCPv6 client - unaligned memory access

Jan Dospěl 50 Reputation points
2023-02-16T19:09:38.6433333+00:00

Hi All,

I am working at project with NetX Duo at STM32H7 MCU. But after adding DHCPv6 client add-on (nxd_dhcpv6_client.c) I facing hard fault due to unaligned memory access. After calling nx_dhcpv6_request_solicit() function I get hard fault due to line 541 (internal function _nx_dhcpv6_add_iana()) at file nxd_dhcpv6_client.c.

1

2

Same issue with unaligned memory access I have at line 611 also:

3

I am not sure why memcpy() is causing such issue. I found this issue at netxduo github.

  • memory for my Tx packet pool is 4 bytes aligned
  • I use original Ethernet driver from X-CUBE-AZRTOS-H7 version 3.0.0. From this reason I think incoming packets are properly aligned.
  • Other network features (IPv4, DHCPv4, ARP, ICMP, Auto-IP, TCP sockets) works without any issue with memory alignment.

I found that as workaround works setup of MPU like this. But this way is far from ideal.

Any idea what it going on is welcome.

Regards,

Jan

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
331 questions
0 comments No comments
{count} votes

Accepted answer
  1. Haiqing Zhao 165 Reputation points Microsoft Employee
    2023-02-20T06:10:30.8333333+00:00

    Hi Jan,

    Thanks for your question. You are right. If the memory type is specified as Device, unaligned data accesses (memcpy() and memset()) will cause an Alignment fault. Refer to https://developer.arm.com/documentation/ka004708/latest and https://developer.arm.com/documentation/ka002886/latest. In your project, the memory should be Normal memory type. Could you follow up the guide https://developer.arm.com/documentation/ka002886/latest to disable the access alignment restrictions? Thanks.

    Kind Regards,

    Haiqing


1 additional answer

Sort by: Most helpful
  1. QuantumCache 20,266 Reputation points
    2023-02-23T06:56:49.93+00:00

    Hello Jan Dospěl

    One of the suggestion i see on this issue is to check the memory alignment of the Tx packet pool and incoming packets to ensure that they are properly aligned.

    Meanwhile, community SME's on this topic or our team will review your scenario and circle back at the possible earliest time. 


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.