-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
target_common.c
43 lines (32 loc) · 1.18 KB
/
target_common.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Copyright (c) .NET Foundation and Contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#include <nanoHAL_v2.h>
#include "target_board.h"
#include "target_common.h"
#include <platform_target_capabilities.h>
HAL_SYSTEM_CONFIG HalSystemConfig = {
{true}, // HAL_DRIVER_CONFIG_HEADER Header;
1, // ConvertCOM_DebugHandle(1),
0, // ConvertCOM_DebugHandle(0),
921600,
0, // STDIO = COM2 or COM1
{RAM1_MEMORY_StartAddress, RAM1_MEMORY_Size},
{FLASH1_MEMORY_StartAddress, FLASH1_MEMORY_Size}};
HAL_TARGET_CONFIGURATION g_TargetConfiguration;
// this target can use DFU for updates
inline GET_TARGET_CAPABILITIES(TargetCapabilities_DfuUpdate);
inline TARGET_HAS_PROPRIETARY_BOOTER(true);
bool LaunchProprietaryBootloader()
{
// disable all interrupts in ChibiOS
chSysDisable();
// clear any pending interrupts to make sure we are jumping straight to DFU
SCB->ICSR &= SCB_ICSR_PENDSVCLR_Msk;
void (*jumpDfu)(void) = (void (*)(void)) (*((uint32_t *) 0x1FFF0000 + 4));
__set_MSP(*(__IO uint32_t*)0x1FFF0000);
jumpDfu();
return true;
}