Hello, I'm stuck with hardfault handler.
When I try to execute read value from pointer address:
struct S2E_Packet { uint8_t module_type[3]; uint8_t fw_ver[3]; } __attribute__((packed)) S2E_Packet;
struct S2E_Packet s2e_packet;
AddressSrc=(uint32_t)&s2e_packet; uint32_t test = *(uint32_t*)AddressSrc; HAL_FLASH_Unlock(); HAL_FLASH_Program(TYPEPROGRAM_WORD, AddressDes, test);
program goes to hardfault handler. No errors or warnings during compilation.
I have no idea.....
I just want to read struct value in memory area and simply doesn't care what is in the struct value.
If that's what you're trying to do, how did pointers to 32-bit integers even enter the picture? There's nothing related uint32_t in that job description. A uint32_t isn't even big enough to hold all the bytes of the existing struct.
If all you want to do is move sequences of bytes from one place to the another, use (void *) for passing around the pointers, and (uint8_t *) to actually access the data. That's what they exist for. There's no point even thinking about (uint32_t *) for this.