[bootloader] Added trampolines

This commit is contained in:
M4x1m3
2022-02-26 13:36:54 +01:00
parent d16808183b
commit f2c17121d2
6 changed files with 54 additions and 1 deletions

View File

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