1473: Protect default implementations for FirmwareUpdater and BootLoader r=lulf a=rmja

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.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
This commit is contained in:
bors[bot] 2023-05-22 09:52:56 +00:00 committed by GitHub
commit ab7d129e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {