mirror of
https://github.com/andreili/katapult.git
synced 2025-08-23 19:34:06 +02:00
bootentry: Move set_bootup_code() signatures to misc.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b45941967d
commit
ed2bf3e8b0
@ -13,8 +13,6 @@
|
||||
#include "ctr.h" // DECL_CTR
|
||||
#include "sched.h" // udelay
|
||||
|
||||
#define REQUEST_SIG 0x5984E3FA6CA1589B // Random request sig
|
||||
|
||||
// Generated by buildcommands.py
|
||||
DECL_CTR("DECL_BUTTON " __stringify(CONFIG_BUTTON_PIN));
|
||||
extern int32_t button_gpio, button_high, button_pullup;
|
||||
@ -38,7 +36,7 @@ check_double_reset(void)
|
||||
return;
|
||||
// set request signature and delay for two seconds. This enters the bootloader if
|
||||
// the reset button is double clicked
|
||||
set_bootup_code(REQUEST_SIG);
|
||||
set_bootup_code(REQUEST_CANBOOT);
|
||||
udelay(500000);
|
||||
set_bootup_code(0);
|
||||
// No reset, read the key back out to clear it
|
||||
@ -52,7 +50,7 @@ bootentry_check(void)
|
||||
// - The request signature is set in memory (request from app)
|
||||
// - No application code is present
|
||||
uint64_t bootup_code = get_bootup_code();
|
||||
if (bootup_code == REQUEST_SIG || !application_check_valid()
|
||||
if (bootup_code == REQUEST_CANBOOT || !application_check_valid()
|
||||
|| check_button_pressed()) {
|
||||
// Start bootloader main loop
|
||||
set_bootup_code(0);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "autoconf.h" // CONFIG_MCU
|
||||
#include "board/internal.h" // SysTick
|
||||
#include "board/irq.h" // irq_disable
|
||||
#include "board/misc.h" // get_bootup_code
|
||||
#include "command.h" // DECL_CONSTANT_STR
|
||||
|
||||
// Export MCU type
|
||||
@ -54,8 +55,6 @@ application_check_valid(void)
|
||||
return *app != 0 && *app != 0xffffffff;
|
||||
}
|
||||
|
||||
#define REQUEST_START_APP 0x7b06ec45a9a8243d
|
||||
|
||||
// Jump to the main application (exiting the bootloader)
|
||||
void
|
||||
application_jump(void)
|
||||
@ -103,8 +102,6 @@ reset_handler_stage_two(void)
|
||||
;
|
||||
}
|
||||
|
||||
#define CANBOOT_SIGNATURE 0x21746f6f426e6143 // CanBoot!
|
||||
|
||||
// Initial code entry point - invoked by the processor after a reset
|
||||
asm(".section .text.ResetHandler\n"
|
||||
".balign 8\n"
|
||||
|
@ -8,6 +8,10 @@ struct command_encoder;
|
||||
void console_sendf(const struct command_encoder *ce, va_list args);
|
||||
void *console_receive_buffer(void);
|
||||
|
||||
#define CANBOOT_SIGNATURE 0x21746f6f426e6143 // CanBoot!
|
||||
#define REQUEST_CANBOOT 0x5984E3FA6CA1589B
|
||||
#define REQUEST_START_APP 0x7b06ec45a9a8243d
|
||||
|
||||
uint64_t get_bootup_code(void);
|
||||
void set_bootup_code(uint64_t code);
|
||||
void application_read_flash(uint32_t address, uint32_t *dest);
|
||||
|
Loading…
x
Reference in New Issue
Block a user