AVR-LibC  2.3.0git
Standard C library for AVR-GCC
 

AVR-LibC Documen­tation

AVR-LibC Development Pages

Main Page

User Manual

Library Refe­rence

FAQ

Example Projects

File List

Index

Loading...
Searching...
No Matches
flash.h
Go to the documentation of this file.
1/* Copyright (c) 2002-2025 Joerg Wunsch
2 All rights reserved.
3
4 Portions of documentation Copyright (c) 1990, 1991, 1993
5 The Regents of the University of California.
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
11
12 * Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14
15 * Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in
17 the documentation and/or other materials provided with the
18 distribution.
19
20 * Neither the name of the copyright holders nor the names of
21 contributors may be used to endorse or promote products derived
22 from this software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE. */
35
36#ifndef _AVR_FLASH_H_
37#define _AVR_FLASH_H_
38
39#if !defined(__AVR_TINY__) && !defined(__cplusplus)
40
41#ifdef __DOXYGEN__
42/** \file */
43/** \defgroup avr_flash <avr/flash.h>: Utilities for named address-spaces __flash and __flashx
44
45 \since AVR-LibC v2.3
46
47 \code
48 #include <avr/flash.h>
49 \endcode
50
51 The functions and macros in this module provide interfaces for a program
52 to use data stored in program space (flash memory) by means of the
53 #__flash and #__flashx named address-spaces
54 supported by avr-gcc.
55
56 <h3>Purpose</h3>
57 The prototypes and macros provided by this header allow to write
58 C programs that are address-space correct, i.e. they will compile
59 without diagnostics due to <tt>-Waddr-space-convert</tt>.
60
61 For example, you can call #printf_P with a format string located
62 in RAM resulting in non-functional code, and the compiler won't complain.
63 This is different with #printf_F which will trigger a diagnostic when
64 <tt>-Waddr-space-convert</tt> is on, and you feed in a format string that
65 does not carry the #__flash named address-space qualifier.
66
67 <h3>Structure of this Header</h3>
68
69 This header provides:
70
71 - Functions from \c stdio.h, \c string.h resp. \c avr/pgmspace.h, but
72 where one input string resides in the 16-bit address-space #__flash.
73 For example, the #strlen_F function works the same like the "progmem"
74 function #strlen_P but uses a prototype that describes the flash string
75 as <tt>const __flash char*</tt>.
76
77 - Functions from \c string.h resp. \c avr/pgmspace.h, but where one
78 input string resides in 24-bit address-space #__flashx.
79 For example, the #strlen_FX function works the same like the "far"
80 function #strlen_PF but uses a prototype that describes the flash string
81 as <tt>const __flashx char*</tt>.
82
83 - Some macros for convenience.
84
85 <h3>Examples</h3>
86
87 \code
88#include <stdbool.h>
89#include <avr/flash.h>
90
91// Array of string literals where the array
92// and also the literals reside in __flash.
93const __flash char* const __flash pets[] =
94{
95 FLIT("gnu"), FLIT("cat"), FLIT("bat"), FLIT("rat")
96};
97
98void test_pet (const char *pet, const __flash char *what)
99{
100 const __flash char *yesno;
101 bool is_what = ! strcmp_F (pet, what);
102 yesno = is_what ? FSTR("yes") : FSTR("no");
103
104 // %S denotes a string in lower 64 KiB flash.
105 printf_FSTR ("%s is a %S? %S!\n", pet, what, yesno);
106}
107
108int main (void)
109{
110 char pet[] = "cat";
111 for (size_t i = 0; i < sizeof (pets) / sizeof (*pets); ++i)
112 {
113 pet[0] ^= 1;
114 test_pet (pet, pets[i]);
115 }
116 return 0;
117}
118 \endcode
119 It will print
120\verbatim
121bat is a gnu? no!
122cat is a cat? yes!
123bat is a bat? yes!
124cat is a rat? no!
125\endverbatim
126 provided stdout has been set up appropriately.
127
128 <h3>Efficiency</h3>
129
130 The internal handling of 64-bit values in avr-gcc is such that it splits
131 them into single byte operations for the purpose of moving them around.
132 This can lead to quite some overhead when reading such values from
133 named address-spaces. To that end, <tt>avr/flash.h</tt> provides some
134 inline functions like #flash_read_u64 and #flashx_read_double that
135 work similar to the #pgm_read_u64 and #pgm_read_double_far functions,
136 but are coming with proper address-space qualification.
137
138 <h3>Limitations</h3>
139
140 - Named address-spaces are supported by avr-gcc as part of GNU-C
141 (e.g. <tt>-std=gnu99</tt>). They are not available in Standard C,
142 and are not supported in C++.
143
144 - Address-spaces #__flash and #__memx are supported since
145 avr-gcc v4.7 (Release 2012), whereas #__flashx is available
146 since avr-gcc v15 (Release 2025).
147
148 - Named address-spaces are not supported for Reduced Tiny (core AVRrc,
149 <tt>-mmcu=avrtiny</tt>), like ATtiny10, ATtiny102 or ATtiny40.
150
151 <h3>Further Reading</h3>
152
153 - <a href="https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#AVR-Named-Address-Spaces"
154 >avr-gcc: Named Address-Spaces</a>
155*/
156
157/** \name Macros */
158
159/** \ingroup avr_flash
160 \def FSTR(str)
161
162 Used to get a pointer to a static string in address-space #__flash.
163 This macro can only be used in the context of a funcion, like in:
164
165 \code
166 #include <avr/flash.h>
167
168 void say_hello (int x)
169 {
170 printf_F (FSTR ("Hello number %d\n"), x);
171
172 // Same effect, but more convenient.
173 printf_FSTR ("Hello number %d\n", x);
174 }
175 \endcode
176 #FSTR works similar to the #PSTR macro but returns a pointer to the 16-bit
177 named address-space #__flash, whereas #PSTR returns a 16-bit
178 address in the generic address-space (but isn't).
179*/
180# define FSTR(str) ({ static const __flash char c[] = (str); &c[0]; })
181
182/** \ingroup avr_flash
183 Used to get a pointer to a static string in the 24-bit address-space
184 #__flashx.
185 This macro can only be used in the context of a funcion, like in:
186
187 \code
188 #include <stdbool.h>
189 #include <avr/flash.h>
190
191 bool text_contains_dog (const char *text)
192 {
193 return strstr_FX (text, FXSTR ("dog")) != NULL;
194 }
195 \endcode
196 #FXSTR works similar to the #PSTR_FAR macro but returns a pointer to
197 the 24-bit named address-space #__flashx, whereas #PSTR_FAR returns
198 a 32-bit integer that represents an address in the generic address-space
199 (but isn't).
200*/
201# define FXSTR(str) ({ static const __flashx char c[] = (str); &c[0]; })
202
203/** \ingroup avr_flash
204 Turn string literal \p str into a compound literal in address-space
205 #__flash. This macro can be used to construct arrays of string pointers:
206 Suppose the following 2-dimensional array of animal names:
207 \code
208 // Each string occupies 13 bytes, hence
209 // animals[] occupies 9 * 13 = 117 bytes.
210 const __flash char animals[][13] =
211 {
212 "hippopotamus",
213 "cat", "pig", "gnu", "bat",
214 "dog", "cow", "fox", "rat"
215 };
216 \endcode
217 A more memory-friendly way to represent the strings is an
218 array of string \e pointers, like in:
219 \code
220 // Occupies 9*2 + 13 + 8*4 = 63 bytes
221 const char* const animals2[] =
222 {
223 "hippopotamus",
224 "cat", "pig", "gnu", "bat",
225 "dog", "cow", "fox", "rat"
226 };
227 \endcode
228 \c animals2[] occupies only 63 bytes (9 * 2 bytes for the string
229 addresses plus the lengths of the very strings). However, all
230 objects are located in the generic address-space. When all objects
231 should be put in a non-generic address-space like #__flash,
232 then the type of the literals has to be forced to be
233 <tt>const __flash char[]</tt>. This can be accomplished with #FLIT:
234 \code
235 // Occupies 9*2 + 13 + 8*4 = 63 bytes
236 const __flash char* const __flash animals3[] =
237 {
238 FLIT("hippopotamus"),
239 FLIT("cat"), FLIT("pig"), FLIT("gnu"), FLIT("bat"),
240 FLIT("dog"), FLIT("cow"), FLIT("fox"), FLIT("rat")
241 };
242 \endcode
243 Notice the two #__flash's in the declarator: The left one says that the
244 pointed-to strings are in #__flash, whereas the right one says that
245 the \c animals3[] array itself resides in #__flash.
246
247 Unfortunately, to date (avr-gcc v15), #FLIT can only be used at
248 global scope. Though what works in a function is using
249 \c constexpr as introduced in C23:
250 \code
251 void func (int i)
252 {
253 static constexpr __flash char s_hip[] = "hippopotamus";
254 static constexpr __flash char s_cat[] = "cat";
255 // ...
256 static const __flash char* const __flash animals4[] =
257 {
258 s_hip, s_cat, // ...
259 };
260 printf_FSTR ("Animal %d = %S\n", i, animals4[i]);
261 }
262 \endcode */
263#define FLIT(str) ((const __flash char[]) { str })
264
265/** \ingroup avr_flash
266 Turn string literal \p str into a compound literal in address-space
267 #__flashx. This macro can be used to construct arrays of string pointers.
268
269 For example code and usage, see the #FLIT macro. */
270#define FXLIT(str) ((const __flashx char[]) { str })
271
272/** \name Functions from string.h, but one argument is in address-space __flash */
273
274/** \ingroup avr_flash
275 \fn const __flash void * memchr_F(const __flash void *s, int val, size_t len)
276 \brief Scan flash memory for a character.
277
278 The #memchr_F function scans the first \p len bytes of the flash
279 memory area pointed to by \p s for the character \p val. The first
280 byte to match \p val (interpreted as an unsigned character) stops
281 the operation.
282
283 \return The #memchr_F function returns a pointer to the matching
284 byte or \c NULL if the character does not occur in the given memory
285 area. */
286extern const __flash void * memchr_F(const __flash void *, int, size_t);
287
288/** \ingroup avr_flash
289 \fn int memcmp_F(const void *s1, const __flash void *s2, size_t len)
290 \brief Compare memory areas
291
292 The #memcmp_F function compares the first \p len bytes of the memory
293 areas \p s1 and flash \p s2. The comparision is performed using unsigned
294 char operations.
295
296 \returns The #memcmp_F function returns an integer less than, equal
297 to, or greater than zero if the first \p len bytes of \p s1 is found,
298 respectively, to be less than, to match, or be greater than the first
299 \p len bytes of \p s2. */
300extern int memcmp_F(const void *, const __flash void *, size_t);
301
302/** \ingroup avr_flash
303 \fn void *memccpy_F(void *dest, const __flash void *src, int val, size_t len)
304
305 This function is similar to #memccpy except that \p src is pointer
306 to a string in address-space #__flash. */
307extern void *memccpy_F(void *, const __flash void *, int val, size_t);
308
309/** \ingroup avr_flash
310 \fn void *memcpy_F(void *dest, const __flash void *src, size_t n)
311
312 The #memcpy_F function is similar to #memcpy, except the src string
313 resides in address-space __flash.
314
315 \returns The #memcpy_F function returns a pointer to dest. */
316extern void *memcpy_F(void *, const __flash void *, size_t);
317
318/** \ingroup avr_flash
319 \fn void *memmem_F(const void *s1, size_t len1, const __flash void *s2, size_t len2)
320
321 The #memmem_F function is similar to #memmem except that \p s2 is
322 pointer to a string in address-space #__flash. */
323extern void *memmem_F(const void *, size_t, const __flash void *, size_t);
324
325/** \ingroup avr_flash
326 \fn const __flash void *memrchr_F(const __flash void *src, int val, size_t len)
327
328 The #memrchr_F function is like the #memchr_F function, except
329 that it searches backwards from the end of the \p len bytes pointed
330 to by \p src instead of forwards from the front. (Glibc, GNU extension.)
331
332 \return The #memrchr_F function returns a pointer to the matching
333 byte or \c NULL if the character does not occur in the given memory
334 area. */
335extern const __flash void * memrchr_F(const __flash void *, int val, size_t len);
336
337
338/** \ingroup avr_flash
339 \fn size_t strlen_F(const __flash char *src)
340
341 The #strlen_F function is similar to #strlen, except that \p src is a
342 pointer to a string in address-space #__flash.
343
344 \returns The #strlen_F function returns the number of characters in \p src.
345
346 \note #strlen_F is implemented as an inline function in the avr/flash.h
347 header file, which will check if the length of the string is a constant
348 and known at compile time. If it is not known at compile time, the macro
349 will issue a call to a libc function which will then calculate the length
350 of the string as usual. */
351static inline size_t strlen_F(const __flash char *src);
352
353/** \ingroup avr_flash
354 \fn char *strcat_F(char *dest, const __flash char *src)
355
356 The #strcat_F function is similar to #strcat except that the \p src
357 string must be located in address-space #__flash.
358
359 \returns The #strcat function returns a pointer to the resulting string
360 \p dest. */
361extern char *strcat_F(char *, const __flash char *);
362
363/** \ingroup avr_flash
364 \fn const __flash char *strchr_F(const __flash char *s, int val)
365 \brief Locate character in a string in address-space #__flash.
366
367 The #strchr_F function locates the first occurrence of \p val
368 (converted to a char) in the string pointed to by \p s in address-space
369 #__flash. The terminating NULL character is considered to be part of
370 the string.
371
372 The #strchr_F function is similar to #strchr except that \p s is
373 pointer to a string in address-space #__flash.
374
375 \returns The #strchr_F function returns a pointer to the matched
376 character or \c NULL if the character is not found. */
377extern const __flash char * strchr_F(const __flash char *, int val);
378
379/** \ingroup avr_flash
380 \fn const __flash char *strchrnul_F(const __flash char *s, int c)
381
382 The #strchrnul_F function is like #strchr_F except that if \p c is
383 not found in \p s, then it returns a pointer to the NULL byte at the
384 end of \p s, rather than \c NULL. (Glibc, GNU extension.)
385
386 \return The #strchrnul_F function returns a pointer to the matched
387 character, or a pointer to the NULL byte at the end of \p s (i.e.,
388 \c s+strlen(s)) if the character is not found. */
389extern const __flash char * strchrnul_F(const __flash char *, int val);
390
391/** \ingroup avr_flash
392 \fn int strcmp_F(const char *s1, const __flash char *s2)
393
394 The #strcmp_F function is similar to #strcmp except that \p s2 is
395 pointer to a string in address-space #__flash.
396
397 \returns The #strcmp_F function returns an integer less than, equal
398 to, or greater than zero if \p s1 is found, respectively, to be less
399 than, to match, or be greater than \p s2. A consequence of the
400 ordering used by #strcmp_F is that if \p s1 is an initial substring
401 of \p s2, then \p s1 is considered to be "less than" \p s2. */
402extern inline int strcmp_F(const char *, const __flash char *);
403
404/** \ingroup avr_flash
405 \fn char *strcpy_F(char *dest, const __flash char *src)
406
407 The #strcpy_F function is similar to #strcpy except that src is a
408 pointer to a string in address-space #__flash.
409
410 \returns The #strcpy_F function returns a pointer to the destination
411 string dest. */
412extern inline char *strcpy_F(char *, const __flash char *);
413
414/** \ingroup avr_flash
415 \fn char *stpcpy_F(char *dest, const __flash char *src)
416
417 The #stpcpy_F function is similar to #stpcpy except that \p src is a
418 pointer to a string in address-space #__flash.
419
420 \returns #stpcpy_F returns a pointer to the <b>end</b> of
421 the string \p dest (that is, the address of the terminating null byte)
422 rather than the beginning. */
423extern inline char *stpcpy_F(char *, const __flash char *);
424
425/** \ingroup avr_flash
426 \fn int strcasecmp_F(const char *s1, const __flash char *s2)
427 \brief Compare two strings ignoring case.
428
429 The #strcasecmp_F function compares the two strings \p s1 and \p s2,
430 ignoring the case of the characters.
431
432 \param s1 A pointer to a string in SRAM.
433 \param s2 A pointer to a string in address-space #__flash.
434
435 \returns The #strcasecmp_F function returns an integer less than,
436 equal to, or greater than zero if \p s1 is found, respectively, to
437 be less than, to match, or be greater than \p s2. A consequence of
438 the ordering used by #strcasecmp_F is that if \p s1 is an initial
439 substring of \p s2, then \p s1 is considered to be "less than" \p s2. */
440extern int strcasecmp_F(const char *, const __flash char *);
441
442/** \ingroup avr_flash
443 \fn char *strcasestr_F(const char *s1, const __flash char *s2)
444
445 This function is similar to #strcasestr except that \p s2 is pointer
446 to a string in address-space #__flash. */
447extern char *strcasestr_F(const char *, const __flash char *);
448
449/** \ingroup avr_flash
450 \fn size_t strcspn_F(const char *s, const __flash char *reject)
451
452 The #strcspn_F function calculates the length of the initial segment
453 of \p s which consists entirely of characters not in \p reject. This
454 function is similar to #strcspn except that \p reject is a pointer
455 to a string in address-space #__flash.
456
457 \return The #strcspn_F function returns the number of characters in
458 the initial segment of \p s which are not in the string \p reject.
459 The terminating zero is not considered as a part of string. */
460extern size_t strcspn_F(const char *s, const __flash char *reject);
461
462/** \ingroup avr_flash
463 \fn size_t strlcat_F(char *dst, const __flash char *src, size_t siz)
464 \brief Concatenate two strings.
465
466 The #strlcat_F function is similar to #strlcat, except that the \p src
467 string must be located in address-space #__flash.
468
469 Appends \p src to string \p dst of size \p siz (unlike #strncat,
470 \p siz is the full size of \p dst, not space left). At most \p siz-1
471 characters will be copied. Always NULL terminates (unless \p siz <=
472 \p strlen(dst)).
473
474 \returns The #strlcat_F function returns strlen(src) + MIN(siz,
475 strlen(initial dst)). If retval >= siz, truncation occurred. */
476extern size_t strlcat_F(char *, const __flash char *, size_t);
477
478/** \ingroup avr_flash
479 \fn size_t strlcpy_F(char *dst, const __flash char *src, size_t siz)
480 \brief Copy a string from address-space #__flash to RAM.
481
482 Copy \p src to string \p dst of size \p siz. At most \p siz-1
483 characters will be copied. Always NULL terminates (unless \p siz == 0).
484 The #strlcpy_F function is similar to #strlcpy except that the
485 \p src is pointer to a string in address-space #__flash.
486
487 \returns The #strlcpy_F function returns strlen(src). If
488 retval >= siz, truncation occurred. */
489extern size_t strlcpy_F(char *, const __flash char *, size_t);
490
491/** \ingroup avr_flash
492 \fn size_t strnlen_F(const __flash char *src, size_t len)
493 \brief Determine the length of a fixed-size string.
494
495 The #strnlen_F function is similar to #strnlen, except that \c src is a
496 pointer to a string in address-space #__flash.
497
498 \returns The #strnlen_F function returns strlen_F(src), if that is less than
499 \c len, or \c len if there is no '\\0' character among the first \c len
500 characters pointed to by \c src. */
501extern size_t strnlen_F(const __flash char *, size_t);
502
503/** \ingroup avr_flash
504 \fn int strncmp_F(const char *s1, const __flash char *s2, size_t n)
505
506 The #strncmp_F function is similar to #strcmp_F except it only compares
507 the first (at most) n characters of s1 and s2.
508
509 \returns The #strncmp_F function returns an integer less than, equal to,
510 or greater than zero if s1 (or the first n bytes thereof) is found,
511 respectively, to be less than, to match, or be greater than s2. */
512extern int strncmp_F(const char *, const __flash char *, size_t);
513
514/** \ingroup avr_flash
515 \fn int strncasecmp_F(const char *s1, const __flash char *s2, size_t n)
516 \brief Compare two strings ignoring case.
517
518 The #strncasecmp_F function is similar to #strcasecmp_F, except it
519 only compares the first \p n characters of \p s1.
520
521 \param s1 A pointer to a string in SRAM.
522 \param s2 A pointer to a string in address-space #__flash.
523 \param n The maximum number of bytes to compare.
524
525 \returns The #strncasecmp_F function returns an integer less than,
526 equal to, or greater than zero if \p s1 (or the first \p n bytes
527 thereof) is found, respectively, to be less than, to match, or be
528 greater than \p s2. A consequence of the ordering used by
529 #strncasecmp_F is that if \p s1 is an initial substring of \p s2,
530 then \p s1 is considered to be "less than" \p s2. */
531extern int strncasecmp_F(const char *, const __flash char *, size_t);
532
533/** \ingroup avr_flash
534 \fn char *strncat_F(char *dest, const __flash char *src, size_t len)
535 \brief Concatenate two strings.
536
537 The #strncat_F function is similar to #strncat, except that the \p src
538 string must be located in address-space #__flash.
539
540 \returns The #strncat_F function returns a pointer to the resulting string
541 dest. */
542extern char *strncat_F(char *, const __flash char *, size_t);
543
544/** \ingroup avr_flash
545 \fn char *strncpy_F(char *dest, const __flash char *src, size_t n)
546
547 The #strncpy_F function is similar to #strcpy_F except that not more
548 than \p n bytes of src are copied. Thus, if there is no null byte among
549 the first \p n bytes of \p src, the result will not be null-terminated.
550
551 In the case where the length of \p src is less than that of \p n,
552 the remainder of \p dest will be padded with nulls.
553
554 \returns The #strncpy_F function returns a pointer to the destination
555 string dest. */
556extern char *strncpy_F(char *, const __flash char *, size_t);
557
558/** \ingroup avr_flash
559 \fn char *strpbrk_F(const char *s, const __flash char *accept)
560
561 The #strpbrk_F function locates the first occurrence in the string
562 \p s of any of the characters in the #__flash string \p accept. This
563 function is similar to #strpbrk except that \p accept is a pointer
564 to a string in address-space #__flash.
565
566 \return The #strpbrk_F function returns a pointer to the character
567 in \p s that matches one of the characters in \p accept, or \c NULL
568 if no such character is found. The terminating zero is not considered
569 as a part of string: If one or both args are empty, the result will
570 \c NULL. */
571extern char *strpbrk_F(const char *, const __flash char * accept);
572
573/** \ingroup avr_flash
574 \fn const __flash char *strrchr_F(const __flash char *s, int val)
575 \brief Locate character in string.
576
577 The #strrchr_F function returns a pointer to the last occurrence of
578 the character \p val in the #__flash string \p s.
579
580 \return The #strrchr_F function returns a pointer to the matched
581 character or \c NULL if the character is not found. */
582extern const __flash char * strrchr_F(const __flash char *, int val);
583
584/** \ingroup avr_flash
585 \fn char *strsep_F(char **sp, const __flash char *delim)
586 \brief Parse a string into tokens.
587
588 The #strsep_F function locates, in the string referenced by \p *sp,
589 the first occurrence of any character in the string \p delim (or the
590 terminating '\\0' character) and replaces it with a '\\0'. The
591 location of the next character after the delimiter character (or \c
592 NULL, if the end of the string was reached) is stored in \p *sp. An
593 ``empty'' field, i.e. one caused by two adjacent delimiter
594 characters, can be detected by comparing the location referenced by
595 the pointer returned in \p *sp to '\\0'. This function is similar to
596 #strsep except that \p delim is a pointer to a string in address-space
597 #__flash.
598
599 \return The #strsep_F function returns a pointer to the original
600 value of \p *sp. If \p *sp is initially \c NULL, #strsep_F returns
601 \c NULL. */
602extern char *strsep_F(char **sp, const __flash char * delim);
603
604/** \ingroup avr_flash
605 \fn size_t strspn_F(const char *s, const __flash char *accept)
606
607 The #strspn_F function calculates the length of the initial segment
608 of \p s which consists entirely of characters in \p accept. This
609 function is similar to #strspn except that \p accept is a pointer
610 to a string in address-space #__flash.
611
612 \return The #strspn_F function returns the number of characters in
613 the initial segment of \p s which consist only of characters from \p
614 accept. The terminating zero is not considered as a part of string. */
615extern size_t strspn_F(const char *s, const __flash char * accept);
616
617/** \ingroup avr_flash
618 \fn char *strstr_F(const char *s1, const __flash char *s2)
619 \brief Locate a substring.
620
621 The #strstr_F function finds the first occurrence of the substring
622 \p s2 in the string \p s1. The terminating '\\0' characters are not
623 compared. The #strstr_F function is similar to #strstr except that
624 \p s2 is pointer to a string in address-space #__flash.
625
626 \returns The #strstr_F function returns a pointer to the beginning
627 of the substring, or NULL if the substring is not found. If \p s2
628 points to a string of zero length, the function returns \p s1. */
629extern char *strstr_F(const char *, const __flash char *);
630
631/** \ingroup avr_flash
632 \fn char *strtok_F(char *s, const __flash char * delim)
633 \brief Parses the string into tokens.
634
635 #strtok_F parses the string \p s into tokens. The first call to
636 #strtok_F should have \p s as its first argument. Subsequent calls
637 should have the first argument set to NULL. If a token ends with a
638 delimiter, this delimiting character is overwritten with a '\\0' and a
639 pointer to the next character is saved for the next call to #strtok_F.
640 The delimiter string \p delim may be different for each call.
641
642 The #strtok_F function is similar to #strtok except that \p delim
643 is pointer to a string in address-space #__flash.
644
645 \returns The #strtok_F function returns a pointer to the next token or
646 NULL when no more tokens are found.
647
648 \note #strtok_F is NOT reentrant. For a reentrant version of this
649 function see #strtok_rF.
650 */
651extern char *strtok_F(char *s, const __flash char * delim);
652
653/** \ingroup avr_flash
654 \fn char *strtok_rF(char *string, const __flash char *delim, char **last)
655 \brief Parses string into tokens.
656
657 The #strtok_rF function parses \p string into tokens. The first call to
658 #strtok_rF should have \p string as its first argument. Subsequent calls
659 should have the first argument set to NULL. If a token ends with a
660 delimiter, this delimiting character is overwritten with a '\\0' and a
661 pointer to the next character is saved for the next call to #strtok_rF.
662 The delimiter string \p delim may be different for each call. \p last is
663 a user allocated <tt>char*</tt> pointer. It must be the same while
664 parsing the same string. #strtok_rF is a reentrant version of #strtok_F.
665
666 The #strtok_rF function is similar to #strtok_r except that \p delim
667 is pointer to a string in address-space #__flash.
668
669 \returns The #strtok_rF function returns a pointer to the next token or
670 NULL when no more tokens are found. */
671extern char *strtok_rF(char *s, const __flash char * delim, char **last);
672
673
674/** \name Functions from string.h, but one argument is in 24-bit address-space __flashx */
675
676/** \ingroup avr_flash
677 \fn void *memcpy_FX(void *dest, const __flashx void *src, size_t n)
678 \brief Copy a memory block from address-space __flashx to SRAM
679
680 The #memcpy_FX function is similar to #memcpy, except the data
681 is copied from address-space #__flashx and is addressed using an
682 according pointer.
683
684 \param dest A pointer to the destination buffer.
685 \param src A pointer to the origin of data in #__flashx.
686 \param n The number of bytes to be copied.
687
688 \returns The #memcpy_FX function returns a pointer to \e dst. */
689extern void *memcpy_FX(void *dest, const __flashx void *src, size_t len);
690
691/** \ingroup avr_flash
692 \fn int memcmp_FX(const void *s1, const __flashx void *s2, size_t len)
693 \brief Compare memory areas
694
695 The #memcmp_FX function compares the first \p len bytes of the memory
696 areas \p s1 and __flashx \p s2. The comparision is performed using unsigned
697 char operations. It is an equivalent of #memcmp_F function, except
698 that it is capable working on all Flash including the extended area
699 above 64 KiB.
700
701 \returns The #memcmp_FX function returns an integer less than, equal
702 to, or greater than zero if the first \p len bytes of \p s1 is found,
703 respectively, to be less than, to match, or be greater than the first
704 \p len bytes of \p s2. */
705extern int memcmp_FX(const void *s1, const __flashx void *s2, size_t);
706
707/** \ingroup avr_flash
708 \fn size_t strlen_FX(const __flashx char *s)
709 \brief Obtain the length of a string located in address-space #__flashx
710
711 The #strlen_FX function is similar to #strlen, except that \e s is a
712 pointer to a string in address-space #__flashx.
713
714 \returns The #strlen_FX function returns the number of characters in
715 \e s. */
716extern size_t strlen_FX(const __flashx char *src);
717
718/** \ingroup avr_flash
719 \fn size_t strnlen_FX(const __flashx char *s, size_t len)
720 \brief Determine the length of a fixed-size string in address-space __flashx
721
722 The #strnlen_FX function is similar to #strnlen, except that \e s is a
723 pointer to a string in address-space #__flashx.
724
725 \param s The address of a string in #__flashx.
726 \param len The maximum number of length to return.
727
728 \returns The #strnlen_FX function returns strlen_FX(\e s), if that is less
729 than \e len, or \e len if there is no '\\0' character among the first \e
730 len characters pointed to by \e s. */
731extern size_t strnlen_FX(const __flashx char *src, size_t len);
732
733/** \ingroup avr_flash
734 \fn char *strcpy_FX(char *dst, const __flashx char *src)
735 \brief Duplicate a string from address-space __flashx
736
737 The #strcpy_FX function is similar to #strcpy except that \e src is a
738 string located in address-space #__flashx.
739
740 \param dst A pointer to the destination string in SRAM.
741 \param src A pointer to the source string in #__flashx.
742
743 \returns The #strcpy_FX function returns a pointer to the destination
744 string \e dst. */
745extern char *strcpy_FX(char *dest, const __flashx char *src);
746
747/** \ingroup avr_flash
748 \fn char *stpcpy_FX(char *dst, const __flashx char *src)
749 \brief Duplicate a string from address-space __flashx
750
751 The #stpcpy_FX function is similar to #stpcpy except that \e src
752 is a string located in address-space #__flashx.
753
754 \param dst A pointer to the destination string in SRAM.
755 \param src A pointer to the source string in #__flashx.
756
757 \returns The stpcpy_PF() function returns a pointer to the
758 terminating '\\0' character of the destination string \e dst. */
759extern char *stpcpy_FX(char *dest, const __flashx char *src);
760
761/** \ingroup avr_flash
762 \fn char *strncpy_FX(char *dst, const __flashx char *src, size_t n)
763 \brief Duplicate a string from address-space __flashx until a limited length
764
765 The #strncpy_FX function is similar to #strcpy_FX except that not more
766 than \e n bytes of \e src are copied. Thus, if there is no null byte among
767 the first \e n bytes of \e src, the result will not be null-terminated.
768
769 In the case where the length of \e src is less than that of \e n, the
770 remainder of \e dst will be padded with nulls.
771
772 \param dst A pointer to the destination string in SRAM.
773 \param src A far pointer to the source string in address-space #__flashx.
774 \param n The maximum number of bytes to copy.
775
776 \returns The #strncpy_FX function returns a pointer to the destination
777 string \e dst. */
778extern char *strncpy_FX(char *dest, const __flashx char *src, size_t len);
779
780/** \ingroup avr_flash
781 \fn char *strcat_FX(char *dst, const __flashx char *src)
782 \brief Concatenates two strings
783
784 The #strcat_FX function is similar to #strcat except that the \e src
785 string must be located in address-space #__flashx.
786
787 \param dst A pointer to the destination string in SRAM.
788 \param src A pointer to the string located in #__flashx to be appended.
789
790 \returns The #strcat_FX function returns a pointer to the resulting
791 string \e dst. */
792extern char *strcat_FX(char *dest, const __flashx char *src);
793
794/** \ingroup avr_flash
795 \fn size_t strlcat_FX(char *dst, const __flashx char *src, size_t n)
796 \brief Concatenate two strings
797
798 The #strlcat_FX function is similar to #strlcat, except that the \e src
799 string must be located in address-space #__flashx.
800
801 Appends src to string dst of size \e n (unlike #strncat, \e n is the
802 full size of \e dst, not space left). At most \e n-1 characters
803 will be copied. Always NULL terminates (unless \e n <= strlen(\e dst)).
804
805 \param dst A pointer to the destination string in SRAM.
806 \param src A pointer to the source string in __flashx.
807 \param n The total number of bytes allocated to the destination string.
808
809 \returns The #strlcat_FX function returns strlen(\e src) + MIN(\e n,
810 strlen(initial \e dst)). If retval >= \e n, truncation occurred. */
811extern size_t strlcat_FX(char *dst, const __flashx char *src, size_t siz);
812
813/** \ingroup avr_flash
814 \fn char *strncat_FX(char *dst, const __flashx char *src, size_t n)
815 \brief Concatenate two strings
816
817 The #strncat_FX function is similar to #strncat, except that the \e src
818 string must be located in address-space __flashx.
819
820 \param dst A pointer to the destination string in SRAM.
821 \param src A pointer to the source string in __flashx.
822 \param n The maximum number of bytes to append.
823
824 \returns The #strncat_FX function returns a pointer to the resulting
825 string \e dst. */
826extern char *strncat_FX(char *dest, const __flashx char *src, size_t len);
827
828/** \ingroup avr_flash
829 \fn int strcmp_FX(const char *s1, const __flashx char *s2)
830 \brief Compares two strings
831
832 The #strcmp_FX function is similar to #strcmp except that \e s2 is a
833 pointer to a string in address-space #__flashx.
834
835 \param s1 A pointer to the first string in SRAM.
836 \param s2 A pointer to the second string in #__flashx.
837
838 \returns The #strcmp_FX function returns an integer less than, equal to,
839 or greater than zero if \e s1 is found, respectively, to be less than, to
840 match, or be greater than \e s2. */
841extern int strcmp_FX(const char *s1, const __flashx char *s2);
842
843/** \ingroup avr_flash
844 \fn int strncmp_FX(const char *s1, const __flashx char *s2, size_t n)
845 \brief Compare two strings with limited length
846
847 The #strncmp_FX function is similar to #strcmp_FX except it only
848 compares the first (at most) \e n characters of \e s1 and \e s2.
849
850 \param s1 A pointer to the first string in SRAM.
851 \param s2 A pointer to the second string in address-space #__flashx.
852 \param n The maximum number of bytes to compare.
853
854 \returns The #strncmp_FX function returns an integer less than, equal
855 to, or greater than zero if \e s1 (or the first \e n bytes thereof) is found,
856 respectively, to be less than, to match, or be greater than \e s2. */
857extern int strncmp_FX(const char *s1, const __flashx char *s2, size_t n);
858
859/** \ingroup avr_flash
860 \fn int strcasecmp_FX(const char *s1, const __flashx char *s2)
861 \brief Compare two strings ignoring case
862
863 The #strcasecmp_FX function compares the two strings \e s1 and \e s2,
864 ignoring the case of the characters.
865
866 \param s1 A pointer to the first string in SRAM.
867 \param s2 A pointer to the second string in address-space #__flashx.
868
869 \returns The #strcasecmp_FX function returns an integer less than, equal
870 to, or greater than zero if \e s1 is found, respectively, to be less than,
871 to match, or be greater than \e s2. */
872extern int strcasecmp_FX(const char *s1, const __flashx char *s2);
873
874/** \ingroup avr_flash
875 \fn int strncasecmp_FX(const char *s1, const __flashx char *s2, size_t n)
876 \brief Compare two strings ignoring case
877
878 The #strncasecmp_FX function is similar to #strcasecmp_FX, except it
879 only compares the first \e n characters of \e s1, and the string \e s2
880 is located in address-space #__flashx.
881
882 \param s1 A pointer to a string in SRAM.
883 \param s2 A pointer to a string in #__flashx.
884 \param n The maximum number of bytes to compare.
885
886 \returns The #strncasecmp_FX function returns an integer less than, equal
887 to, or greater than zero if \e s1 (or the first \e n bytes thereof) is found,
888 respectively, to be less than, to match, or be greater than \e s2. */
889extern int strncasecmp_FX(const char *s1, const __flashx char *s2, size_t n);
890
891/** \ingroup avr_flash
892 \fn const __flashx char *strchr_FX(const __flashx char *s, int val)
893 \brief Locate a character in a string located in address-space #__flashx
894
895 The #strchr_FX function locates the first occurrence of \p val
896 (converted to a char) in the string pointed to by \p s in address-space
897 #__flashx. The terminating null character is considered to be part of
898 the string.
899
900 The #strchr_FX function is similar to #strchr except that \p s is
901 a pointer to a string in address-space #__flashx that's \e not
902 \e required to be located in the lower 64 KiB block like it is
903 the case for #strchr_F.
904
905 \returns The #strchr_FX function returns a far pointer to the matched
906 character or \c 0 if the character is not found. */
907extern const __flashx char *strchr_FX(const __flashx char *s, int val);
908
909/** \ingroup avr_flash
910 \fn char *strstr_FX(const char *s1, const __flashx char *s2)
911 \brief Locate a substring.
912
913 The #strstr_FX function finds the first occurrence of the substring \c s2
914 in the string \c s1. The terminating '\\0' characters are not
915 compared.
916 The #strstr_FX function is similar to #strstr except that \c s2 points
917 to a string located in address-space #__flashx.
918
919 \returns The #strstr_FX function returns a pointer to the beginning of the
920 substring, or NULL if the substring is not found.
921 If \c s2 points to a string of zero length, the function returns \c s1. */
922extern char *strstr_FX(const char *s1, const __flashx char *s2);
923
924/** \ingroup avr_flash
925 \fn size_t strlcpy_FX(char *dst, const __flashx char *src, size_t len)
926 \brief Copy a string from address-space #__flashx to RAM.
927
928 Copy src to string dst of length len. At most len-1 characters will be
929 copied. Always NULL terminates (unless len == 0).
930
931 \returns The #strlcpy_FX function returns strlen_FX(src).
932 If retval >= len, truncation occurred. */
933extern size_t strlcpy_FX(char *, const __flashx char *, size_t);
934
935/** \name AVR Named Address-Spaces */
936
937/** \ingroup avr_flash
938 A <b>named address-space</b> for data in the lower 64 KiB of program memory
939
940 Pointers to #__flash are 16 bits wide.
941
942 Objects in #__flash are located in section
943 \ref sec_dot_progmem ".progmem.data",
944 which is located \e prior to the code sections by the default linker
945 description files. Similar to #PROGMEM, the assertion is that all
946 objects in that section will fit in the lower 64 KiB flash segment
947 (flash byte addresses 0x0 ... 0xffff).
948
949 The compiler defines the built-in macro \c __FLASH when this
950 address-space is available. It is supported as part of GNU-C
951 (<tt>-std=gnu99</tt> etc.), and is not available on Reduced
952 Tiny (core AVRrc).
953
954 \since <a href="https://gcc.gnu.org/gcc-4.7/changes.html#avr">avr-gcc v4.7</a>
955 (Release 2012)
956
957 \see <a href="https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#index-_005f_005fflash-AVR-Named-Address-Spaces"
958 >avr-gcc: <tt>__flash</tt></a>.
959*/
961
962/** \ingroup avr_flash
963 A <b>named address-space</b> for data in program memory
964
965 Pointers to #__flashx are 24 bits wide.
966
967 Objects in #__flashx are located in section
968 \ref sec_dot_progmemx ".progmemx.data",
969 which is located \e after the code sections by the default linker
970 description files. There is no restriction on the address range
971 occupied by objects in that section, and #__flashx supports
972 reading across the 64 KiB segment boundaries.
973
974 The compiler defines the built-in macro \c __FLASHX when this
975 address-space is available. It is supported as part of GNU-C
976 (<tt>-std=gnu99</tt> etc.), and is not available on Reduced
977 Tiny (core AVRrc).
978
979 \since
980 <a href="https://gcc.gnu.org/gcc-15/changes.html#avr">avr-gcc v15</a>
981 (Release 2025)
982
983 \see <a href="https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#index-_005f_005fflashx-AVR-Named-Address-Spaces"
984 >avr-gcc: <tt>__flashx</tt></a>.
985*/
987
988
989/** \ingroup avr_flash
990 A <b>named address-space</b> for data in program memory or RAM
991
992 Pointers to #__memx are 24 bits wide.
993
994 Objects in #__memx are located in section
995 \ref sec_dot_progmemx ".progmemx.data",
996 which is located \e after the code sections by the default linker
997 description files. There is no restriction on the address range
998 occupied by objects in that section, and #__memx supports
999 reading across the 64 KiB flash segment boundaries.
1000
1001 #__memx pointers can also hold RAM addresses, and reading from
1002 #__memx reads from RAM or from program memory depending on the
1003 most significant bit of the address.
1004
1005 The compiler defines the built-in macro \c __MEMX when this
1006 address-space is available. It is supported as part of GNU-C
1007 (<tt>-std=gnu99</tt> etc.), and is not available on Reduced
1008 Tiny (core AVRrc).
1009 To date, AVR-LibC does not have support for functions operating
1010 on #__memx.
1011
1012 \since
1013 <a href="https://gcc.gnu.org/gcc-4.7/changes.html#avr">avr-gcc v4.7</a>
1014 (Release 2012)
1015
1016 \see <a href="https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#index-_005f_005fmemx-AVR-Named-Address-Spaces"
1017 >avr-gcc: <tt>__memx</tt></a>.
1018*/
1020
1021
1022#endif /* __DOXYGEN__ */
1023
1024/** \name Convenience macros for functions from stdio.h, that allocate the format string with FSTR */
1025
1026/** \ingroup avr_flash
1027 A convenience macro that wraps #vfprintf_F's format string with #FSTR.
1028*/
1029#define vfprintf_FSTR(stream, fmt, ap) vfprintf_F(stream, FSTR(fmt), ap)
1030
1031/** \ingroup avr_flash
1032 A convenience macro that wraps #printf_F's format string with #FSTR.
1033*/
1034#define printf_FSTR(fmt, ...) printf_F(FSTR(fmt), ##__VA_ARGS__)
1035
1036/** \ingroup avr_flash
1037 A convenience macro that wraps #sprintf_F's format string with #FSTR.
1038*/
1039#define sprintf_FSTR(s, fmt, ...) sprintf_F(s, FSTR(fmt), ##__VA_ARGS__)
1040
1041/** \ingroup avr_flash
1042 A convenience macro that wraps #snprintf_F's format string with #FSTR.
1043*/
1044#define snprintf_FSTR(s, n, fmt, ...) snprintf_F(s, n, FSTR(fmt), ##__VA_ARGS__)
1045
1046/** \ingroup avr_flash
1047 A convenience macro that wraps #vsprintf_F's format string with #FSTR.
1048*/
1049#define vsprintf_FSTR(s, fmt, ap) vsprintf_F(s, FSTR(fmt), ap)
1050
1051/** \ingroup avr_flash
1052 A convenience macro that wraps #vsnprintf_F's format string with #FSTR.
1053*/
1054#define vsnprintf_FSTR(s, n, fmt, ap) vsnprintf_F(s, n, FSTR(fmt), ap);
1055
1056/** \ingroup avr_flash
1057 A convenience macro that wraps #fprintf_F's format string with #FSTR.
1058*/
1059#define fprintf_FSTR(stream, fmt, ...) fprintf_F(stream, FSTR(fmt), ##__VA_ARGS__)
1060
1061/** \ingroup avr_flash
1062 A convenience macro that wraps #fputs_F's string with #FSTR.
1063*/
1064#define fputs_FSTR(str, stream) fputs_F(FSTR(str), stream);
1065
1066/** \ingroup avr_flash
1067 A convenience macro that wraps #puts_F's string with #FSTR.
1068*/
1069#define puts_FSTR(str) puts_F(FSTR(str));
1070
1071/** \ingroup avr_flash
1072 A convenience macro that wraps #vfscanf_F's format string with #FSTR.
1073*/
1074#define vfscanf_FSTR(stream, fmt, ap) vfscanf_F(stream, FSTR(fmt), ap);
1075
1076/** \ingroup avr_flash
1077 A convenience macro that wraps #fscanf_F's format string with #FSTR.
1078*/
1079#define fscanf_FSTR(stream, fmt, ...) fscanf_F(stream, FSTR(fmt), ##__VA_ARGS__)
1080
1081/** \ingroup avr_flash
1082 A convenience macro that wraps #scanf_F's format string with #FSTR.
1083*/
1084#define scanf_FSTR(fmt, ...) scanf_F(FSTR(fmt), ##__VA_ARGS__)
1085
1086/** \ingroup avr_flash
1087 A convenience macro that wraps #sscanf_F's format string with #FSTR.
1088*/
1089#define sscanf_FSTR(buf, fmt, ...) sscanf_F(buf, FSTR(fmt), ##__VA_ARGS__)
1090
1091#ifdef __DOXYGEN__
1092
1093/** \name Functions from stdio.h, but with a format string in address-space __flash */
1094
1095/** \ingroup avr_flash
1096 Variant of \c #vfprintf that uses a \c fmt string that resides
1097 in address-space #__flash. See also #vfprintf_FSTR.
1098*/
1099extern int vfprintf_F(FILE *stream, const __flash char *fmt, va_list ap);
1100
1101/** \ingroup avr_flash
1102 Variant of \c #printf that uses a \c fmt string that resides
1103 in address-space #__flash. See also #printf_FSTR.
1104*/
1105extern int printf_F(const __flash char *fmt, ...);
1106
1107/** \ingroup avr_flash
1108 Variant of \c #sprintf that uses a \c fmt string that resides
1109 in address-space #__flash. See also #sprintf_FSTR.
1110*/
1111extern int sprintf_F(char *s, const __flash char *fmt, ...);
1112
1113/** \ingroup avr_flash
1114 Variant of \c #snprintf that uses a \c fmt string that resides
1115 in address-space #__flash. See also #snprintf_FSTR.
1116*/
1117extern int snprintf_F(char *s, size_t n, const __flash char *fmt, ...);
1118
1119/** \ingroup avr_flash
1120 Variant of \c #vsprintf that uses a \c fmt string that resides
1121 in address-space #__flash. See also #vsprintf_FSTR.
1122*/
1123extern int vsprintf_F(char *s, const __flash char *fmt, va_list ap);
1124
1125/** \ingroup avr_flash
1126 Variant of \c #vsnprintf that uses a \c fmt string that resides
1127 in address-space #__flash. See also #vsnprintf_FSTR.
1128*/
1129extern int vsnprintf_F(char *s, size_t n, const __flash char *fmt, va_list ap);
1130
1131/** \ingroup avr_flash
1132 Variant of \c #fprintf that uses a \c fmt string that resides
1133 in address-space #__flash. See also #fprintf_FSTR.
1134*/
1135extern int fprintf_F(FILE *stream, const __flash char *fmt, ...);
1136
1137/** \ingroup avr_flash
1138 Variant of #fputs where \c str resides in address-space #__flash.
1139 See also #fputs_FSTR.
1140*/
1141extern int fputs_F(const __flash char *str, FILE *stream);
1142
1143/** \ingroup avr_flash
1144 Variant of #puts where \c str resides in address-space #__flash.
1145 See also #puts_FSTR.
1146*/
1147extern int puts_F(const __flash char *str);
1148
1149/** \ingroup avr_flash
1150 Variant of #vfscanf using a \c fmt string in address-space #__flash.
1151 See also #vfscanf_FSTR.
1152*/
1153extern int vfscanf_F(FILE *stream, const __flash char *fmt, va_list ap);
1154
1155/** \ingroup avr_flash
1156 Variant of #fscanf using a \c fmt string in address-space #__flash.
1157 See also #fscanf_FSTR.
1158*/
1159extern int fscanf_F(FILE *stream, const __flash char *fmt, ...);
1160
1161/** \ingroup avr_flash
1162 Variant of #scanf where \c fmt resides in address-space #__flash.
1163 See also #scanf_FSTR.
1164*/
1165extern int scanf_F(const __flash char *fmt, ...);
1166
1167/** \ingroup avr_flash
1168 Variant of #sscanf using a \c fmt string in address-space #__flash.
1169 See also #sscanf_FSTR.
1170*/
1171extern int sscanf_F(const char *buf, const __flash char *fmt, ...);
1172
1173
1174/** \name More efficient reading of 64-bit values from __flash and __flashx */
1175
1176/** \ingroup avr_flash
1177 \fn uint64_t flash_read_u64 (const __flash uint64_t *addr)
1178 Read an <tt>uint64_t</tt> from 16-bit #__flash address \p addr. */
1179static inline uint64_t flash_read_u64 (const __flash uint64_t *addr);
1180
1181/** \ingroup avr_flash
1182 \fn int64_t flash_read_i64 (const __flash int64_t *addr)
1183 Read an <tt>int64_t</tt> from 16-bit #__flash address \p addr. */
1184static inline int64_t flash_read_i64 (const __flash int64_t *addr);
1185
1186/** \ingroup avr_flash
1187 \fn double flash_read_double (const __flash double *addr)
1188 Read a <tt>double</tt> from 16-bit __flash address \p addr. */
1189static inline double flash_read_double (const __flash double *addr);
1190
1191/** \ingroup avr_flash
1192 \fn long double flash_read_long_double (const __flash long double *addr)
1193 Read a <tt>long double</tt> from 16-bit #__flash address \p addr. */
1194static inline long double flash_read_long_double (const __flash long double *addr);
1195
1196
1197/** \ingroup avr_flash
1198 \fn uint64_t flashx_read_u64 (const __flashx uint64_t *addr)
1199 Read an <tt>uint64_t</tt> from 24-bit #__flashx address \p addr. */
1200static inline uint64_t flashx_read_u64 (const __flashx uint64_t *addr);
1201
1202/** \ingroup avr_flash
1203 \fn int64_t flashx_read_i64 (const __flashx int64_t *addr)
1204 Read an <tt>int64_t</tt> from 24-bit #__flashx address \p addr. */
1205static inline int64_t flashx_read_i64 (const __flashx int64_t *addr);
1206
1207/** \ingroup avr_flash
1208 \fn double flashx_read_double (const __flashx double *addr)
1209 Read a <tt>double</tt> from 24-bit #__flashx address \p addr. */
1210static inline double flashx_read_double (const __flashx double *addr);
1211
1212/** \ingroup avr_flash
1213 \fn long double flashx_read_long_double (const __flashx long double *addr)
1214 Read a <tt>long double</tt> from 24-bit #__flashx address \p addr. */
1215static inline long double flashx_read_long_double (const __flashx long double *addr);
1216
1217
1218/* ********************************************************************/
1219
1220
1221#else /* !__DOXYGEN__ */
1222
1223#define __need_size_t
1224#include <stddef.h>
1225#include <bits/attribs.h>
1226
1227#ifdef __FLASH
1228
1229#define FSTR(s) (__extension__({static const __flash char __c[] = (s); &__c[0];}))
1230#define FLIT(lit) ((const __flash char[]) { lit })
1231
1232extern const __flash void * memchr_F(const __flash void *, int __val, size_t __len) __asm("memchr_P") __ATTR_CONST__;
1233extern int memcmp_F(const void *, const __flash void *, size_t) __asm("memcmp_P") __ATTR_PURE__;
1234extern void *memccpy_F(void *, const __flash void *, int __val, size_t) __asm("memccpy_P");
1235extern void *memcpy_F(void *, const __flash void *, size_t) __asm("memcpy_P");
1236extern void *memmem_F(const void *, size_t, const __flash void *, size_t) __asm("memmem_P") __ATTR_PURE__;
1237extern const __flash void * memrchr_F(const __flash void *, int __val, size_t __len) __asm("memrchr_P") __ATTR_CONST__;
1238
1239extern char *strcat_F(char *, const __flash char *) __asm("strcat_P");
1240
1241extern const __flash char * strchr_F(const __flash char *, int __val) __asm("strchr_P") __ATTR_CONST__;
1242extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1243const __flash char * strchr_F(const __flash char *__hay, int __val)
1244{
1245 register const __flash char *__r24 __asm("24") = __hay;
1246 register int __r22 __asm("22") = __val;
1247 __asm ("%~call strchr_P"
1248 : "+r" (__r24) : "r" (__r22) : "0", "30", "31");
1249 return __r24;
1250}
1251
1252extern const __flash char * strchrnul_F(const __flash char *, int __val) __asm("strchrnul_P") __ATTR_CONST__;
1253extern int strcasecmp_F(const char *, const __flash char *) __asm("strcasecmp_P") __ATTR_PURE__;
1254extern char *strcasestr_F(const char *, const __flash char *) __asm("strcasestr_P") __ATTR_PURE__;
1255extern size_t strcspn_F(const char *, const __flash char * __reject) __asm("strcspn_P") __ATTR_PURE__;
1256extern size_t strnlen_F(const __flash char *, size_t) __asm("strnlen_P") __ATTR_CONST__;
1257extern int strncmp_F(const char *, const __flash char *, size_t) __asm("strncmp_P") __ATTR_PURE__;
1258extern int strncasecmp_F(const char *, const __flash char *, size_t) __asm("strncasecmp_P") __ATTR_PURE__;
1259extern char *strncat_F(char *, const __flash char *, size_t) __asm("strncat_P");
1260extern char *strncpy_F(char *, const __flash char *, size_t) __asm("strncpy_P");
1261extern char *strpbrk_F(const char *__s, const __flash char * __accept) __asm("strpbrk_P") __ATTR_PURE__;
1262extern const __flash char * strrchr_F(const __flash char *, int __val) __asm("strrchr_P") __ATTR_CONST__;
1263extern char *strsep_F(char **__sp, const __flash char * __delim) __asm("strsep_P");
1264extern size_t strspn_F(const char *__s, const __flash char * __accept) __asm("strspn_P") __ATTR_PURE__;
1265extern char *strstr_F(const char *, const __flash char *) __asm("strstr_P") __ATTR_PURE__;
1266extern char *strtok_F(char *, const __flash char * __delim) __asm("strtok_P");
1267extern char *strtok_rF(char *, const __flash char * __delim, char **__last) __asm("strtok_rP");
1268
1269/* memcpy_F is common so we model its GPR footprint. */
1270extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1271void* memcpy_F(void *__x, const __flash void *__z, size_t __s)
1272{
1273 register size_t __r20 __asm("20") = __s;
1274 void *__ret = __x;
1275 __asm volatile ("%~call __memcpy_P" : "+x" (__x), "+z" (__z), "+r" (__r20)
1276 :: "0", "memory");
1277 return __ret;
1278}
1279
1280/* strcmp_F is common so we model strcmp_P's GPR footprint. */
1281extern int strcmp_F (const char*, const __flash char*) __asm ("strcmp_P");
1282extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1283int strcmp_F (const char *__x, const __flash char *__z)
1284{
1285 register int __ret __asm("24");
1286 __asm ("%~call __strcmp_P"
1287 : "=r" (__ret), "+x" (__x), "+z" (__z) :: "memory");
1288 return __ret;
1289}
1290
1291
1292/* strcpy_F is common so we model strcpy_P's GPR footprint. */
1293extern char* strcpy_F (char *__x, const __flash char *__z) __asm("strcpy_P");
1294extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1295char* strcpy_F (char *__x, const __flash char *__z)
1296{
1297 char *__ret = __x;
1298 __asm volatile ("%~call __strcpy_P"
1299 : "+x" (__x), "+z" (__z) :: "0", "memory");
1300 return __ret;
1301}
1302
1303
1304extern char* stpcpy_F (char *__x, const __flash char *__z) __asm("stpcpy_P");
1305extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1306char* stpcpy_F (char *__x, const __flash char *__z)
1307{
1308 __asm volatile ("%~call __strcpy_P"
1309 : "+x" (__x), "+z" (__z) :: "0", "memory");
1310 return __x - 1;
1311}
1312
1313
1314/* strlen_F is common so we model strlen_P's GPR footprint. */
1315extern size_t strlen_F (const __flash char *__s) __asm("strlen_P");
1316extern __ATTR_ALWAYS_INLINE__ __ATTR_GNU_INLINE__
1317size_t strlen_F (const __flash char *__s)
1318{
1319#ifdef __BUILTIN_AVR_STRLEN_FLASH
1320 if (__builtin_constant_p (__builtin_avr_strlen_flash (__s)))
1321 return __builtin_avr_strlen_flash (__s);
1322#endif
1323 {
1324 register const __flash char *__r24 __asm("24") = __s;
1325 register size_t __res __asm("24");
1326 __asm ("%~call strlen_P" : "=r" (__res) : "r" (__r24)
1327 : "0", "30", "31");
1328 return __res;
1329 }
1330}
1331
1332
1333#include <stdio.h> /* FILE */
1334
1335extern int vfprintf_F(FILE *__stream, const __flash char *__fmt, va_list __ap) __asm("vfprintf_P");
1336extern int printf_F(const __flash char *__fmt, ...) __asm("printf_P");
1337extern int sprintf_F(char *__s, const __flash char *__fmt, ...) __asm("sprintf_P");
1338extern int snprintf_F(char *__s, size_t __n, const __flash char *__fmt, ...) __asm("snprintf_P");
1339extern int vsprintf_F(char *__s, const __flash char *__fmt, va_list ap) __asm("vsprintf_P");
1340extern int vsnprintf_F(char *__s, size_t __n, const __flash char *__fmt, va_list ap) __asm("vsnprintf_P");
1341extern int fprintf_F(FILE *__stream, const __flash char *__fmt, ...) __asm("fprintf_P");
1342extern int fputs_F(const __flash char *__str, FILE *__stream) __asm("fputs_P");
1343extern int puts_F(const __flash char *__str) __asm("puts_P");
1344extern int vfscanf_F(FILE *__stream, const __flash char *__fmt, va_list __ap) __asm("vfscanf_P");
1345extern int fscanf_F(FILE *__stream, const __flash char *__fmt, ...) __asm("fscanf_P");
1346extern int scanf_F(const __flash char *__fmt, ...) __asm("scanf_P");
1347extern int sscanf_F(const char *__buf, const __flash char *__fmt, ...) __asm("sscanf_P");
1348#endif /* Have __flash */
1349
1350#ifdef __FLASHX
1351
1352#define FXSTR(s) (__extension__({static const __flashx char __c[] = (s); &__c[0];}))
1353#define FXLIT(lit) ((const __flashx char[]) { lit })
1354
1355extern size_t strnlen_FX(const __flashx char *, size_t) __asm("strnlen_PF") __ATTR_CONST__;
1356extern void *memcpy_FX(void *, const __flashx void *, size_t) __asm("memcpy_PF");
1357extern char *strcpy_FX(char *, const __flashx char *) __asm("strcpy_PF");
1358extern char *stpcpy_FX(char *, const __flashx char *) __asm("stpcpy_PF");
1359extern char *strncpy_FX(char *, const __flashx char *, size_t) __asm("strncpy_PF");
1360extern char *strcat_FX(char *, const __flashx char *) __asm("strcat_PF");
1361extern size_t strlcat_FX(char *, const __flashx char *, size_t) __asm("strlcat_PF");
1362extern char *strncat_FX(char *, const __flashx char *, size_t) __asm("strncat_PF");
1363extern int strcmp_FX(const char *, const __flashx char *) __asm("strcmp_PF") __ATTR_PURE__;
1364extern int strncmp_FX(const char *, const __flashx char *, size_t) __asm("strncmp_PF") __ATTR_PURE__;
1365extern int strcasecmp_FX(const char *, const __flashx char *) __asm("strcasecmp_PF") __ATTR_PURE__;
1366extern int strncasecmp_FX(const char *, const __flashx char *, size_t) __asm("strncasecmp_PF") __ATTR_PURE__;
1367extern const __flashx char *strchr_FX(const __flashx char *, int) __asm("strchr_PF") __ATTR_CONST__;
1368extern char *strstr_FX(const char *, const __flashx char *) __asm("strstr_PF");
1369extern size_t strlcpy_FX(char *, const __flashx char *, size_t) __asm("strlcpy_PF");
1370extern int memcmp_FX(const void *, const __flashx void *, size_t) __asm("memcmp_PF") __ATTR_PURE__;
1371
1372#ifdef __BUILTIN_AVR_STRLEN_FLASHX
1373extern size_t __strlen_FX(const __flashx char*) __asm("strlen_PF") __ATTR_CONST__;
1374
1375static inline __ATTR_ALWAYS_INLINE__ size_t
1376strlen_FX (const __flashx char *__s)
1377{
1378 return __builtin_constant_p (__builtin_avr_strlen_flashx (__s))
1379 ? __builtin_avr_strlen_flashx (__s)
1380 : __strlen_FX (__s);
1381}
1382#else
1383extern size_t strlen_FX(const __flashx char*) __asm("strlen_PF") __ATTR_CONST__;
1384#endif /* Have __builtin_avr_strlen_flashx */
1385
1386#endif /* Have __flashx */
1387
1388
1389#ifdef __FLASH
1390
1391#include <stdint.h>
1392#include <bits/lpm-elpm.h>
1393#include <bits/def-flash-read.h>
1394
1395#if __SIZEOF_LONG_LONG__ == 8
1396_Avrlibc_Def_F_8 (u64, uint64_t)
1397_Avrlibc_Def_F_8 (i64, int64_t)
1398#endif
1399
1400#if __SIZEOF_DOUBLE__ == 8
1401_Avrlibc_Def_F_8 (double, double)
1402#else
1403_Avrlibc_Def_F_4 (double, double)
1404#endif
1405
1406#if __SIZEOF_LONG_DOUBLE__ == 8
1407_Avrlibc_Def_F_8 (long_double, long double)
1408#else
1409_Avrlibc_Def_F_4 (long_double, long double)
1410#endif
1411
1412#endif /* Have __flash */
1413
1414#ifdef __FLASHX
1415
1416#include <bits/lpm-elpm.h>
1417
1418#if defined(__AVR_HAVE_ELPM__)
1419#define __ELPM__8fx(r,a,T) __ELPM__8(r,a,T)
1420#else
1421#define __ELPM__8fx(r,a,T) uint16_t __a = (uint16_t)(__uint24) a; __LPM__8(r,__a)
1422#endif
1423
1424
1425#define _Avrlibc_Def_FX_4(Name, Typ) \
1426 static __ATTR_ALWAYS_INLINE__ \
1427 Typ flashx_read_##Name (const __flashx Typ *__addr) \
1428 { \
1429 return *__addr; \
1430 }
1431
1432#define _Avrlibc_Def_FX_8(Name, Typ) \
1433 static __ATTR_ALWAYS_INLINE__ \
1434 Typ flashx_read_##Name (const __flashx Typ *__addr) \
1435 { \
1436 Typ __res; \
1437 __ELPM__8fx (__res, __addr, Typ); \
1438 return __res; \
1439 }
1440
1441#if __SIZEOF_LONG_LONG__ == 8
1442_Avrlibc_Def_FX_8 (u64, uint64_t)
1443_Avrlibc_Def_FX_8 (i64, int64_t)
1444#endif
1445
1446#if __SIZEOF_DOUBLE__ == 8
1447_Avrlibc_Def_FX_8 (double, double)
1448#else
1449_Avrlibc_Def_FX_4 (double, double)
1450#endif
1451
1452#if __SIZEOF_LONG_DOUBLE__ == 8
1453_Avrlibc_Def_FX_8 (long_double, long double)
1454#else
1455_Avrlibc_Def_FX_4 (long_double, long double)
1456#endif
1457
1458#endif /* Have __flashx */
1459
1460#endif /* !DOXYGEN */
1461
1462#endif /* !__AVR_TINY__ && !C++ */
1463
1464#endif /* _AVR_FLASH_H_ */
size_t strcspn_F(const char *s, const __flash char *reject)
char * strcat_F(char *, const __flash char *)
size_t strlen_FX(const __flashx char *src)
Obtain the length of a string located in address-space __flashx.
static long double flash_read_long_double(const __flash long double *addr)
int fscanf_F(FILE *stream, const __flash char *fmt,...)
int strcmp_F(const char *, const __flash char *)
int strncmp_F(const char *, const __flash char *, size_t)
int strncmp_FX(const char *s1, const __flashx char *s2, size_t n)
Compare two strings with limited length.
int vfscanf_F(FILE *stream, const __flash char *fmt, va_list ap)
__flashx
Definition: flash.h:986
static double flashx_read_double(const __flashx double *addr)
static int64_t flashx_read_i64(const __flashx int64_t *addr)
void * memmem_F(const void *, size_t, const __flash void *, size_t)
static uint64_t flash_read_u64(const __flash uint64_t *addr)
int strcmp_FX(const char *s1, const __flashx char *s2)
Compares two strings.
char * strncpy_FX(char *dest, const __flashx char *src, size_t len)
Duplicate a string from address-space __flashx until a limited length.
void * memcpy_F(void *, const __flash void *, size_t)
const __flash void * memchr_F(const __flash void *, int, size_t)
Scan flash memory for a character.
static uint64_t flashx_read_u64(const __flashx uint64_t *addr)
int puts_F(const __flash char *str)
char * strpbrk_F(const char *, const __flash char *accept)
char * stpcpy_F(char *, const __flash char *)
size_t strspn_F(const char *s, const __flash char *accept)
int scanf_F(const __flash char *fmt,...)
int printf_F(const __flash char *fmt,...)
char * strstr_FX(const char *s1, const __flashx char *s2)
Locate a substring.
const __flash char * strchr_F(const __flash char *, int val)
Locate character in a string in address-space __flash.
const __flashx char * strchr_FX(const __flashx char *s, int val)
Locate a character in a string located in address-space __flashx.
int vsnprintf_F(char *s, size_t n, const __flash char *fmt, va_list ap)
static size_t strlen_F(const __flash char *src)
char * strncat_FX(char *dest, const __flashx char *src, size_t len)
Concatenate two strings.
int vfprintf_F(FILE *stream, const __flash char *fmt, va_list ap)
size_t strlcpy_FX(char *, const __flashx char *, size_t)
Copy a string from address-space __flashx to RAM.
const __flash char * strchrnul_F(const __flash char *, int val)
char * strtok_F(char *s, const __flash char *delim)
Parses the string into tokens.
int strcasecmp_F(const char *, const __flash char *)
Compare two strings ignoring case.
__flash
Definition: flash.h:960
char * strcasestr_F(const char *, const __flash char *)
int fprintf_F(FILE *stream, const __flash char *fmt,...)
char * strncat_F(char *, const __flash char *, size_t)
Concatenate two strings.
char * strsep_F(char **sp, const __flash char *delim)
Parse a string into tokens.
int sprintf_F(char *s, const __flash char *fmt,...)
char * strcpy_FX(char *dest, const __flashx char *src)
Duplicate a string from address-space __flashx.
void * memccpy_F(void *, const __flash void *, int val, size_t)
size_t strlcat_F(char *, const __flash char *, size_t)
Concatenate two strings.
const __flash void * memrchr_F(const __flash void *, int val, size_t len)
char * strcat_FX(char *dest, const __flashx char *src)
Concatenates two strings.
int memcmp_F(const void *, const __flash void *, size_t)
Compare memory areas.
static int64_t flash_read_i64(const __flash int64_t *addr)
char * strncpy_F(char *, const __flash char *, size_t)
int memcmp_FX(const void *s1, const __flashx void *s2, size_t)
Compare memory areas.
char * strcpy_F(char *, const __flash char *)
int sscanf_F(const char *buf, const __flash char *fmt,...)
size_t strlcat_FX(char *dst, const __flashx char *src, size_t siz)
Concatenate two strings.
__memx
Definition: flash.h:1019
int strcasecmp_FX(const char *s1, const __flashx char *s2)
Compare two strings ignoring case.
int strncasecmp_FX(const char *s1, const __flashx char *s2, size_t n)
Compare two strings ignoring case.
int fputs_F(const __flash char *str, FILE *stream)
size_t strnlen_FX(const __flashx char *src, size_t len)
Determine the length of a fixed-size string in address-space __flashx.
static long double flashx_read_long_double(const __flashx long double *addr)
int strncasecmp_F(const char *, const __flash char *, size_t)
Compare two strings ignoring case.
void * memcpy_FX(void *dest, const __flashx void *src, size_t len)
Copy a memory block from address-space __flashx to SRAM.
char * strtok_rF(char *s, const __flash char *delim, char **last)
Parses string into tokens.
static double flash_read_double(const __flash double *addr)
char * strstr_F(const char *, const __flash char *)
Locate a substring.
size_t strnlen_F(const __flash char *, size_t)
Determine the length of a fixed-size string.
const __flash char * strrchr_F(const __flash char *, int val)
Locate character in string.
char * stpcpy_FX(char *dest, const __flashx char *src)
Duplicate a string from address-space __flashx.
size_t strlcpy_F(char *, const __flash char *, size_t)
Copy a string from address-space __flash to RAM.
int vsprintf_F(char *s, const __flash char *fmt, va_list ap)
int snprintf_F(char *s, size_t n, const __flash char *fmt,...)
char * strstr_PF(const char *s1, uint_farptr_t s2)
Locate a substring.
const char * strchr_P(const char *, int __val)
Locate character in program space string.
int strcmp_PF(const char *s1, uint_farptr_t s2)
Compares two strings.
void * memcpy_PF(void *dest, uint_farptr_t src, size_t len)
Copy a memory block from flash to SRAM.
char * strsep_P(char **__sp, const char *__delim)
Parse a string into tokens.
char * strcasestr_P(const char *, const char *)
char * strncpy_P(char *, const char *, size_t)
const void * memrchr_P(const void *, int __val, size_t __len)
int strcasecmp_P(const char *, const char *)
Compare two strings ignoring case.
size_t strcspn_P(const char *__s, const char *__reject)
char * strpbrk_P(const char *__s, const char *__accept)
void * memccpy_P(void *, const void *, int __val, size_t)
char * strtok_rP(char *__s, const char *__delim, char **__last)
Parses string into tokens.
char * strncpy_PF(char *dest, uint_farptr_t src, size_t len)
Duplicate a string until a limited length.
void * memmem_P(const void *, size_t, const void *, size_t)
char * stpcpy_PF(char *dest, uint_farptr_t src)
Duplicate a string.
size_t strnlen_P(const char *, size_t)
Determine the length of a fixed-size string.
char * strcat_P(char *, const char *)
int strncasecmp_P(const char *, const char *, size_t)
Compare two strings ignoring case.
size_t strspn_P(const char *__s, const char *__accept)
size_t strlcpy_PF(char *dst, uint_farptr_t src, size_t siz)
Copy a string from progmem to RAM.
int memcmp_PF(const void *, uint_farptr_t, size_t)
Compare memory areas.
const char * strrchr_P(const char *, int __val)
Locate character in string.
int strcasecmp_PF(const char *s1, uint_farptr_t s2)
Compare two strings ignoring case.
char * strncat_P(char *, const char *, size_t)
Concatenate two strings.
char * strncat_PF(char *dest, uint_farptr_t src, size_t len)
Concatenate two strings.
char * strcat_PF(char *dest, uint_farptr_t src)
Concatenates two strings.
int strncmp_P(const char *, const char *, size_t)
char * strstr_P(const char *, const char *)
Locate a substring.
int memcmp_P(const void *, const void *, size_t)
Compare memory areas.
int strncasecmp_PF(const char *s1, uint_farptr_t s2, size_t n)
Compare two strings ignoring case.
char * strcpy_PF(char *dest, uint_farptr_t src)
Duplicate a string.
int strncmp_PF(const char *s1, uint_farptr_t s2, size_t n)
Compare two strings with limited length.
void * memcpy_P(void *, const void *, size_t)
uint_farptr_t strchr_PF(uint_farptr_t, int __val)
Locate character in far program space string.
size_t strlcat_PF(char *dst, uint_farptr_t src, size_t siz)
Concatenate two strings.
signed long long int int64_t
Definition: stdint.h:108
unsigned long long int uint64_t
Definition: stdint.h:115
int scanf_P(const char *__fmt,...)
Definition: scanf_p.c:36
int sprintf_P(char *__s, const char *__fmt,...)
Definition: sprintf_p.c:37
int fprintf_P(FILE *__stream, const char *__fmt,...)
Definition: fprintf_p.c:36
int fputs_P(const char *__str, FILE *__stream)
Definition: fputs_p.c:38
int printf_P(const char *__fmt,...)
Definition: printf_p.c:36
int snprintf_P(char *__s, size_t __n, const char *__fmt,...)
Definition: snprintf_p.c:36
int vfscanf_P(FILE *__stream, const char *__fmt, va_list __ap)
Definition: vfscanf_p.c:36
int fscanf_P(FILE *__stream, const char *__fmt,...)
Definition: fscanf_p.c:36
int puts_P(const char *__str)
Definition: puts_p.c:38
int vsprintf_P(char *__s, const char *__fmt, va_list __ap)
Definition: vsprintf_p.c:37
int vsnprintf_P(char *__s, size_t __n, const char *__fmt, va_list __ap)
Definition: vsnprintf_p.c:36
int sscanf_P(const char *__buf, const char *__fmt,...)
Definition: sscanf_p.c:37
struct __file FILE
Definition: stdio.h:281