Update README.md

Adapt code to UHK HW and FW (bl_main.c and shutdown_cleanup.c)
Change vector reset configuration (MK22F51212/src/startup/gcc/startup_MK22F51212.S)
Adapt peripheral configuration and start address of UHK (bootloader_config.h)
Adapt clock configuration to make it compatible with UHK.
Added binaries to test the bootloader.
This commit is contained in:
santiagogf89@gmail.com
2016-11-13 19:17:01 +01:00
parent f3dfaa4bb7
commit 91996c28fc
8 changed files with 4379 additions and 50 deletions

View File

@@ -30,6 +30,8 @@
#ifndef __BOOTLOADER_CONFIG_H__
#define __BOOTLOADER_CONFIG_H__
/* SGF Original KBOOT file modified */
////////////////////////////////////////////////////////////////////////////////
// Definitions
////////////////////////////////////////////////////////////////////////////////
@@ -42,21 +44,21 @@
//@{
#if !defined(BL_CONFIG_SCUART)
#define BL_CONFIG_SCUART (1)
#define BL_CONFIG_SCUART (0)
#endif
#if !defined(BL_CONFIG_I2C)
#define BL_CONFIG_I2C (1)
#define BL_CONFIG_I2C (0)
#endif
#if !defined(BL_CONFIG_DSPI)
#define BL_CONFIG_DSPI (1)
#define BL_CONFIG_DSPI (0)
#endif
#if !defined(BL_CONFIG_USB_HID)
#define BL_CONFIG_USB_HID (1)
#endif
#if !defined(BL_CONFIG_USB_MSC)
#define BL_CONFIG_USB_MSC (1)
#define BL_CONFIG_USB_MSC (0)
#endif
#define BL_TARGET_FLASH (1)
//@}
#if !defined(BL_TARGET_FLASH) && !defined(BL_TARGET_RAM)
@@ -101,7 +103,7 @@
// The bootloader will check this address for the application vector table upon startup.
#if !defined(BL_APP_VECTOR_TABLE_ADDRESS)
#define BL_APP_VECTOR_TABLE_ADDRESS 0xa000
#define BL_APP_VECTOR_TABLE_ADDRESS 0xc000 /* SGF Change vector table entry point for application*/
#endif
/* Serial Port Info */

View File

@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* SGF Original KBOOT file modified */
#include "bootloader_common.h"
#include "bootloader/bl_context.h"
#include "property/property.h"
@@ -177,6 +179,11 @@ void configure_clocks(bootloader_clock_option_t option)
// Restore clock divider
SIM->CLKDIV1 = s_defaultClockDivider;
//SGF fix the issue when jumping to UHK app
SIM->SOPT1 = 0x80000000; // Just restoring the value out of reset.
SIM->SOPT2 = 0x00001000; // Just restoring the value out of reset.
//end SGF
}
#endif // BL_TARGET_FLASH

View File

@@ -37,6 +37,9 @@
/*****************************************************************************/
/* Version: GCC for ARM Embedded Processors */
/*****************************************************************************/
/* SGF Original KBOOT file modified */
.syntax unified
.arch armv7-m
@@ -289,21 +292,26 @@ __isr_vector:
#ifdef BL_HAS_BOOTLOADER_CONFIG
/* SGF Take into account that this isnt having any effect. The BL config that will be used in runtime is stored in the application that will be programmed
by the bootloader. The real BCA (BL config area) will be stored at 0xc3c0. This gives the advantage that we can customize the behavior of the BL in
the future by just updating this area in the new binary of UHK_Right that will be programmed via the bootloader.
*/
//__bootloaderConfigurationArea ; 0x3c0
// .long 'kcfg' // [00:03] tag - Tag value used to validate the bootloader configuration data. Must be set to 'kcfg'
.long 0x6766636b
.long 0x6766636b /* Be aware of endianness SGF */
.long 0xFFFFFFFF // [04:07] crcStartAddress
.long 0xFFFFFFFF // [08:0b] crcByteCount
.long 0xFFFFFFFF // [0c:0f] crcExpectedValue
.byte 0xFF // [10:10] enabledPeripherals
.byte 0x10 // [10:10] enabledPeripherals /* SGF Bit 4 corresponds to USB HID */
.byte 0xFF // [11:11] i2cSlaveAddress
.short 5000 // [12:13] peripheralDetectionTimeoutMs - Timeout in milliseconds for peripheral detection before jumping to application code
.short 0xFFFF // [14:15] usbVid
.short 0xFFFF // [16:17] usbPid
.short 0xFFFF // [14:15] usbVid
.short 0xFFFF // [16:17] usbPid
.long 0xFFFFFFFF // [18:1b] usbStringsPointer
.byte 0xFF // [1c:1c] clockFlags - High Speed and other clock options
.byte 0x00 // [1c:1c] clockFlags - High Speed and other clock options /* SGF Set to 0 to enable 48 MHz CLK and USB HID */
.byte 0xFF // [1d:1d] clockDivider - One's complement of clock divider, zero divider is divide by 1
.short 0xFFFF // [1e:1f] reserved
.byte 0xFF // [1e] SGF Direct boot in 1's complement. FE means direct boot enabled.
.byte 0xFF // [1f] reserved
// Fill to align with flash configuration field.
.long 0xFFFFFFFF
.long 0xFFFFFFFF
@@ -335,7 +343,7 @@ __isr_vector:
.size __isr_vector, . - __isr_vector
/* Flash Configuration */
/* Flash Configuration */ /* SGF TODO add Flash protection for the Bootloader sectors. */
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF