Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Petro Karashchenko
Hi, I examined the proposed fix and the root cause of the issue. I found out that all network related types definitions are missing the "packed" attribute hence the crash on certain platforms may happen. Actually we should have begin_packed_struct struct eth_hdr_s { uint8_t dest[6]; /* Ethernet

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Kalbus, Peter
Understood … but I‘d like to separate them in two different PRs … mixing up things is rarely a good idea … I‘ll create PR for the alignment issue later today. The PR for the general CDCECM on RP2040 will follow as it’s complete. /Piet > Am 17.01.2022 um 13:43 schrieb Alan Carvalho de Assis :

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Alan Carvalho de Assis
It is possible to send two type of modifications in a single PR when they are relative to the same logic goal (that is the case here). But please separate CDCECM support to rp2040 in a commit and the alignment in another commit, so in the PR description you can use something like this: Add support

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Peter Kalbus
Hi Alan, sure … can I create a PR from a single chasnge? Background is, that I have two changes on the branch: - older one: get CDCECM enabled in RP2040 in general —> not yet fully done - newer one: the fix from alignment issue /Piet > Am 17.01.2022 um 13:08 schrieb Alan Carv

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Peter Kalbus
Hi Alan, sure … can I create a PR from a single chasnge? Background is, that I have two changes on the branch: - older one: get CDCECM enabled in RP2040 in general —> not yet fully done - newer one: the fix from alignment issue /Piet > Am 17.01.2022 um 13:19 schrieb Peter Kal

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Alan Carvalho de Assis
Hi Peter, Could you please send a Pull Request to mainline? Click on Pull Request tab and New Pull Request. BR, Alan On 1/17/22, Peter Kalbus wrote: > Hi Michael, > > understood … I changed the fix according to you proposal and tested it … > works fine,too: > > https://github.com/ptka/incubato

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Peter Kalbus
Hi Michael, understood … I changed the fix according to you proposal and tested it … works fine,too: https://github.com/ptka/incubator-nuttx/commit/09be64bb1f2fff9f85a392e0fab6915f9083fe2d struct cdcecm_

Re: rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Michael Jung
Hi Peter, good finding! There is actually a comment in this regard in include/nuttx/net/netdev.h: > The d_buf array must be aligned to two-byte, 16-bit address boundaries in order to support aligned 16-bit accesses performed by the network. W.r.t. to your proposed fix I think it would be more ap

rp2040: composite-cdcecm: hardfault due to alignment issue in driver/usbdev/usbdev.c

2022-01-17 Thread Peter Kalbus
Hi all, during the bring-up of the composite-cdcecm a alignment issue result in hard faults (always on the used rp2040 based device). ANALYSIS: The root cause seems to be the way the pktbuf is defined in cdcecm_driver_s (driver/usbdev/cdcecm.c): struct cdcecm_driver_s { /* USB CDC-ECM devic