blob: 4a161be1f638382509e4d9b624589fd87827c422 [file] [log] [blame]
Brian Silverman44311d62013-12-06 22:03:29 -08001#include <stdint.h>
2
3#include "cape/bootloader_handoff.h"
4
5// Sets everything up and then jumps to the main code.
6static void jump_to_main(void) __attribute__((noreturn));
7static void jump_to_main(void) {
8 // 0x20008000
9 __asm__ volatile(
10 "mov sp, %[stack]\n\t"
11 "bx %[reset]" : :
12 [stack]"r"(RAM_START + RAM_SIZE), [reset]"r"(MAIN_FLASH_START | 1)
13 : "memory");
14 __builtin_unreachable();
15}
16
Brian Silverman5020be62013-12-06 19:09:07 -080017void _start(void) {
Brian Silverman44311d62013-12-06 22:03:29 -080018 jump_to_main();
Brian Silverman5020be62013-12-06 19:09:07 -080019}