Skip to content

Commit

Permalink
Merge pull request #5812 from EmergReanimator/tinyusb_port_config
Browse files Browse the repository at this point in the history
Allow to tailor tinyusb configuration for port specific needs
  • Loading branch information
tannewt authored Jan 6, 2022
2 parents d117bc7 + 6dbb662 commit 513a954
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
CIRCUITPY_WIFI ?= 0
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)

# tinyusb port tailored configuration
CIRCUITPY_TUSB_MEM_ALIGN ?= 4
CFLAGS += -DCIRCUITPY_TUSB_MEM_ALIGN=$(CIRCUITPY_TUSB_MEM_ALIGN)

CIRCUITPY_TUSB_ATTR_USBRAM ?= ".bss.usbram"
CFLAGS += -DCIRCUITPY_TUSB_ATTR_USBRAM=$(CIRCUITPY_TUSB_ATTR_USBRAM)

# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
Expand Down
14 changes: 12 additions & 2 deletions supervisor/shared/usb/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,18 @@ extern "C" {
// --------------------------------------------------------------------+
// USB RAM PLACEMENT
// --------------------------------------------------------------------+
#define CFG_TUSB_ATTR_USBRAM
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
#if !defined(CIRCUITPY_TUSB_ATTR_USBRAM)
#define CIRCUITPY_TUSB_ATTR_USBRAM ".bss.usbram"
#endif

#define CFG_TUSB_ATTR_USBRAM __attribute__((section(CIRCUITPY_TUSB_ATTR_USBRAM)))


#if !defined(CIRCUITPY_TUSB_MEM_ALIGN)
#define CIRCUITPY_TUSB_MEM_ALIGN 4
#endif

#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(CIRCUITPY_TUSB_MEM_ALIGN)))


#ifdef __cplusplus
Expand Down

0 comments on commit 513a954

Please sign in to comment.