mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[bootloader] Added trampolines
This commit is contained in:
@@ -4,6 +4,7 @@ bootloader_src += $(addprefix bootloader/,\
|
||||
slot.cpp \
|
||||
interface.cpp \
|
||||
jump_to_firmware.s \
|
||||
trampoline.cpp \
|
||||
)
|
||||
|
||||
bootloader_images = $(addprefix bootloader/, \
|
||||
|
||||
33
bootloader/trampoline.cpp
Normal file
33
bootloader/trampoline.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <ion/src/device/shared/drivers/flash.h>
|
||||
#include <ion/src/device/n0110/drivers/power.h>
|
||||
|
||||
#include "trampoline.h"
|
||||
|
||||
namespace Bootloader {
|
||||
|
||||
void __attribute__((noinline)) suspend() {
|
||||
Ion::Device::Power::internalFlashSuspend(true);
|
||||
}
|
||||
|
||||
void* Trampolines[TRAMPOLINES_COUNT]
|
||||
__attribute__((section(".trampolines_table")))
|
||||
__attribute__((used))
|
||||
= {
|
||||
(void*) Bootloader::suspend, // Suspend
|
||||
(void*) Ion::Device::Flash::EraseSector, // External erase
|
||||
(void*) Ion::Device::Flash::WriteMemory, // External write
|
||||
(void*) memcmp,
|
||||
(void*) memcpy,
|
||||
(void*) memmove,
|
||||
(void*) memset,
|
||||
(void*) strchr,
|
||||
(void*) strcmp,
|
||||
(void*) strlcat,
|
||||
(void*) strlcpy,
|
||||
(void*) strlen,
|
||||
(void*) strncmp
|
||||
};
|
||||
|
||||
}
|
||||
12
bootloader/trampoline.h
Normal file
12
bootloader/trampoline.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef BOOTLOADER_TRAMPOLINE_H
|
||||
#define BOOTLOADER_TRAMPOLINE_H
|
||||
|
||||
namespace Bootloader {
|
||||
|
||||
#define TRAMPOLINES_COUNT 13
|
||||
|
||||
extern void* Trampolines[TRAMPOLINES_COUNT];
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user