[ion] Ion::Device::reset::jump() jumps to the initialisation vector

This commit is contained in:
Léa Saviot
2019-03-13 16:21:48 +01:00
parent 2772fe5f28
commit 91dafd73ff
5 changed files with 11 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ SECTIONS {
* We're generating the ISR vector table in code because it's very
* convenient: using function pointers, we can easily point to the service
* routine for each interrupt. */
_isr_start = .;
KEEP(*(.isr_vector_table))
} >FLASH

View File

@@ -38,7 +38,7 @@ SECTIONS {
* We're generating the ISR vector table in code because it's very
* convenient: using function pointers, we can easily point to the service
* routine for each interrupt. */
_isr_start = .;
KEEP(*(.isr_vector_table))
} >INTERNAL_FLASH

View File

@@ -2,6 +2,8 @@
#include <regs/regs.h>
#include <drivers/cache.h>
extern void * _isr_start;
namespace Ion {
namespace Device {
namespace Reset {
@@ -19,8 +21,8 @@ void jump() {
Ion::Device::Cache::disableDCache();
Ion::Device::Cache::disableICache();
uint32_t * stackPointerAddress = reinterpret_cast<uint32_t *>(0x08000000);
uint32_t * resetHandlerAddress = reinterpret_cast<uint32_t *>(0x08000004);
uint32_t * stackPointerAddress = reinterpret_cast<uint32_t *>(&_isr_start);
uint32_t * resetHandlerAddress = stackPointerAddress + 1;
/* Jump to the reset service routine after having reset the stack pointer.
* Both addresses are fetched from the base of the Flash memory, just like a

View File

@@ -23,6 +23,7 @@ STACK_SIZE = 32K;
SECTIONS {
.isr_vector_table ORIGIN(RAM_BUFFER) : {
_isr_start = .;
KEEP(*(.isr_vector_table))
} >RAM_BUFFER

View File

@@ -25,6 +25,10 @@ MEMORY {
RAM_BUFFER (rw) : ORIGIN = EPSILON_STACK_END, LENGTH = 8K
}
/* The DFU needs to know to which address it should jump to after a leave
* command. This address is used in Ion::Device::Reset::jump(). */
_isr_start = 0x08000000;
SECTIONS {
.text : {
. = ALIGN(4);