2024-11-19 4:37 AM - last edited on 2025-02-28 1:45 AM by mƎALLEm
Hello all ,
I am facing a issue of hard fault because of some reason however after analyzing issue I suspect this could be due to use of structure having uint64_t variable having bit fielding. I have also attached snapshot of issue which I am facing(Precise data access violation).
typedef struct _st_device_info_payload
{
uint64_t IMEI : 50;
uint64_t BLE_MAC_ID : 48;
uint64_t WiFi_MAC_ID : 48;
uint16_t Server_Port;
uint64_t SIM_ICCID_1 :6;
uint64_t SIM_ICCID_2 :64;
char Server_Domain_Name[20];
char APN[20];
}st_device_info_payload;
Please confirm these few points.
1. Can I use uint64_t for STM32H7 MCU.
2. Can we use bit fielding for uint64_t variable for stm32h7.
Solved! Go to Solution.
2024-11-19 9:22 AM
Hello @devendra ,
answering your questions:
you need to further pinpoint the exact instruction which lead to the Hardfault to make sure it is a problem of memory alignment so my recommendation is to take a look at this article which will help you debug the Hardfault.
Regards
2024-11-19 4:49 AM - edited 2024-11-19 4:50 AM
Hello @devendra ,
Please review how to post a thread in this community: https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228
This is mainly regarding the title, share a better image resolution, and how to share the code, MCU part number..
Thank you for your understanding.
2024-11-19 9:22 AM
Hello @devendra ,
answering your questions:
you need to further pinpoint the exact instruction which lead to the Hardfault to make sure it is a problem of memory alignment so my recommendation is to take a look at this article which will help you debug the Hardfault.
Regards
2024-11-19 9:47 AM - edited 2024-11-19 9:52 AM
> structure having uint64_t variable having bit fielding
This immediately hints to alignment requirements. 64-bit variables should be aligned on 64 bit even on Cortex-M7.
Bit fields wider than 32 bits ... not sure. Use disassembly view to see how it compiles with your compiler (gcc or IAR or Keil or ??)
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.