Some initial bringup of the dfu bootloader on the mk20dx256vlh7
This commit is contained in:
parent
46fc3e596b
commit
e41444304b
17 changed files with 249 additions and 65 deletions
15
Lib/mk20dx.c
15
Lib/mk20dx.c
|
@ -394,7 +394,7 @@ const uint8_t flashconfigbytes[16] = {
|
|||
// http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4507.pdf
|
||||
// http://cache.freescale.com/files/32bit/doc/ref_manual/K20P64M72SF1RM.pdf (28.34.6)
|
||||
//
|
||||
0xFF, 0xFF, 0xFF, 0xFE, // Program Flash Protection Bytes FPROT0-3
|
||||
0xFF, 0xFF, 0xFF, 0xFF, // Program Flash Protection Bytes FPROT0-3 // XXX TODO PROTECT
|
||||
|
||||
0xBE, // Flash security byte FSEC
|
||||
0x03, // Flash nonvolatile option byte FOPT
|
||||
|
@ -469,8 +469,17 @@ void ResetHandler()
|
|||
//
|
||||
// Also checking for ARM lock-up signal (invalid firmware image)
|
||||
// RCM_SRS1 & 0x02
|
||||
if ( RCM_SRS0 & 0x40 || RCM_SRS0 & 0x20 || RCM_SRS1 & 0x02 || _app_rom == 0xffffffff ||
|
||||
memcmp( (uint8_t*)&VBAT, sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic) ) == 0 ) // Check for soft reload
|
||||
if ( // PIN (External Reset Pin/Switch)
|
||||
RCM_SRS0 & 0x40
|
||||
// WDOG (Watchdog timeout)
|
||||
|| RCM_SRS0 & 0x20
|
||||
// LOCKUP (ARM Core LOCKUP event)
|
||||
|| RCM_SRS1 & 0x02
|
||||
// Blank flash check
|
||||
|| _app_rom == 0xffffffff
|
||||
// Software reset
|
||||
|| memcmp( (uint8_t*)&VBAT, sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic) ) == 0
|
||||
)
|
||||
{
|
||||
memset( (uint8_t*)&VBAT, 0, sizeof(VBAT) );
|
||||
}
|
||||
|
|
|
@ -85,10 +85,10 @@ SECTIONS
|
|||
|
||||
.data : AT (_etext) {
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
_sdata = .;
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
_edata = .;
|
||||
} > RAM
|
||||
|
||||
.noinit (NOLOAD) : {
|
||||
|
@ -97,7 +97,7 @@ SECTIONS
|
|||
|
||||
.bss : {
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
_sbss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -50,12 +50,10 @@ SECTIONS
|
|||
{
|
||||
.text :
|
||||
{
|
||||
. = 0;
|
||||
KEEP(* (.vectors))
|
||||
. = 0; KEEP(* (.vectors)) /* MUST BE AT 0 */
|
||||
*(.startup*)
|
||||
*(.rodata*)
|
||||
. = 0x400;
|
||||
KEEP(* (.flashconfig))
|
||||
. = 0x400; KEEP(* (.flashconfig)) /* MUST BE AT 0x400 */
|
||||
*(.text*)
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The above copyright notice and this permission notice shall be
|
||||
* 1. The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* 2. If the Software is incorporated into a build system that allows
|
||||
* 2. If the Software is incorporated into a build system that allows
|
||||
* selection among a list of target devices, then similar target
|
||||
* devices manufactured by PJRC.COM must be included in the list of
|
||||
* target devices and selectable in the same manner.
|
||||
|
@ -50,10 +50,10 @@ MEMORY
|
|||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The above copyright notice and this permission notice shall be
|
||||
* 1. The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* 2. If the Software is incorporated into a build system that allows
|
||||
* 2. If the Software is incorporated into a build system that allows
|
||||
* selection among a list of target devices, then similar target
|
||||
* devices manufactured by PJRC.COM must be included in the list of
|
||||
* target devices and selectable in the same manner.
|
||||
|
@ -118,10 +118,10 @@ SECTIONS
|
|||
|
||||
.data : AT (_etext) {
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
_sdata = .;
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
_edata = .;
|
||||
} > RAM
|
||||
|
||||
.noinit (NOLOAD) : {
|
||||
|
@ -130,7 +130,7 @@ SECTIONS
|
|||
|
||||
.bss : {
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
_sbss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Teensyduino Core Library
|
||||
* http://www.pjrc.com/teensy/
|
||||
* Copyright (c) 2013 PJRC.COM, LLC.
|
||||
* Modifications by Jacob Alexander 2014 for use with McHCK and Kiibohd-dfu
|
||||
* Modifications by Jacob Alexander 2014-2015 for use with McHCK and Kiibohd-dfu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
@ -29,8 +29,6 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* XXX Not tested yet -HaaTa */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x0, LENGTH = 256K
|
||||
|
@ -52,12 +50,10 @@ SECTIONS
|
|||
{
|
||||
.text :
|
||||
{
|
||||
. = 0;
|
||||
KEEP(* (.vectors))
|
||||
. = 0; KEEP(* (.vectors)) /* MUST BE AT 0 */
|
||||
*(.startup*)
|
||||
. = 0x400;
|
||||
. = 0x400; KEEP(* (.flashconfig)) /* MUST BE AT 0x400 */
|
||||
*(.rodata*)
|
||||
KEEP(* (.flashconfig))
|
||||
*(.text*)
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Teensyduino Core Library
|
||||
* http://www.pjrc.com/teensy/
|
||||
* Copyright (c) 2013 PJRC.COM, LLC.
|
||||
* Modifications by Jacob Alexander 2014 for use with McHCK and Kiibohd-dfu
|
||||
* Modifications by Jacob Alexander 2014-2015 for use with McHCK and Kiibohd-dfu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
@ -29,8 +29,6 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* XXX Not tested yet -HaaTa */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 8K, LENGTH = 256K-8K
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue