DeqingSun / ch55xduino

An Arduino-like programming API for the CH55X
GNU Lesser General Public License v2.1
448 stars 86 forks source link

hard-coded Ep0 size bug #36

Closed nerdralph closed 2 years ago

nerdralph commented 3 years ago

https://github.com/DeqingSun/ch55xduino/blob/ch55xduino/ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/CMSIS_DAP/src/CMSIS_DAPusb/USBhandler.c#L9

If DEFAULT_ENDP0_SIZE is changed to 64, the code will break.

DeqingSun commented 3 years ago

You may also need to change EP1_ADDR, EP2_ADDR, etc, and USER_USB_RAM. Or there may be collision on those arrays.

nerdralph commented 3 years ago

I've already started changing the code so the buffers are allocated by the compiler instead of using fixed addresses.

On Fri, Feb 12, 2021, 21:29 Deqing Sun notifications@github.com wrote:

You may also need to change EP1_ADDR, EP2_ADDR, etc, and USER_USB_RAM. Or there may be collision on those arrays.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DeqingSun/ch55xduino/issues/36#issuecomment-778539539, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKNZ6SVXBZKXSEJGG56DNLS6XIVXANCNFSM4XQ3OAKQ .

DeqingSun commented 3 years ago

The official example mentioned the DMA arrays must allocated in even address in comment. Although I didn't find such thing in the datasheet. I know there is a .even keyword for alignment in Flash but I didn't check if there is way to do it in RAM. If you finds such a way, please let me know. It can simplify the menu as well.

nerdralph commented 3 years ago

I can do it when I ensure each object file has xmem aligned and padded to an even number of bytes. Its easy for a project with a few files, but would be harder with ch55xduino. https://sourceforge.net/p/sdcc/mailman/message/37218815/ Maybe with a custom linker script you could do it.

On Sat, Feb 13, 2021, 00:37 Deqing Sun notifications@github.com wrote:

The official example mentioned the DMA arrays must allocated in even address in comment. Although I didn't find such thing in the datasheet. I know there is a .even keyword for alignment in Flash but I didn't check if there is way to do it in RAM. If you finds such a way, please let me know. It can simplify the menu as well.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DeqingSun/ch55xduino/issues/36#issuecomment-778562131, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKNZ6SSQLNSJOXMJHTUFJDS6X6ZJANCNFSM4XQ3OAKQ .