File tree Expand file tree Collapse file tree
MK22F51212/kds/freedom_bootloader
common/linker/kds/MK22F51212 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444#include "property/property.h"
4545#include "utilities/vector_table_info.h"
4646#include "utilities/fsl_rtos_abstraction.h"
47+ #include "bootloader/wormhole.h"
4748#if BL_FEATURE_CRC_CHECK
4849#include "bootloader/bl_app_crc_check.h"
4950#endif
@@ -321,7 +322,7 @@ static peripheral_descriptor_t const *get_active_peripheral(void)
321322 {
322323 if (is_direct_boot ())
323324 {
324- if (RCM -> SRS0 & RCM_SRS0_POR_MASK ) {
325+ if (RCM -> SRS0 & RCM_SRS0_POR_MASK || ( IS_WORMHOLE_OPEN && Wormhole . enumerationMode != EnumerationMode_Bootloader ) ) {
325326 jump_to_application (applicationAddress , stackPointer );
326327 }
327328 }
Original file line number Diff line number Diff line change 1+ #include "bootloader/wormhole.h"
2+
3+ wormhole_t __attribute__ ((used , section (".noinit" ))) Wormhole ;
Original file line number Diff line number Diff line change 1+ #ifndef __WORMHOLE_H__
2+ #define __WORMHOLE_H__
3+
4+ // Includes:
5+
6+ #include <stdint.h>
7+
8+ // Macros:
9+
10+ #define WORMHOLE_MAGIC_NUMBER 0x3b04cd9e94521f9a
11+ #define IS_WORMHOLE_OPEN (Wormhole.magicNumber == WORMHOLE_MAGIC_NUMBER)
12+
13+ // Typedefs:
14+
15+ typedef enum {
16+ EnumerationMode_Bootloader ,
17+ EnumerationMode_BusPal ,
18+ EnumerationMode_NormalKeyboard ,
19+ EnumerationMode_CompatibleKeyboard ,
20+ } enumeration_mode_t ;
21+
22+ typedef struct {
23+ uint64_t magicNumber ;
24+ uint8_t enumerationMode ;
25+ uint16_t timeoutMs ;
26+ } wormhole_t ;
27+
28+ // Variables:
29+
30+ extern wormhole_t __attribute__ ((section (".noinit" ))) Wormhole ;
31+
32+ #endif
Original file line number Diff line number Diff line change 215215 <type >2</type >
216216 <locationURI >virtual:/virtual</locationURI >
217217 </link >
218+ <link >
219+ <name >src/bootloader/wormhole.h</name >
220+ <type >1</type >
221+ <locationURI >PARENT-4-PROJECT_LOC/src/bootloader/wormhole.h</locationURI >
222+ </link >
218223 <link >
219224 <name >src/crc/crc16.h</name >
220225 <type >1</type >
445450 <type >1</type >
446451 <locationURI >PARENT-4-PROJECT_LOC/src/bootloader/src/usb_hid_msc_peripheral_interface.c</locationURI >
447452 </link >
453+ <link >
454+ <name >src/bootloader/src/wormhole.c</name >
455+ <type >1</type >
456+ <locationURI >PARENT-4-PROJECT_LOC/src/bootloader/src/wormhole.c</locationURI >
457+ </link >
448458 <link >
449459 <name >src/crc/src/crc16.c</name >
450460 <type >1</type >
Original file line number Diff line number Diff line change 6161 m_interrupts (RX ) : ORIGIN = 0x00000000 , LENGTH = 0x00000400
6262 m_flash_config (RX ) : ORIGIN = 0x00000400 , LENGTH = 0x00000010
6363 m_text (RX ) : ORIGIN = 0x00000410 , LENGTH = 0x0007FBF0
64- m_data (RW ) : ORIGIN = 0x1FFF0000 , LENGTH = 0x00020000
64+ m_data (RW ) : ORIGIN = 0x1FFF0000 , LENGTH = 0x0001FF00
65+ m_noinit (RW ) : ORIGIN = 0x2000FF00 , LENGTH = 0x00000100
6566}
6667
6768/* Define output sections */
@@ -255,5 +256,16 @@ SECTIONS
255256 .ARM .attributes 0 : { *(.ARM .attributes ) }
256257
257258 ASSERT (__StackLimit >= __HeapLimit, " region m_data_2 overflowed with stack and heap" )
259+
260+ .noinit (NOLOAD) :
261+ {
262+ . = ALIGN (4 );
263+ _noinit = .;
264+
265+ *(.noinit .noinit .*)
266+
267+ . = ALIGN (4 ) ;
268+ _end_noinit = .;
269+ } > m_noinit
258270}
259271
You can’t perform that action at this time.
0 commit comments