STM32H563vit6 unaligned access on USBX initialization
I generated code for STM32H563VIT6 via CubeMX with USBD MSC enabled.
When I now run the software, I get an unaligned memory access error within:
static void USBD_FrameWork_MSCDesc(USBD_DevClassHandleTypeDef *pdev,
uint32_t pConf, uint32_t *Sze)
in the MACRO:
__USBD_FRAMEWORK_SET_EP((pdev->tclasslist[pdev->classId].Eps[1].add),
(USBD_EP_TYPE_BULK),
(uint16_t)(pdev->tclasslist[pdev->classId].Eps[1].size),
(0U), (0U));
which is disassembled to:
676 __USBD_FRAMEWORK_SET_EP((pdev->tclasslist[pdev->classId].Eps[1].add),
08005d9a: adds r3, r4, r1
08005d9c: mov.w r12, #7
08005da0: strb.w r12, [r4, r1]
08005da4: movs r4, #5
08005da6: strb r4, [r3, #1]
08005da8: ldr r4, [r0, #4]
08005daa: mov.w r12, #92 ; 0x5c
08005dae: mla r4, r12, r4, r0
08005db2: ldrb.w r4, [r4, #42] ; 0x2a
08005db6: strb r4, [r3, #2]
08005db8: movs r4, #2
08005dba: strb r4, [r3, #3]
08005dbc: ldr r4, [r0, #4]
08005dbe: mla r4, r12, r4, r0
08005dc2: ldrh r4, [r4, #44] ; 0x2c
08005dc4: strh r4, [r3, #4] <- unaligned access interrupt here
08005dc6: ldrb r0, [r0, #0]
08005dc8: cmp r0, #1
The packed struct is at an unaligned memory location but the Cortex-M33 manual states that unaligned access is allowed for the strh instruction .
Does one have an Idea where this may orginate from?
Regards Pascal
