File tree Expand file tree Collapse file tree 5 files changed +14
-0
lines changed
sw/device/silicon_creator/lib/rescue Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -332,14 +332,20 @@ hardened_bool_t rescue_detect_entry(const owner_rescue_config_t *config) {
332332 if (rescue_requested == kHardenedBoolTrue ) {
333333 return kHardenedBoolTrue ;
334334 }
335+ rescue_protocol_t protocol = kRescueProtocolXmodem ;
335336 rescue_detect_t detect = kRescueDetectBreak ;
336337 uint32_t index = 0 ;
337338 uint32_t gpio_val = 0 ;
338339 if ((hardened_bool_t )config != kHardenedBoolFalse ) {
340+ protocol = config -> protocol ;
339341 detect = bitfield_field32_read (config -> detect , RESCUE_DETECT );
340342 index = bitfield_field32_read (config -> detect , RESCUE_DETECT_INDEX );
341343 gpio_val = bitfield_bit32_read (config -> gpio , RESCUE_GPIO_VALUE_BIT );
342344 }
345+ dbg_printf ("info: rescue protocol %c\r\n" , rescue_type );
346+ if (protocol != rescue_type ) {
347+ dbg_printf ("warning: rescue configured for protocol %c\r\n" , protocol );
348+ }
343349 switch (detect ) {
344350 case kRescueDetectNone :
345351 break ;
Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ typedef struct RescueState {
9696 uint8_t data [2048 ];
9797} rescue_state_t ;
9898
99+ extern const uint32_t rescue_type ;
100+
99101/**
100102 * Handle rescue modes that involve sending data to the host.
101103 *
Original file line number Diff line number Diff line change 2121
2222#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
2323
24+ const uint32_t rescue_type = kRescueProtocolSpiDfu ;
25+
2426enum {
2527 /**
2628 * Base address of the spi_device registers.
Original file line number Diff line number Diff line change 1919
2020#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
2121
22+ const uint32_t rescue_type = kRescueProtocolUsbDfu ;
23+
2224static const usb_device_descriptor_t device_desc = {
2325 .length = (uint8_t )sizeof (usb_device_descriptor_t ),
2426 .descriptor_type = kUsbDescTypeDevice ,
Original file line number Diff line number Diff line change 1111#include "sw/device/silicon_creator/lib/rescue/rescue.h"
1212#include "sw/device/silicon_creator/lib/rescue/xmodem.h"
1313
14+ const uint32_t rescue_type = kRescueProtocolXmodem ;
15+
1416// All of the xmodem functions accept an opaque iohandle pointer.
1517// The iohandle is used to facilitate unit tests and doesn't have
1618// any function in real firmware.
You can’t perform that action at this time.
0 commit comments