src: remove references to the magic key

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-26 08:26:45 -04:00
parent 76474d6efd
commit c5163674ed
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
4 changed files with 2 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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