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
|
||||
@@ -7,7 +7,7 @@ $(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_ex
|
||||
|
||||
|
||||
$(BUILD_DIR)/bootloader.$(EXE): $(call flavored_object_for,$(bootloader_src),usbxip)
|
||||
$(BUILD_DIR)/bootloader.$(EXE): LDSCRIPT = ion/test/device/n0110/external_flash_tests.ld
|
||||
$(BUILD_DIR)/bootloader.$(EXE): LDSCRIPT = ion/src/device/n0110/internal_flash.ld
|
||||
|
||||
.PHONY: %_flash
|
||||
%_flash: $(BUILD_DIR)/%.dfu
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Device {
|
||||
namespace Power {
|
||||
|
||||
void standbyConfiguration();
|
||||
void internalFlashSuspend(bool isLEDActive);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ MEMORY {
|
||||
}
|
||||
|
||||
STACK_SIZE = 32K;
|
||||
TRAMPOLINES_OFFSET = 0xE000;
|
||||
|
||||
SECTIONS {
|
||||
.isr_vector_table ORIGIN(INTERNAL_FLASH) : {
|
||||
@@ -69,6 +70,11 @@ SECTIONS {
|
||||
_data_section_end_ram = .;
|
||||
} >SRAM AT> INTERNAL_FLASH
|
||||
|
||||
.trampolines_table : {
|
||||
. = ORIGIN(INTERNAL_FLASH) + TRAMPOLINES_OFFSET;
|
||||
KEEP(*(.trampolines_table));
|
||||
} > INTERNAL_FLASH
|
||||
|
||||
.bss : {
|
||||
/* The bss section contains data for all uninitialized variables
|
||||
* So like the .data section, it will go in RAM, but unlike the data section
|
||||
|
||||
Reference in New Issue
Block a user