Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qspi erase optimization #576

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

## Unreleased

### Bug Fixes
### Features

* patchsm: Corrected gate out pin assignment confusion added by (#417) as noted by [apbianco](https://forum.electro-smith.com/u/apbianco) and [tele_player](https://forum.electro-smith.com/u/tele_player)
* bootloader: added `System::BootloaderMode::DAISY` and `System::BootloaderMode::DAISY_SKIP_TIMEOUT` options to `System::ResetToBootloader` method for better firmware updating flexibility

## v5.3.0
### Bug fixes

### Features
* bootloader: pins `D29` and `D30` are no longer stuck when using the Daisy bootloader

* driver: Software SPI transport `SSD130x4WireSoftSpiTransport` added for the OLED Display driver. (#551)
### Migrating

### Bug Fixes
#### Bootloader

* driver: Fixed a compiler error in `Max11300Driver::WriteAnalogPinVolts()`
* driver: Fixed error reading multiple registers at once from the MPC23x17 GPIO expanders (#550)
* seed: Fixed out of range pin definitions for extra GPIO on the Daisy Seed2 DFM (#544)
* patchsm: Fixed issue where updating the audio callback params didn't update control samplerate (#543)
* This version of libDaisy and greater will be compatible with any version of the Daisy bootloader, meaning you won't have to update the bootloader on your product if you want the latest changes to libDaisy.
* However, for newer versions of the bootloader, you must use a compatible version of libDaisy.
* Daisy bootloader v6.0 and up will only be compatible with libDaisy v5.3 and up.

## v5.2.0

Expand Down Expand Up @@ -46,7 +45,7 @@
* 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.
* 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`

Expand Down Expand Up @@ -91,7 +90,7 @@
* testing: debugging configuration now uses `lldb` debugging extension to support unit test debugging on macOS with Apple Silicon
* driver: oled_ssd130x.h - Add the SpiHandle:Config struct to SSD130x4WireTransport:Config to allow full access to the SPI peripheral configuration.
* hid: fixed issue in `AnalogControl` where computed coeff could be out of range with certain block sizes
* driver: added missing alternate function pin mappings for SPI2, and UART for pins available on the patch_sm hardware
* driver: added missing alternate function pin mappings for SPI2, and UART for pins available on the patch_sm hardware
* usb: fixed issue with MIDI output from USB
* driver: fixed off-by-one error in qspi erase function.

Expand Down Expand Up @@ -240,7 +239,7 @@ max11300driver.ConfigurePinAsAnalogWrite(daisy::MAX11300::PIN_1, daisy::MAX11300

### Other

* switch: Use `System::GetNow()` rather than the update rate to calculate `TimeHeldMs()`.
* switch: Use `System::GetNow()` rather than the update rate to calculate `TimeHeldMs()`.
* This has also been applied to the `Encoder` class (since it uses `Switch` internally).
* usb host: ST Middleware for USB Host support has been added to the Middlewares folder
* fatfs: changed default `FS_LOCK` to 0, allowing for more simultaneously open FIL objects.
Expand Down Expand Up @@ -434,7 +433,7 @@ sdram.Init();

### Other

* test: add unit testing for midi parser.
* test: add unit testing for midi parser.
* tests: add tests for `FIFO`
* docs: Update TODO comment in `uart.h` to reflect most recent uart update.
* ci: add filters to the workflows
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ WARNINGS += -Wall -Wno-attributes -Wno-strict-aliasing -Wno-maybe-uninitialized
CPP_WARNINGS += -Wno-register

# compile gcc flags
ASFLAGS = $(MCU) $(AS_INCLUDES) $(AS_DEFS) -ggdb $(WARNINGS) $(OPT) -fdata-sections -ffunction-sections

CFLAGS = $(MCU) $(C_INCLUDES) $(C_DEFS) -ggdb $(WARNINGS) $(OPT) -fasm -fdata-sections -ffunction-sections
ASFLAGS += $(MCU) $(AS_INCLUDES) $(AS_DEFS) $(WARNINGS) $(OPT) -fdata-sections -ffunction-sections
CFLAGS += $(MCU) $(C_INCLUDES) $(C_DEFS) $(WARNINGS) $(OPT) -fasm -fdata-sections -ffunction-sections

ifeq ($(DEBUG), 1)
ASFLAGS += -g -ggdb
CFLAGS += -g -ggdb
OPT = -O0
C_DEFS += -DDEBUG=1
Expand All @@ -325,7 +325,7 @@ CFLAGS += \
-finline-functions

# C++ Flags
CPPFLAGS = $(CFLAGS) $(CPP_WARNINGS)
CPPFLAGS += $(CFLAGS) $(CPP_WARNINGS)
CPPFLAGS += \
-fno-exceptions \
-fno-rtti
Expand Down
10 changes: 4 additions & 6 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,18 @@ endif
C_INCLUDES += -I$(FATFS_DIR)

# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ASFLAGS += $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -Wno-missing-attributes -fasm -fdata-sections -ffunction-sections -Wno-stringop-overflow

ifeq ($(DEBUG), 1)
ASFLAGS += -g -ggdb
endif

CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -Wno-missing-attributes -fasm -fdata-sections -ffunction-sections -Wno-stringop-overflow

CFLAGS += -g -ggdb
endif

# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"

CPPFLAGS = $(CFLAGS)
CPPFLAGS += $(CFLAGS)
CPPFLAGS += \
-fno-exceptions \
-fasm \
Expand Down
34 changes: 24 additions & 10 deletions core/STM32H750IB_flash.lds
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ ENTRY(Reset_Handler)

MEMORY
{
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2 (RWX) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX) : ORIGIN = 0x90000000, LENGTH = 8M
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2 (RWX) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
BACKUP_SRAM (RWX) : ORIGIN = 0x38800000, LENGTH = 4K
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX) : ORIGIN = 0x90000000, LENGTH = 8M
}

_estack = 0x20020000;
Expand Down Expand Up @@ -122,7 +123,7 @@ SECTIONS
PROVIDE(__bss_end__ = _ebss);
} > SRAM

PROVIDE(end = .);
PROVIDE(end = .);

.dtcmram_bss (NOLOAD) :
{
Expand Down Expand Up @@ -183,8 +184,21 @@ SECTIONS
PROVIDE(__sdram_bss_end = _esdram_bss);
} > SDRAM

.backup_sram (NOLOAD) :
{
. = ALIGN(4);
_sbackup_sram = .;

PROVIDE(__backup_sram_start = _sbackup_sram);
*(.backup_sram)
*(.backup_sram*)
. = ALIGN(4);
_ebackup_sram = .;

PROVIDE(__backup_sram_end = _ebackup_sram);
} > BACKUP_SRAM

.qspiflash_text :
.qspiflash_text :
{
. = ALIGN(4);
_sqspiflash_text = .;
Expand Down
35 changes: 25 additions & 10 deletions core/STM32H750IB_qspi.lds
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ ENTRY(Reset_Handler)

MEMORY
{
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
BACKUP_SRAM (RWX) : ORIGIN = 0x38800000, LENGTH = 4K
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX) : ORIGIN = 0x90040000, LENGTH = 7936K
}

_estack = 0x20020000;
Expand Down Expand Up @@ -136,7 +137,7 @@ SECTIONS
_ebss = .;

PROVIDE(__bss_end__ = _ebss);
} > SRAM
} > SRAM

.dtcmram_bss (NOLOAD) :
{
Expand Down Expand Up @@ -183,6 +184,20 @@ SECTIONS
PROVIDE(__sdram_bss_end = _esdram_bss);
} > SDRAM

.backup_sram (NOLOAD) :
{
. = ALIGN(4);
_sbackup_sram = .;

PROVIDE(__backup_sram_start = _sbackup_sram);
*(.backup_sram)
*(.backup_sram*)
. = ALIGN(4);
_ebackup_sram = .;

PROVIDE(__backup_sram_end = _ebackup_sram);
} > BACKUP_SRAM


/* .qspiflash_text :
{
Expand Down
36 changes: 25 additions & 11 deletions core/STM32H750IB_sram.lds
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ ENTRY(Reset_Handler)

MEMORY
{
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
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
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K
DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K
SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K - 32K
RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K
BACKUP_SRAM (RWX) : ORIGIN = 0x38800000, LENGTH = 4K
ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K
SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M
QSPIFLASH (RX) : ORIGIN = 0x90040000, LENGTH = 7936K
}

_estack = 0x20020000;
Expand Down Expand Up @@ -135,7 +136,7 @@ SECTIONS
_ebss = .;

PROVIDE(__bss_end__ = _ebss);
} > DTCMRAM
} > DTCMRAM

.dtcmram_bss (NOLOAD) :
{
Expand Down Expand Up @@ -182,8 +183,21 @@ SECTIONS
PROVIDE(__sdram_bss_end = _esdram_bss);
} > SDRAM

.backup_sram (NOLOAD) :
{
. = ALIGN(4);
_sbackup_sram = .;

PROVIDE(__backup_sram_start = _sbackup_sram);
*(.backup_sram)
*(.backup_sram*)
. = ALIGN(4);
_ebackup_sram = .;

PROVIDE(__backup_sram_end = _ebackup_sram);
} > BACKUP_SRAM

.qspiflash_text :
.qspiflash_text :
{
. = ALIGN(4);
_sqspiflash_text = .;
Expand Down
Binary file added core/dsy_bootloader_v6_1.bin
Binary file not shown.
6 changes: 5 additions & 1 deletion src/daisy.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "hid/disp/display.h"
#include "hid/disp/oled_display.h"
#include "hid/disp/graphics_common.h"
#include "hid/wavplayer.h"
#include "hid/led.h"
#include "hid/rgb_led.h"
#include "dev/sr_595.h"
Expand Down Expand Up @@ -68,7 +67,12 @@
#include "util/PersistentStorage.h"
#include "util/Stack.h"
#include "util/VoctCalibration.h"

#ifdef USE_FATFS
#include "hid/wavplayer.h"
#include "util/WaveTableLoader.h"
#include "util/WavWriter.h"
#endif

#endif
#endif
2 changes: 1 addition & 1 deletion src/daisy_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ FORCE_INLINE dsy_gpio_pin dsy_pin(dsy_gpio_port port, uint8_t pin)
*
* Please use Pin struct instead.
*/
FORCE_INLINE uint8_t dsy_pin_cmp(dsy_gpio_pin *a, dsy_gpio_pin *b)
FORCE_INLINE uint8_t dsy_pin_cmp(const dsy_gpio_pin *a, const dsy_gpio_pin *b)
{
return ((a->port == b->port) && (a->pin == b->pin));
}
Expand Down
25 changes: 17 additions & 8 deletions src/daisy_patch_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace patch_sm
DUMMYPIN, /**< B2 - Audio Out Left*/
DUMMYPIN, /**< B3 - Audio In Right */
DUMMYPIN, /**< B4 - Audio In Left */
{DSY_GPIOC, 14}, /**< B5 - GATE OUT 1 */
{DSY_GPIOC, 13}, /**< B6 - GATE OUT 2 */
{DSY_GPIOC, 13}, /**< B5 - GATE OUT 1 */
{DSY_GPIOC, 14}, /**< B6 - GATE OUT 2 */
{DSY_GPIOB, 8}, /**< B7 - I2C1 SCL */
{DSY_GPIOB, 9}, /**< B8 - I2C1 SDA */
{DSY_GPIOG, 14}, /**< B9 - GATE IN 2 */
Expand Down Expand Up @@ -216,7 +216,7 @@ namespace patch_sm
}
}

/** Actual DaisyPatchSM implementation
/** Actual DaisyPatchSM implementation
* With the pimpl model in place, we can/should probably
* move the rest of the implementation to the Impl class
*/
Expand All @@ -229,13 +229,22 @@ namespace patch_sm
System::Config syscfg;
syscfg.Boost();

auto memory = System::GetProgramMemoryRegion();
if(memory != System::MemoryRegion::INTERNAL_FLASH)
auto memory = System::GetProgramMemoryRegion();
auto boot_version = System::GetBootloaderVersion();

// When using the bootloader prior to v6, clocks have been already configured
if(boot_version == System::BootInfo::Version::LT_v6_0
&& memory != System::MemoryRegion::INTERNAL_FLASH)
{
syscfg.skip_clocks = true;
}

system.Init(syscfg);
/** Memories */
if(memory == System::MemoryRegion::INTERNAL_FLASH)
// When using the bootloader priori to v6, SDRAM has been already configured
if(boot_version != System::BootInfo::Version::LT_v6_0
|| (boot_version == System::BootInfo::Version::LT_v6_0
&& memory == System::MemoryRegion::INTERNAL_FLASH))
{
/** FMC SDRAM */
sdram.Init();
Expand Down Expand Up @@ -331,12 +340,12 @@ namespace patch_sm

gate_out_1.mode = DSY_GPIO_MODE_OUTPUT_PP;
gate_out_1.pull = DSY_GPIO_NOPULL;
gate_out_1.pin = B5;
gate_out_1.pin = B6;
dsy_gpio_init(&gate_out_1);

gate_out_2.mode = DSY_GPIO_MODE_OUTPUT_PP;
gate_out_2.pull = DSY_GPIO_NOPULL;
gate_out_2.pin = B6;
gate_out_2.pin = B5;
dsy_gpio_init(&gate_out_2);

/** DAC init */
Expand Down
Loading