1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
//! Code and types for creating Picotool compatible "Binary Info" metadata
//!
//! ## Example usage
//!
//! Enable the Cargo feature `binary-info`.
//!
//! Add this to your linker script (usually named `memory.x`):
//!
//! ```not_rust,ignore
//! SECTIONS {
//! /* ### Boot ROM info
//! *
//! * Goes after .vector_table, to keep it in the first 512 bytes of flash,
//! * where picotool can find it
//! */
//! .boot_info : ALIGN(4)
//! {
//! KEEP(*(.boot_info));
//! } > FLASH
//!
//! } INSERT AFTER .vector_table;
//!
//! /* move .text to start /after/ the boot info */
//! _stext = ADDR(.boot_info) + SIZEOF(.boot_info);
//!
//! SECTIONS {
//! /* ### Picotool 'Binary Info' Entries
//! *
//! * Picotool looks through this block (as we have pointers to it in our
//! * header) to find interesting information.
//! */
//! .bi_entries : ALIGN(4)
//! {
//! /* We put this in the header */
//! __bi_entries_start = .;
//! /* Here are the entries */
//! KEEP(*(.bi_entries));
//! /* Keep this block a nice round size */
//! . = ALIGN(4);
//! /* We put this in the header */
//! __bi_entries_end = .;
//! } > FLASH
//! } INSERT AFTER .text;
//!
//! SECTIONS {
//! .flash_end : {
//! __flash_binary_end = .;
//! } > FLASH
//! } INSERT AFTER .uninit;
//! ```
//!
//! Then, add this to your Rust code:
//!
//! ```
//! #[link_section = ".bi_entries"]
//! #[cfg(all(feature = "binary-info", target_os = "none"))]
//! #[used]
//! pub static PICOTOOL_ENTRIES: [rp_binary_info::EntryAddr; 4] = [
//! rp_binary_info::rp_program_name!(c"Program Name Here"),
//! rp_binary_info::rp_cargo_version!(),
//! rp_binary_info::rp_binary_end!(__flash_binary_end),
//! rp_binary_info::int!(
//! rp_binary_info::make_tag(b"JP"),
//! 0x0000_0001,
//! 0x12345678
//! ),
//! ];
//!
//! extern "C" {
//! static __flash_binary_end: u32;
//! }
//! ```
//!
//! ## Cargo features
//!
//! The `binary-info` Cargo feature enables emitting the main `PICOTOOL_HEADER`
//! static, which is what Picotool looks for to discover the binary info.
//!
//! It is optional to allow you to emit the static yourself differently, for e.g.
//! compatibility with different linker scripts, while still allowing using the
//! rest of the utilities in the crate to format the info.
pub use *;
extern "C"
/// Picotool can find this block in our ELF file and report interesting
/// metadata.
///
/// The data here tells picotool the start and end flash addresses of our
/// metadata.
// addr_of! is safe since rust 1.82.0
pub static PICOTOOL_HEADER: Header = unsafe ;
/// This tells picotool how to convert RAM addresses back into Flash addresses
pub static MAPPING_TABLE: = ;
/// Create a 'Binary Info' entry containing the program name
///
/// This is well-known to picotool, and will be displayed if you run `picotool info`.
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * ID: [`consts::ID_RP_PROGRAM_NAME`]
pub const
/// Create a 'Binary Info' entry containing the program version.
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_VERSION_STRING`]
pub const
/// Create a 'Binary Info' entry with a URL
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_URL`]
pub const
/// Create a 'Binary Info' with the program build date
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_BUILD_DATE_STRING`]
pub const
/// Create a 'Binary Info' with the size of the binary
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_BINARY_END`]
pub const
/// Create a 'Binary Info' with a description of the program
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_DESCRIPTION`]
pub const
/// Create a 'Binary Info' with some feature of the program
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_FEATURE`]
pub const
/// Create a 'Binary Info' with some whether this was a Debug or Release build
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PROGRAM_BUILD_ATTRIBUTE`]
pub const
/// Create a 'Binary Info' with the Pico SDK version used
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_SDK_VERSION`]
pub const
/// Create a 'Binary Info' with which board this program targets
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_PICO_BOARD`]
pub const
/// Create a 'Binary Info' with which `boot2` image this program uses
///
/// * Tag: [`consts::TAG_RASPBERRY_PI`]
/// * Id: [`consts::ID_RP_BOOT2_NAME`]
pub const
/// Create a tag from two ASCII letters.
///
/// ```
/// let tag = rp_binary_info::make_tag(b"RP");
/// assert_eq!(tag, 0x5052);
/// ```
pub const
// End of file