mirror of
https://github.com/andreili/katapult.git
synced 2025-08-24 03:44:06 +02:00
arm: add canboot signature to request handler
Implement through inline assembly as recommended by Kevin O'Connor. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
9b4c95ee9a
commit
b944d094b3
@ -18,7 +18,7 @@ extern uint32_t _stack_end;
|
|||||||
* Basic interrupt handlers
|
* Basic interrupt handlers
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
static void __noreturn
|
void __noreturn __visible
|
||||||
reset_handler_stage_two(void)
|
reset_handler_stage_two(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -74,17 +74,23 @@ reset_handler_stage_two(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial code entry point - invoked by the processor after a reset
|
#define CANBOOT_SIGNATURE 0x21746f6f426e6143 // CanBoot!
|
||||||
// Reset interrupts and stack to take control from bootloaders
|
|
||||||
void
|
|
||||||
ResetHandler(void)
|
|
||||||
{
|
|
||||||
__disable_irq();
|
|
||||||
|
|
||||||
// Explicitly load the stack pointer, jump to stage two
|
// Initial code entry point - invoked by the processor after a reset
|
||||||
asm volatile("mov sp, %0\n bx %1"
|
// Reset interrupts and stack to take control from bootloaders. Implemented
|
||||||
: : "r"(&_stack_end), "r"(reset_handler_stage_two));
|
// Kevin's recommendation.
|
||||||
}
|
asm(".section .text.ResetHandler\n"
|
||||||
|
".8byte " __stringify(CANBOOT_SIGNATURE) "\n"
|
||||||
|
".global ResetHandler\n"
|
||||||
|
".type ResetHandler, %function\n"
|
||||||
|
"ResetHandler:\n"
|
||||||
|
" cpsid i\n"
|
||||||
|
" ldr r3, =_stack_end\n"
|
||||||
|
" mov sp, r3\n"
|
||||||
|
" b reset_handler_stage_two\n"
|
||||||
|
" .pool\n"
|
||||||
|
);
|
||||||
|
extern void ResetHandler();
|
||||||
DECL_ARMCM_IRQ(ResetHandler, -15);
|
DECL_ARMCM_IRQ(ResetHandler, -15);
|
||||||
|
|
||||||
// Code called for any undefined interrupts
|
// Code called for any undefined interrupts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user