From 5b48a5c2f5526f088187fa341f64368994c9f517 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Wed, 24 Jul 2019 17:37:22 -0400 Subject: Remove packed structs. These were causing hard faults when trying to deref a borrow, presumably because of a lack of field alignment. This does mean structs aren't the correct size (e.g., USBConfigurationDescription is 10 bytes instead of 9 on thumb6), so another solution needs to be fonud for getting data in and out of structs with a minimum of overhead. --- app/src/usb/pipe.rs | 2 +- app/src/usb/usbproto.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/src/usb/pipe.rs b/app/src/usb/pipe.rs index 908c8e5..2efb29b 100644 --- a/app/src/usb/pipe.rs +++ b/app/src/usb/pipe.rs @@ -465,7 +465,7 @@ impl PipeDesc { } #[derive(Clone, Copy, Debug)] -#[repr(C, packed)] +#[repr(C)] // 16 bytes per bank. pub(crate) struct BankDesc { pub addr: Addr, diff --git a/app/src/usb/usbproto.rs b/app/src/usb/usbproto.rs index 9a86ed7..9c1dbcb 100644 --- a/app/src/usb/usbproto.rs +++ b/app/src/usb/usbproto.rs @@ -7,7 +7,7 @@ // documentation. #[derive(Copy, Clone, Debug, Default)] -#[repr(C, packed)] +#[repr(C)] pub struct USBDeviceDescriptor { pub b_length: u8, pub b_descriptor_type: u8, @@ -26,7 +26,7 @@ pub struct USBDeviceDescriptor { } #[derive(Copy, Clone, Debug, Default)] -#[repr(C, packed)] +#[repr(C)] pub struct USBConfigurationDescriptor { pub b_length: u8, pub b_descriptor_type: u8, @@ -39,7 +39,7 @@ pub struct USBConfigurationDescriptor { } #[derive(Copy, Clone, Debug, Default)] -#[repr(C, packed)] +#[repr(C)] pub struct USBInterfaceDescriptor { pub b_length: u8, pub b_descriptor_type: u8, @@ -53,7 +53,7 @@ pub struct USBInterfaceDescriptor { } #[derive(Copy, Clone, Debug, Default)] -#[repr(C, packed)] +#[repr(C)] pub struct USBEndpointDescriptor { pub b_length: u8, pub b_descriptor_type: u8, @@ -64,7 +64,7 @@ pub struct USBEndpointDescriptor { } #[derive(Copy, Clone, Debug)] -#[repr(C, packed)] +#[repr(C)] pub struct USBSetupPacket { pub bm_request_type: BMRequestType, pub b_request: USBRequest, -- cgit v1.2.3