| 
14 | 14 | 
 
  | 
15 | 15 | #include "bootloader.h"  | 
16 | 16 | #include "mpu_regions.h"  | 
 | 17 | +#include <bootloader/bootloader_version.h>  | 
17 | 18 | #include <driver_init.h>  | 
18 | 19 | #include <hardfault.h>  | 
19 | 20 | #include <platform_config.h>  | 
 | 
34 | 35 | #include <da14531/da14531_protocol.h>  | 
35 | 36 | #include <uart.h>  | 
36 | 37 | #include <utils_ringbuffer.h>  | 
 | 38 | + | 
 | 39 | +#if PRODUCT_BITBOX_PLUS_MULTI == 1  | 
 | 40 | +#define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"" BOOTLOADER_VERSION "\"}"  | 
 | 41 | +#elif PRODUCT_BITBOX_PLUS_BTCONLY == 1  | 
 | 42 | +#define DEVICE_MODE "{\"p\":\"bb02p-bl-btconly\",\"v\":\"" BOOTLOADER_VERSION "\"}"  | 
 | 43 | +#else  | 
 | 44 | +#error "unknown product"  | 
37 | 45 | #endif  | 
 | 46 | +#endif // PLATFORM_BITBOX02PLUS == 1  | 
38 | 47 | 
 
  | 
39 | 48 | extern void __attribute__((noreturn)) __stack_chk_fail(void);  | 
40 | 49 | void __attribute__((noreturn)) __stack_chk_fail(void)  | 
@@ -85,10 +94,15 @@ int main(void)  | 
85 | 94 |     uint16_t uart_read_buf_len = 0;  | 
86 | 95 | 
 
  | 
87 | 96 |     ringbuffer_init(&uart_write_queue, &uart_write_buf, UART_OUT_BUF_LEN);  | 
88 |  | -#define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"1.1.0\"}"  | 
89 |  | -    da14531_set_product(DEVICE_MODE, sizeof(DEVICE_MODE) - 1, &uart_write_queue);  | 
90 | 97 |     bool usb_hww_request_seen = false;  | 
91 | 98 | 
 
  | 
 | 99 | +    // Set product to bootloader string, this is necessary if we have rebooted from firmware. Must  | 
 | 100 | +    // be done after usb_processing is initalized to avoid getting request from the app to early.  | 
 | 101 | +    da14531_handler_current_product = (const uint8_t*)DEVICE_MODE;  | 
 | 102 | +    da14531_handler_current_product_len = sizeof(DEVICE_MODE) - 1;  | 
 | 103 | +    da14531_set_product(  | 
 | 104 | +        da14531_handler_current_product, da14531_handler_current_product_len, &uart_write_queue);  | 
 | 105 | + | 
92 | 106 |     da14531_protocol_init();  | 
93 | 107 | #endif  | 
94 | 108 |     usb_processing_init();  | 
 | 
0 commit comments