Skip to content

Commit b0b571e

Browse files
committed
Use feature groups
Show up in picotool info as well, and removes the arbitrary 0x1234 0x5678 tag and ID
1 parent adb3223 commit b0b571e

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

binary_info/blink_any/blink_any.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515
// Note that LED_TYPE == 1 is only supported when initially compiled for
1616
// a board with PICO_CYW43_SUPPORTED (eg pico_w), else the required
1717
// libraries won't be present
18+
bi_decl(bi_program_feature_group(0x1111, 0, "LED Configuration"));
1819
#if defined(PICO_DEFAULT_LED_PIN)
19-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_TYPE, 0));
20-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_PIN, PICO_DEFAULT_LED_PIN));
20+
// the tag and id are not important as picotool filters based on the
21+
// variable name, so just set them to 0
22+
bi_decl(bi_ptr_int32(0x1111, 0, LED_TYPE, 0));
23+
bi_decl(bi_ptr_int32(0x1111, 0, LED_PIN, PICO_DEFAULT_LED_PIN));
2124
#elif defined(CYW43_WL_GPIO_LED_PIN)
22-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_TYPE, 1));
23-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_PIN, CYW43_WL_GPIO_LED_PIN));
25+
bi_decl(bi_ptr_int32(0x1111, 0, LED_TYPE, 1));
26+
bi_decl(bi_ptr_int32(0x1111, 0, LED_PIN, CYW43_WL_GPIO_LED_PIN));
2427
#else
25-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_TYPE, 0));
26-
bi_decl(bi_ptr_int32(0x1234, 0x5678, LED_PIN, 25));
28+
bi_decl(bi_ptr_int32(0x1111, 0, LED_TYPE, 0));
29+
bi_decl(bi_ptr_int32(0x1111, 0, LED_PIN, 25));
2730
#endif
2831

2932
#ifndef LED_DELAY_MS

binary_info/hello_anything/hello_anything.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@
1010
#include "hardware/uart.h"
1111

1212
int main() {
13+
// create feature groups to group configuration settings
14+
// these will also show up in picotool info, not just picotool config
15+
bi_decl(bi_program_feature_group(0x1111, 0, "UART Configuration"));
16+
bi_decl(bi_program_feature_group(0x1111, 1, "Enabled Interfaces"));
1317
// stdio_uart configuration and initialisation
14-
bi_decl(bi_ptr_int32(0x1234, 1, use_uart, 1));
15-
bi_decl(bi_ptr_int32(0x1234, 2, uart_num, 0));
16-
bi_decl(bi_ptr_int32(0x1234, 3, uart_tx, 0));
17-
bi_decl(bi_ptr_int32(0x1234, 4, uart_rx, 1));
18-
bi_decl(bi_ptr_int32(0x1234, 5, uart_baud, 115200));
18+
bi_decl(bi_ptr_int32(0x1111, 1, use_uart, 1));
19+
bi_decl(bi_ptr_int32(0x1111, 0, uart_num, 0));
20+
bi_decl(bi_ptr_int32(0x1111, 0, uart_tx, 0));
21+
bi_decl(bi_ptr_int32(0x1111, 0, uart_rx, 1));
22+
bi_decl(bi_ptr_int32(0x1111, 0, uart_baud, 115200));
1923
if (use_uart) {
2024
stdio_uart_init_full(UART_INSTANCE(uart_num), uart_baud, uart_tx, uart_rx);
2125
}
2226

2327
// stdio_usb initialisation
24-
bi_decl(bi_ptr_int32(0x1234, 6, use_usb, 1));
28+
bi_decl(bi_ptr_int32(0x1111, 1, use_usb, 1));
2529
if (use_usb) {
2630
stdio_usb_init();
2731
}
2832

2933
// default printed string
30-
bi_decl(bi_ptr_string(0x1234, 7, text, "Hello, world!", 256));
34+
bi_decl(bi_ptr_string(0, 0, text, "Hello, world!", 256));
3135

3236
while (true) {
3337
printf("%s\n", text);

0 commit comments

Comments
 (0)