Hard fault error when cast variable in stm32g070
I have migrated code from stm32f4 to stm32g0 suscesfully in almost all my aplication. However there is a part of code that rise a hard fault error.
This is the code:
crc_received = *((uint32_t*)&e22_uart_rx_buffer[(uint16_t)(e22_uart_rx_buffer_length - 4)]);This is the assembler compiled:
113 crc_received = *((uint32_t*)&e22_uart_rx_buffer[(uint16_t)(e22_uart_rx_buffer_length - 4)]);
08003c6a: uxth r3, r1
08003c6c: ldr r3, [r5, r3]
08003c6e: uxtb r1, r1
08003c70: movs r0, #0
08003c72: str r3, [r7, #0]The error rise after execute: ldr r3, [r5, r3]
And this is the fault analizer viewer from stm32cube ide:
The Register content is this one:
I can't realize where is the trouble, even fault analizer didn't show a partircular issue. This code operation is a simple cast from 4 bytes uint8_t buffer[] to uint32_t.
