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

Bootloader v6.0 #548

Merged
merged 15 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

## Unreleased

### Features

* bootloader: added `System::BootloaderMode::DAISY` and `System::BootloaderMode::DAISY_SKIP_TIMEOUT` options to `System::ResetToBootloader` method for better firmware updating flexibility

### Bug fixes

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

### Migrating

#### Bootloader

* 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

### Features
Expand Down Expand Up @@ -29,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 @@ -74,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 @@ -223,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 @@ -417,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
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 - 32K
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 @@ -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 removed core/dsy_bootloader_v5_4.bin
Binary file not shown.
Binary file added core/dsy_bootloader_v6.bin
Binary file not shown.
12 changes: 9 additions & 3 deletions src/daisy_seed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,23 @@ void DaisySeed::Init(bool boost)
testpoint.mode = DSY_GPIO_MODE_OUTPUT_PP;


auto memory = System::GetProgramMemoryRegion();
auto memory = System::GetProgramMemoryRegion();
auto boot_version = System::GetBootloaderVersion();

if(memory != System::MemoryRegion::INTERNAL_FLASH)
if(boot_version == System::BootInfo::Version::LT_v6_0
&& memory != System::MemoryRegion::INTERNAL_FLASH)
{
syscfg.skip_clocks = true;
}

system.Init(syscfg);

if(memory != System::MemoryRegion::QSPI)
qspi.Init(qspi_config);

if(memory == System::MemoryRegion::INTERNAL_FLASH)
if(boot_version != System::BootInfo::Version::LT_v6_0
|| (boot_version == System::BootInfo::Version::LT_v6_0
&& memory == System::MemoryRegion::INTERNAL_FLASH))
{
dsy_gpio_init(&led);
dsy_gpio_init(&testpoint);
Expand Down
26 changes: 13 additions & 13 deletions src/sys/ffconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define _FFCONF 68300 /**< Revision ID */

/*-----------------------------------------------------------------------------/
/ Additional user header to be used
/ Additional user header to be used
/-----------------------------------------------------------------------------*/

#include "util/bsp_sd_diskio.h"
Expand All @@ -32,14 +32,14 @@
/-----------------------------------------------------------------------------*/

#define _FS_READONLY \
0 /**< 0:Read/Write or 1:Read only
0 /**< 0:Read/Write or 1:Read only
This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */

#define _FS_MINIMIZE \
0 /**< 0 to 3
0 /**< 0 to 3
This option defines minimization level to remove some basic API functions.
/
/ 0: All basic functions are enabled.
Expand All @@ -49,7 +49,7 @@
/ 3: f_lseek() function is removed in addition to 2. */

#define _USE_STRFUNC \
2 /**< 0:Disable or 1-2:Enable
2 /**< 0:Disable or 1-2:Enable
This option switches string functions, f_gets(), f_putc(), f_puts() and
/ f_printf().
/
Expand Down Expand Up @@ -132,7 +132,7 @@
/ ff_memfree(), must be added to the project. */

#define _LFN_UNICODE \
0 /**< 0:ANSI/OEM or 1:Unicode
0 /**< 0:ANSI/OEM or 1:Unicode
This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16)
/ To use Unicode string for the path name, enable LFN and set _LFN_UNICODE = 1.
/ This option also affects behavior of string I/O functions. */
Expand All @@ -149,7 +149,7 @@ This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16)
/ This option has no effect when _LFN_UNICODE == 0. */

#define _FS_RPATH \
0 /**< 0 to 2
2 /**< 0 to 2
This option configures support of relative path.
/
/ 0: Disable relative path and remove related functions.
Expand Down Expand Up @@ -186,7 +186,7 @@ This option switches support of multi-partition on a physical drive.
/ funciton will be available. */
#define _MIN_SS 512 /**< 512, 1024, 2048 or 4096 */
#define _MAX_SS \
512 /**< 512, 1024, 2048 or 4096
512 /**< 512, 1024, 2048 or 4096
These options configure the range of sector size to be supported. (512, 1024,
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
/ harddisk. But a larger value may be required for on-board flash memory and some
Expand All @@ -200,7 +200,7 @@ This option switches support of multi-partition on a physical drive.
/ disk_ioctl() function. */

#define _FS_NOFSINFO \
0 /**< 0,1,2 or 3
0 /**< 0,1,2 or 3
If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
Expand All @@ -216,7 +216,7 @@ This option switches support of multi-partition on a physical drive.
/----------------------------------------------------------------------------*/

#define _FS_TINY \
0 /**< 0:Normal or 1:Tiny
0 /**< 0:Normal or 1:Tiny
This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
Expand All @@ -231,18 +231,18 @@ This option switches support of multi-partition on a physical drive.
#define _NORTC_MON 6 /**< & */
#define _NORTC_MDAY 4 /**< & */
#define _NORTC_YEAR \
2015 /**<
The option _FS_NORTC switches timestamp functiton. If the system does not have
2015 /**<
The option _FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set _FS_NORTC = 1 to disable
/ the timestamp function. All objects modified by FatFs will have a fixed timestamp
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time.
/ To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to get current time form real-time clock. _NORTC_MON,
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
/ These options have no effect at read-only configuration (_FS_READONLY = 1). */

#define _FS_LOCK \
0 /**< 0:Disable or >=1:Enable
0 /**< 0:Disable or >=1:Enable
The option _FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
/ is 1.
Expand Down
Loading