So, wrapping it all up,
- __packed attribute is already not there in said functions the current/recent incarnations of Cube
- it's a Keil/ARM compiler native qualifier, the attribute into which it converts for gcc does nothing (i.e. is both ineffective and harmless) except it throws a warning
- said function moves words into USB hardware (FIFO) from buffer in RAM passed through pointer
- pointer to buffer is best to be word-aligned for speed, but there are legitimate user cases where users want to use unaligned pointer (e.g. zero-copy higher-level protocols)
- plain dereferencing unaligned pointer to word throws error in 'CM0/'CM0+ and works somewhat less efficiently in 'CM3/'CM4/'CM7
- facing this error, Cube authors decided to allow for unaligned pointer for users convenience at the cost of more work for them
- for Keil/ARM compiler it's easy, just adding __packed moves the problem to the compiler which does whatever is needed (i.e. generates multiple split accesses)
- I wouldn't be surprised to learn that IAR has similar feature
- this may be not optimal as there are algorithms through which most accesses still can be word-wise at the cost of dis/reassembling words in software, but here we are
- Cube authors initially probably did not realize that this does not work in the same way in gcc, IIRC in current Cube there is explicit disassembly/reassembly as needed for gcc
- in the 'CM3/4/7 version, __packed is there too, maybe to suppress warning about unaligned access? but as said above, is mostly harmless
- in the current 'CM3/4/7 gcc version there's some cast to __packed array or something, probably ineffective/harmless in the same way except it does not thow the warning? I don't know don't care about Cube
- ZLPs are useful, I referred to chapter and verse in the fine manuals above
- in Synopsys OTG USB used in higher-end STM32, the "transfer start" and "dump data" (and then also a "done/PC got it") processes are separate to allow replacing the latter by built-in DMA seamlessly
- in that USB, when "transfer start" is with ZLP, it does not throw the "dump data" interrupt at all, so there's no point to discuss zero data case in said "dump data" functions
- the free service is late and lacking and the $14B company does not care
- USB is crap but who are we to judge
- sometimes users in fora are rude to each other
JW