Skip to content

Commit be44533

Browse files
authored
Merge pull request #9 from xobs/big-endian-support
Add big endian support
2 parents 877d21b + b0c8c1d commit be44533

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

memory.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ SECTIONS {
1616

1717
*(.text)
1818
*(.text.*)
19+
/* TI naming convention */
20+
*(.text:*)
1921

2022
*(.rodata)
2123
*(.rodata.*)

src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,35 +185,35 @@ macro_rules! algorithm {
185185
#[link_section = "DeviceData"]
186186
pub static FlashDevice: FlashDeviceDescription = FlashDeviceDescription {
187187
// The version is never read by probe-rs and can be fixed.
188-
vers: 0x1,
188+
vers: 0x1u16.to_le(),
189189
// The device name here can be customized but it really has no real use
190190
// appart from identifying the device the ELF is intended for which we have
191191
// in our YAML.
192192
dev_name: $crate::arrayify_string($device_name),
193193
// The specification does not specify the values that can go here,
194194
// but this value means internal flash device.
195-
dev_type: $device_type,
196-
dev_addr: $flash_address,
197-
device_size: $flash_size,
198-
page_size: $page_size,
195+
dev_type: ($device_type as u16).to_le(),
196+
dev_addr: ($flash_address as u32).to_le(),
197+
device_size: ($flash_size as u32).to_le(),
198+
page_size: ($page_size as u32).to_le(),
199199
_reserved: 0,
200200
// The empty state of a byte in flash.
201-
empty: $empty_value,
201+
empty: ($empty_value as u8).to_le(),
202202
// This value can be used to estimate the amount of time the flashing procedure takes worst case.
203-
program_time_out: $program_time_out,
203+
program_time_out: ($program_time_out as u32).to_le(),
204204
// This value can be used to estimate the amount of time the erasing procedure takes worst case.
205-
erase_time_out: $erase_time_out,
205+
erase_time_out: ($erase_time_out as u32).to_le(),
206206
flash_sectors: [
207207
$(
208208
FlashSector {
209-
size: $size,
210-
address: $address,
209+
size: ($size as u32).to_le(),
210+
address: ($address as u32).to_le(),
211211
}
212212
),+,
213213
// This marks the end of the flash sector list.
214214
FlashSector {
215-
size: 0xffff_ffff,
216-
address: 0xffff_ffff,
215+
size: 0xffff_ffffu32.to_le(),
216+
address: 0xffff_ffffu32.to_le(),
217217
}
218218
],
219219
};
@@ -222,7 +222,7 @@ macro_rules! algorithm {
222222
pub struct FlashDeviceDescription {
223223
vers: u16,
224224
dev_name: [u8; 128],
225-
dev_type: DeviceType,
225+
dev_type: u16,
226226
dev_addr: u32,
227227
device_size: u32,
228228
page_size: u32,

0 commit comments

Comments
 (0)