Replicate the wormhole in the bootloader and make it jump to the application if it's open and the enumeration mode is anything but EnumerationMode_Bootloader.
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "property/property.h"
|
||||
#include "utilities/vector_table_info.h"
|
||||
#include "utilities/fsl_rtos_abstraction.h"
|
||||
#include "bootloader/wormhole.h"
|
||||
#if BL_FEATURE_CRC_CHECK
|
||||
#include "bootloader/bl_app_crc_check.h"
|
||||
#endif
|
||||
@@ -321,7 +322,7 @@ static peripheral_descriptor_t const *get_active_peripheral(void)
|
||||
{
|
||||
if (is_direct_boot())
|
||||
{
|
||||
if (RCM->SRS0 & RCM_SRS0_POR_MASK) {
|
||||
if (RCM->SRS0 & RCM_SRS0_POR_MASK || (IS_WORMHOLE_OPEN && Wormhole.enumerationMode != EnumerationMode_Bootloader)) {
|
||||
jump_to_application(applicationAddress, stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
3
src/bootloader/src/wormhole.c
Normal file
3
src/bootloader/src/wormhole.c
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "bootloader/wormhole.h"
|
||||
|
||||
wormhole_t __attribute__ ((used, section (".noinit"))) Wormhole;
|
||||
32
src/bootloader/wormhole.h
Normal file
32
src/bootloader/wormhole.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef __WORMHOLE_H__
|
||||
#define __WORMHOLE_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Macros:
|
||||
|
||||
#define WORMHOLE_MAGIC_NUMBER 0x3b04cd9e94521f9a
|
||||
#define IS_WORMHOLE_OPEN (Wormhole.magicNumber == WORMHOLE_MAGIC_NUMBER)
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef enum {
|
||||
EnumerationMode_Bootloader,
|
||||
EnumerationMode_BusPal,
|
||||
EnumerationMode_NormalKeyboard,
|
||||
EnumerationMode_CompatibleKeyboard,
|
||||
} enumeration_mode_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t magicNumber;
|
||||
uint8_t enumerationMode;
|
||||
uint16_t timeoutMs;
|
||||
} wormhole_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
extern wormhole_t __attribute__ ((section (".noinit"))) Wormhole;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user