Protect default implementations for FirmwareUpdater and BootLoader

It seems as if the arm compiler can does not care about whether the bootloader symbols are undefined if the default() function is never used. The x64 compiler does care however, so this change ensures that we can instantiate the types from tests.
This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-22 11:32:39 +02:00
parent d55b9bc6e2
commit 18c62aa5b4
4 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,7 @@ pub struct FirmwareUpdater {
dfu: Partition, dfu: Partition,
} }
#[cfg(target_os = "none")]
impl Default for FirmwareUpdater { impl Default for FirmwareUpdater {
fn default() -> Self { fn default() -> Self {
extern "C" { extern "C" {

View File

@ -15,6 +15,7 @@ pub struct BootLoader<const BUFFER_SIZE: usize = PAGE_SIZE> {
aligned_buf: AlignedBuffer<BUFFER_SIZE>, aligned_buf: AlignedBuffer<BUFFER_SIZE>,
} }
#[cfg(target_os = "none")]
impl Default for BootLoader<PAGE_SIZE> { impl Default for BootLoader<PAGE_SIZE> {
/// Create a new bootloader instance using parameters from linker script /// Create a new bootloader instance using parameters from linker script
fn default() -> Self { fn default() -> Self {

View File

@ -51,6 +51,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
} }
} }
#[cfg(target_os = "none")]
impl Default for BootLoader<ERASE_SIZE> { impl Default for BootLoader<ERASE_SIZE> {
/// Create a new bootloader instance using parameters from linker script /// Create a new bootloader instance using parameters from linker script
fn default() -> Self { fn default() -> Self {

View File

@ -46,6 +46,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
} }
} }
#[cfg(target_os = "none")]
impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> { impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> {
/// Create a new bootloader instance using parameters from linker script /// Create a new bootloader instance using parameters from linker script
fn default() -> Self { fn default() -> Self {