To make your program's metadata (like name, version, or pin maps) discoverable by picotool, you must include the binary info header and use specific macros.
Key Concepts:
#include "pico/binary_info.h" is required.- Use
bi_decl(...) for unconditional inclusion. - Use
bi_decl_if_func_used(...) to ensure information is only included if the containing function is actually used in the binary (allowing the linker to strip it if unused).
Common Macros:
bi_program_name(name)bi_program_description(description)bi_program_version_string(version_string)bi_1pin_with_func(p0, func), bi_2pins_with_func(p0, p1, func), etc.bi_pin_mask_with_name(pmask, label)bi_decl(bi_ptr_string(tag, id, var_name, default_val, max_len)) for configurable strings.
# Example: Declaring a configurable string named 'name'
bi_decl(bi_ptr_string(0x1111, 0x3333, name, "Billy", 128));
// Usage in code
printf("Name is %s\n", name);