diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-05-22 09:52:56 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-22 09:52:56 +0000 |
| commit | ab7d129e152a9450b2a6445397365bcb3a3ce183 (patch) | |
| tree | 24428457642306f1bee8182ffe58da9a03e7554c | |
| parent | d55b9bc6e2de528e1351b992bb30f54ec6f76b6d (diff) | |
| parent | 18c62aa5b475161c0cbd98c23c006691e084cb2b (diff) | |
Merge #1473
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 <[email protected]>
| -rw-r--r-- | embassy-boot/boot/src/firmware_updater.rs | 1 | ||||
| -rw-r--r-- | embassy-boot/nrf/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-boot/rp/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-boot/stm32/src/lib.rs | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/embassy-boot/boot/src/firmware_updater.rs b/embassy-boot/boot/src/firmware_updater.rs index 92987825f..aeea206f9 100644 --- a/embassy-boot/boot/src/firmware_updater.rs +++ b/embassy-boot/boot/src/firmware_updater.rs | |||
| @@ -40,6 +40,7 @@ pub struct FirmwareUpdater { | |||
| 40 | dfu: Partition, | 40 | dfu: Partition, |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | #[cfg(target_os = "none")] | ||
| 43 | impl Default for FirmwareUpdater { | 44 | impl Default for FirmwareUpdater { |
| 44 | fn default() -> Self { | 45 | fn default() -> Self { |
| 45 | extern "C" { | 46 | extern "C" { |
diff --git a/embassy-boot/nrf/src/lib.rs b/embassy-boot/nrf/src/lib.rs index 14bea1f79..710798bdb 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs | |||
| @@ -15,6 +15,7 @@ pub struct BootLoader<const BUFFER_SIZE: usize = PAGE_SIZE> { | |||
| 15 | aligned_buf: AlignedBuffer<BUFFER_SIZE>, | 15 | aligned_buf: AlignedBuffer<BUFFER_SIZE>, |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[cfg(target_os = "none")] | ||
| 18 | impl Default for BootLoader<PAGE_SIZE> { | 19 | impl Default for BootLoader<PAGE_SIZE> { |
| 19 | /// Create a new bootloader instance using parameters from linker script | 20 | /// Create a new bootloader instance using parameters from linker script |
| 20 | fn default() -> Self { | 21 | fn default() -> Self { |
diff --git a/embassy-boot/rp/src/lib.rs b/embassy-boot/rp/src/lib.rs index 0d577f08a..fb9bc3242 100644 --- a/embassy-boot/rp/src/lib.rs +++ b/embassy-boot/rp/src/lib.rs | |||
| @@ -51,6 +51,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> { | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | #[cfg(target_os = "none")] | ||
| 54 | impl Default for BootLoader<ERASE_SIZE> { | 55 | impl Default for BootLoader<ERASE_SIZE> { |
| 55 | /// Create a new bootloader instance using parameters from linker script | 56 | /// Create a new bootloader instance using parameters from linker script |
| 56 | fn default() -> Self { | 57 | fn default() -> Self { |
diff --git a/embassy-boot/stm32/src/lib.rs b/embassy-boot/stm32/src/lib.rs index 88ce1c878..ccf136c74 100644 --- a/embassy-boot/stm32/src/lib.rs +++ b/embassy-boot/stm32/src/lib.rs | |||
| @@ -46,6 +46,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> { | |||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | #[cfg(target_os = "none")] | ||
| 49 | impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> { | 50 | impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> { |
| 50 | /// Create a new bootloader instance using parameters from linker script | 51 | /// Create a new bootloader instance using parameters from linker script |
| 51 | fn default() -> Self { | 52 | fn default() -> Self { |
