Skip to content

Commit

Permalink
Upgrades libdaisy to latest 5.2.0 release.
Browse files Browse the repository at this point in the history
Merge commit '9b565bea31de84a0a7363a7d108b1f33551267e9' into lichen-community-systemsgh-52
  • Loading branch information
colinbdclark committed Sep 12, 2022
2 parents dcdd5d1 + 9b565be commit d65247b
Show file tree
Hide file tree
Showing 66 changed files with 7,395 additions and 372 deletions.
45 changes: 45 additions & 0 deletions hosts/daisy/vendor/libDaisy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,51 @@

## Unreleased

## v5.2.0

### Features

* board: added board support for Noise Engineering legio platform
* audio: added `output_compensation` value to config struct to allow for post-scaling of uneven audio passthru levels.
* util: added a multiply operator to the Color class for scaling a color by a single factor.
* device: Added ICM20948 sensor device driver
* device: Added DPS310 device driver
* device: Added MPR121 device driver
* device: Added APDS9960 device driver
* device: Added TLV493D device driver.
* device: Added neotrellis driver
* device: Added neopixel driver

### Bug fixes

* uart: fixed bug with fifo-dma-receive mode that would result in erratic reads over time. Fixes issues with UART (TRS/DIN) MIDI parsing

## v5.1.0

### Features

* tim: `TimerHandle` now has callbacks each time the Period has elapsed. These can be enabled with `TimerHandle::Config::enable_irq` at Init time.
* bootloader: Working with the bootloader has been simplified. See [the new guide for updates on usage](https://electro-smith.github.io/libDaisy/md_doc_md__a7__getting__started__daisy__bootloader.html)
* usb: `USBHost` class has added support for user callbacks on device connection, disconnection, and when the MSC class becomes active.
* uart: Adds DMA RX and TX modes, similar to how they work on the I2C and SPI.
* uart: Update function names to be more in line with the new DMA / Blocking scheme.
* The old methods are wrappers for the new ones to preserve backwards compatibility, but **will be removed in a future version**.
* Affected functions: `PollReceive`, `PollTx`, `StartRx`, `RxActive`, `FlushRx`, `PopRx`, `Readable`

### Bug Fixes

* util: PersistentStorage class had a bug where calling the `RestoreDefaults` function would cause a crash
* usb: LL HAL files for USB were updated to prevent timing issues when running with optimization
* spi: Add IRQ handlers for SPI2-5. These should work with DMA now.
* midi: bugs related to running status bytes for note off, and single data-byte messages have been resolved

### Other

* build: core/Makefile has had the `-fnortti` flag added to match libDaisy's Makefile
* bootloader: local version of daisy bootloader has been updated to improve stability
* spi: Added examples for blocking TX and DMA TX, added a writeup explaining how to use the SPI on the Daisy
* uart: Adds examples for common modes of communication, both DMA, blocking, FIFO, and mixed.

## v5.0.0

### Breaking Changes
Expand Down
1 change: 1 addition & 0 deletions hosts/daisy/vendor/libDaisy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ add_library(${TARGET} STATIC
${MODULE_DIR}/daisy_petal.cpp
${MODULE_DIR}/daisy_field.cpp
${MODULE_DIR}/daisy_versio.cpp
${MODULE_DIR}/daisy_legio.cpp
${MODULE_DIR}/daisy_patch_sm.cpp
${MODULE_DIR}/sys/system.cpp
${MODULE_DIR}/dev/sr_595.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ typedef struct
#define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
#define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)

#define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
#define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
#define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
#define USBx_DEVICE ((__IO USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
#define USBx_INEP(i) ((__IO USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
#define USBx_OUTEP(i) ((__IO USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
#define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))

#define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef c
HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx,
uint32_t hclk, uint8_t speed)
{
uint32_t UsbTrd;
volatile uint32_t UsbTrd;

/* The USBTRD is configured according to the tables below, depending on AHB frequency
used by application. In the low AHB frequency range it is used to stretch enough the USB response
Expand Down Expand Up @@ -441,7 +441,7 @@ HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cf
*/
HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;

USBx->GRSTCTL = (USB_OTG_GRSTCTL_TXFFLSH | (num << 6));

Expand All @@ -464,7 +464,7 @@ HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num)
*/
HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t count = 0;
volatile uint32_t count = 0;

USBx->GRSTCTL = USB_OTG_GRSTCTL_RXFFLSH;

Expand Down Expand Up @@ -511,7 +511,7 @@ uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint8_t speed;
uint32_t DevEnumSpeed = USBx_DEVICE->DSTS & USB_OTG_DSTS_ENUMSPD;
volatile uint32_t DevEnumSpeed = USBx_DEVICE->DSTS & USB_OTG_DSTS_ENUMSPD;

if (DevEnumSpeed == DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ)
{
Expand Down Expand Up @@ -1121,7 +1121,7 @@ HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx)
*/
uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t tmpreg;
volatile uint32_t tmpreg;

tmpreg = USBx->GINTSTS;
tmpreg &= USBx->GINTMSK;
Expand All @@ -1137,7 +1137,7 @@ uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx)
uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t tmpreg;
volatile uint32_t tmpreg;

tmpreg = USBx_DEVICE->DAINT;
tmpreg &= USBx_DEVICE->DAINTMSK;
Expand All @@ -1153,7 +1153,7 @@ uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t tmpreg;
volatile uint32_t tmpreg;

tmpreg = USBx_DEVICE->DAINT;
tmpreg &= USBx_DEVICE->DAINTMSK;
Expand All @@ -1171,7 +1171,7 @@ uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t tmpreg;
volatile uint32_t tmpreg;

tmpreg = USBx_OUTEP((uint32_t)epnum)->DOEPINT;
tmpreg &= USBx_DEVICE->DOEPMSK;
Expand All @@ -1189,7 +1189,7 @@ uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum)
uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t tmpreg, msk, emp;
volatile uint32_t tmpreg, msk, emp;

msk = USBx_DEVICE->DIEPMSK;
emp = USBx_DEVICE->DIEPEMPMSK;
Expand Down Expand Up @@ -1289,7 +1289,7 @@ HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uin
*/
static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;

/* Wait for AHB master IDLE state. */
do
Expand Down Expand Up @@ -1819,7 +1819,7 @@ HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t hcnum = (uint32_t)hc_num;
uint32_t count = 0U;
volatile uint32_t count = 0U;
uint32_t HcEpType = (USBx_HC(hcnum)->HCCHAR & USB_OTG_HCCHAR_EPTYP) >> 18;

/* Check for space in the request queue to issue the halt. */
Expand Down Expand Up @@ -1885,7 +1885,7 @@ HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num)
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t chnum = (uint32_t)ch_num;
uint32_t num_packets = 1U;
uint32_t tmpreg;
volatile uint32_t tmpreg;

USBx_HC(chnum)->HCTSIZ = ((num_packets << 19) & USB_OTG_HCTSIZ_PKTCNT) |
USB_OTG_HCTSIZ_DOPING;
Expand All @@ -1907,8 +1907,8 @@ HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num)
HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t count = 0U;
uint32_t value;
volatile uint32_t count = 0U;
volatile uint32_t value;
uint32_t i;


Expand Down Expand Up @@ -2005,3 +2005,4 @@ HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx)
*/

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

1 change: 1 addition & 0 deletions hosts/daisy/vendor/libDaisy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ daisy_patch \
daisy_petal \
daisy_field \
daisy_versio \
daisy_legio \
daisy_patch_sm \
sys/fatfs \
sys/system \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static USBH_StatusTypeDef USBH_MSC_InterfaceDeInit(USBH_HandleTypeDef *phost)

if (phost->pActiveClass->pData)
{
USBH_free(phost->pActiveClass->pData);
// USBH_free(phost->pActiveClass->pData);
phost->pActiveClass->pData = 0U;
}

Expand Down
3 changes: 2 additions & 1 deletion hosts/daisy/vendor/libDaisy/Middlewares/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
This can be used to keep track of any manual changes to Middleware files to make migrating to new versions easier in the future.

* Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc.c
* The msc class was modified to prevent dynamic allocation of the `MSC_HandleTypeDef` struct. It was also placed in uncached D2 ram to allow DMA transfers with D cache enabled.
* The msc class was modified to prevent dynamic allocation of the `MSC_HandleTypeDef` struct. It was also placed in uncached D2 ram to allow DMA transfers with D cache enabled.
* modified again on 18 April 2022 to temporarily remove USBH_Free from usbh class -- this should be done for device classes, and/or we should just rework the system to work with malloc/free as designed. That change may require moving the heap out of DTCMRAM (default location within daisy linker) if the DMA needs access to the class data
60 changes: 49 additions & 11 deletions hosts/daisy/vendor/libDaisy/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ CHIPSET ?= stm32h7x

TARGET_BIN=$(TARGET).bin
TARGET_ELF=$(TARGET).elf
BOOT_BIN ?= $(wildcard $(SYSTEM_FILES_DIR)/dsy_bootloader*)
FLASH_ADDRESS ?= 0x08000000
QSPI_ADDRESS ?= 0x90040000

# If you have the arm-none-eabi- toolchain located in a particular place, but not installed for the entire system, add the path here:
# GCC_PATH=
Expand Down Expand Up @@ -188,19 +185,58 @@ CPPFLAGS += \
-fshort-enums \
-fno-move-loop-invariants \
-fno-unwind-tables \
-fno-rtti \
-Wno-register

C_STANDARD = -std=gnu11
CPP_STANDARD ?= -std=gnu++14


#######################################
# LDFLAGS
# Boot Management
#######################################
# link script

INTERNAL_ADDRESS = 0x08000000
QSPI_ADDRESS ?= 0x90040000

# For the time being, we'll keep the Daisy Bootloader's PID as df11
# DAISY_PID = a360
DAISY_PID = df11
STM_PID = df11

BOOT_BIN ?= $(wildcard $(SYSTEM_FILES_DIR)/dsy_bootloader*)
APP_TYPE ?= BOOT_NONE

ifeq ($(APP_TYPE), BOOT_NONE)

LDSCRIPT ?= $(SYSTEM_FILES_DIR)/STM32H750IB_flash.lds
USBPID = $(STM_PID)
FLASH_ADDRESS ?= $(INTERNAL_ADDRESS)

# libraries
else ifeq ($(APP_TYPE), BOOT_SRAM)

LDSCRIPT ?= $(SYSTEM_FILES_DIR)/STM32H750IB_sram.lds
USBPID = $(DAISY_PID)
FLASH_ADDRESS ?= $(QSPI_ADDRESS)
C_DEFS += -DBOOT_APP

else ifeq ($(APP_TYPE), BOOT_QSPI)

LDSCRIPT ?= $(SYSTEM_FILES_DIR)/STM32H750IB_qspi.lds
USBPID = $(DAISY_PID)
FLASH_ADDRESS ?= $(QSPI_ADDRESS)
C_DEFS += -DBOOT_APP

else

$(error Unkown app type "$(APP_TYPE)")

endif

#######################################
# LDFLAGS
#######################################
# libraries
LIBS += -ldaisy -lc -lm -lnosys
LIBDIR += -L$(LIBDAISY_DIR)/build
#LIBDIR = -L./VisualGDB/Release
Expand Down Expand Up @@ -277,22 +313,24 @@ debug:
debug_client:
ddd --eval-command="target remote localhost:3333" --debugger $(GDB) $(TARGET_ELF)

ifeq ($(APP_TYPE), BOOT_NONE)
program:
$(OCD) -s $(OCD_DIR) $(OCDFLAGS) \
-c "program ./build/$(TARGET).elf verify reset exit"
else
program:
$(error Cannot program via openocd with an app type of "$(APP_TYPE)". Try program-dfu instead)
endif

#######################################
# dfu-util
#######################################

program-dfu:
dfu-util -a 0 -s $(FLASH_ADDRESS):leave -D $(BUILD_DIR)/$(TARGET_BIN) -d ,0483:df11

program-app:
dfu-util -a 0 -s $(QSPI_ADDRESS):leave -D $(BUILD_DIR)/$(TARGET_BIN) -d ,0483:df11
dfu-util -a 0 -s $(FLASH_ADDRESS):leave -D $(BUILD_DIR)/$(TARGET_BIN) -d ,0483:$(USBPID)

program-boot:
dfu-util -a 0 -s $(FLASH_ADDRESS):leave -D $(BOOT_BIN) -d ,0483:df11
dfu-util -a 0 -s $(INTERNAL_ADDRESS):leave -D $(BOOT_BIN) -d ,0483:$(STM_PID)

#######################################
# dependencies
Expand Down
2 changes: 1 addition & 1 deletion hosts/daisy/vendor/libDaisy/core/STM32H750IB_sram.lds
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MEMORY
{
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K - 32K
RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit d65247b

Please sign in to comment.