From 08dd8baf639ae6e62ed7be0ade2e8ea15a7f1857 Mon Sep 17 00:00:00 2001 From: rdi Date: Tue, 5 Dec 2023 17:28:47 +0100 Subject: [PATCH] Update setup for bootloader v6 --- .../erbui/generators/daisy/code_template.cpp | 20 +++++++++++++++---- .../erbui/generators/perf/code_template.cpp | 20 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/build-system/erbui/generators/daisy/code_template.cpp b/build-system/erbui/generators/daisy/code_template.cpp index cd436e7e..4f60c7ef 100644 --- a/build-system/erbui/generators/daisy/code_template.cpp +++ b/build-system/erbui/generators/daisy/code_template.cpp @@ -57,9 +57,14 @@ int main () config.Boost (); auto program_memory_section = daisy::System::GetProgramMemoryRegion (); + auto boot_version = daisy::System::GetBootloaderVersion (); - // When using the bootloader, clocks have been already configured - if (program_memory_section != daisy::System::MemoryRegion::INTERNAL_FLASH) + // When using the bootloader prior to v6, clocks have been already configured + + if ( + (boot_version == daisy::System::BootInfo::Version::LT_v6_0) + && (program_memory_section != daisy::System::MemoryRegion::INTERNAL_FLASH) + ) { config.skip_clocks = true; } @@ -68,8 +73,15 @@ int main () // Init SDRAM - // When using the bootloader, SDRAM has been already configured - if (program_memory_section == daisy::System::MemoryRegion::INTERNAL_FLASH) + // When using the bootloader priori to v6, SDRAM has been already configured + + if ( + (boot_version != daisy::System::BootInfo::Version::LT_v6_0) + || ( + (boot_version == daisy::System::BootInfo::Version::LT_v6_0) + && (program_memory_section == daisy::System::MemoryRegion::INTERNAL_FLASH) + ) + ) { SdramHandle sdram; sdram.Init (); diff --git a/build-system/erbui/generators/perf/code_template.cpp b/build-system/erbui/generators/perf/code_template.cpp index ea1452fe..6ab941bd 100644 --- a/build-system/erbui/generators/perf/code_template.cpp +++ b/build-system/erbui/generators/perf/code_template.cpp @@ -127,9 +127,14 @@ int main () config.Boost (); auto program_memory_section = daisy::System::GetProgramMemoryRegion (); + auto boot_version = daisy::System::GetBootloaderVersion (); - // When using the bootloader, clocks have been already configured - if (program_memory_section != daisy::System::MemoryRegion::INTERNAL_FLASH) + // When using the bootloader prior to v6, clocks have been already configured + + if ( + (boot_version == daisy::System::BootInfo::Version::LT_v6_0) + && (program_memory_section != daisy::System::MemoryRegion::INTERNAL_FLASH) + ) { config.skip_clocks = true; } @@ -138,8 +143,15 @@ int main () // Init SDRAM - // When using the bootloader, SDRAM has been already configured - if (program_memory_section == daisy::System::MemoryRegion::INTERNAL_FLASH) + // When using the bootloader priori to v6, SDRAM has been already configured + + if ( + (boot_version != daisy::System::BootInfo::Version::LT_v6_0) + || ( + (boot_version == daisy::System::BootInfo::Version::LT_v6_0) + && (program_memory_section == daisy::System::MemoryRegion::INTERNAL_FLASH) + ) + ) { SdramHandle sdram; sdram.Init ();