Переход в новую организацию
This commit is contained in:
commit
e89bb3c822
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 02.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_ARTERY_BOOTLOADER_JUMP_H
|
||||||
|
#define UVEOS_ON_ARTERY_BOOTLOADER_JUMP_H
|
||||||
|
|
||||||
|
#include "stdint.h"
|
||||||
|
|
||||||
|
void BootJumpToAddress(const uint32_t address);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_ARTERY_BOOTLOADER_JUMP_H
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 02.11.22.
|
||||||
|
//
|
||||||
|
#include CMSIS_device_header
|
||||||
|
|
||||||
|
typedef void (*pFunction)(void);
|
||||||
|
|
||||||
|
void BootJumpToAddress(const uint32_t address) {
|
||||||
|
|
||||||
|
uint32_t appStack;
|
||||||
|
pFunction appEntry;
|
||||||
|
|
||||||
|
// get the application stack pointer (1st entry in the app vector table)
|
||||||
|
appStack = (uint32_t) *((__IO
|
||||||
|
uint32_t *) address);
|
||||||
|
|
||||||
|
// Get the app entry point (2nd entry in the app vector table
|
||||||
|
appEntry = (pFunction) *(__IO
|
||||||
|
uint32_t *) (address + 4);
|
||||||
|
|
||||||
|
// HAL_RCC_DeInit();
|
||||||
|
// HAL_DeInit();
|
||||||
|
|
||||||
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
|
uint32_t i = SCB->VTOR;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
// Reconfigure vector table offset to match the app location
|
||||||
|
//#if (SET_VECTOR_TABLE)
|
||||||
|
// SCB->VTOR = address;
|
||||||
|
//#endif
|
||||||
|
//
|
||||||
|
//// __disable_irq(); // disable interrupt
|
||||||
|
//// __enable_irq();
|
||||||
|
//// __set_PRIMASK(1);
|
||||||
|
//// __set_MSP(appStack); // Set app stack pointer
|
||||||
|
|
||||||
|
__disable_irq();
|
||||||
|
__set_MSP(appStack);
|
||||||
|
SCB->VTOR = address;
|
||||||
|
__enable_irq();
|
||||||
|
|
||||||
|
appEntry(); // Start the app
|
||||||
|
|
||||||
|
while (1); // never reached
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"Inc"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"Src/**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue