mirror of
https://github.com/andreili/katapult.git
synced 2025-08-23 19:34:06 +02:00
src: remove references to the magic key
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
76474d6efd
commit
c5163674ed
@ -5,8 +5,6 @@
|
||||
#include <stdint.h> // uint8_t
|
||||
#include "autoconf.h" // CONFIG_MACH_STM32F0
|
||||
|
||||
uint16_t read_magic_key(void);
|
||||
void set_magic_key(void);
|
||||
void jump_to_application(void);
|
||||
|
||||
// Timer Functions
|
||||
|
@ -184,11 +184,6 @@ config FLASH_PAGE_SIZE
|
||||
default 0x800 if MACH_STM32F103 && STM32F1_PAGE_SIZE_800
|
||||
default 0x400
|
||||
|
||||
config MAGIC_KEY
|
||||
hex
|
||||
default 0x85D3 if MACH_STM32F103
|
||||
default 0x85D3
|
||||
|
||||
config BLOCK_SIZE
|
||||
int
|
||||
default 64
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "autoconf.h" // CONFIG_CLOCK_REF_FREQ
|
||||
#include "board/armcm_boot.h" // armcm_main
|
||||
#include "board/irq.h" // irq_disable
|
||||
#include "board/misc.h" // read magic key
|
||||
#include "board/misc.h" // jump_to_application
|
||||
#include "internal.h" // enable_pclock
|
||||
#include "canboot_main.h" // sched_main
|
||||
|
||||
@ -116,37 +116,6 @@ armcm_main(void)
|
||||
canboot_main();
|
||||
}
|
||||
|
||||
uint16_t
|
||||
read_magic_key(void)
|
||||
{
|
||||
irq_disable();
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
|
||||
RCC->APB1ENR;
|
||||
uint16_t val = RTC->BKP4R;
|
||||
if (val) {
|
||||
// clear the key
|
||||
PWR->CR |= PWR_CR_DBP;
|
||||
RTC->BKP4R = 0;
|
||||
PWR->CR &=~ PWR_CR_DBP;
|
||||
}
|
||||
RCC->APB1ENR &= ~RCC_APB1ENR_PWREN;
|
||||
irq_enable();
|
||||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
set_magic_key(void)
|
||||
{
|
||||
irq_disable();
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
|
||||
RCC->APB1ENR;
|
||||
PWR->CR |= PWR_CR_DBP;
|
||||
RTC->BKP4R = CONFIG_MAGIC_KEY;
|
||||
PWR->CR &=~ PWR_CR_DBP;
|
||||
RCC->APB1ENR &= ~RCC_APB1ENR_PWREN;
|
||||
irq_enable();
|
||||
}
|
||||
|
||||
typedef void (*func_ptr)(void);
|
||||
|
||||
void
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "board/armcm_boot.h" // VectorTable
|
||||
#include "board/irq.h" // irq_disable
|
||||
#include "internal.h" // enable_pclock
|
||||
#include "board/misc.h" // read_magic_key
|
||||
#include "board/misc.h" // jump_to_application
|
||||
#include "canboot_main.h" // canboot_main
|
||||
|
||||
#define FREQ_PERIPH (CONFIG_CLOCK_FREQ / 2)
|
||||
@ -238,35 +238,6 @@ armcm_main(void)
|
||||
canboot_main();
|
||||
}
|
||||
|
||||
uint16_t
|
||||
read_magic_key(void)
|
||||
{
|
||||
irq_disable();
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN;
|
||||
uint16_t val = BKP->DR4;
|
||||
if (val) {
|
||||
// clear the key
|
||||
PWR->CR |= PWR_CR_DBP;
|
||||
BKP->DR4 = 0;
|
||||
PWR->CR &=~ PWR_CR_DBP;
|
||||
}
|
||||
RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN);
|
||||
irq_enable();
|
||||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
set_magic_key(void)
|
||||
{
|
||||
irq_disable();
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN;
|
||||
PWR->CR |= PWR_CR_DBP;
|
||||
BKP->DR4 = CONFIG_MAGIC_KEY;
|
||||
PWR->CR &=~ PWR_CR_DBP;
|
||||
RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN);
|
||||
irq_enable();
|
||||
}
|
||||
|
||||
typedef void (*func_ptr)(void);
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user