mirror of https://github.com/rusefi/openblt.git
Refs #1102. Improved SysTick reset in STM32 ports.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@795 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
7dee47c86a
commit
756ef1fb55
|
@ -117,10 +117,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* enable system configuration peripheral, which is needed to remap the RAM later on */
|
/* enable system configuration peripheral, which is needed to remap the RAM later on */
|
||||||
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SYSCFG);
|
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SYSCFG);
|
||||||
/* copy user program vector's to RAM */
|
/* copy user program vector's to RAM */
|
||||||
|
|
|
@ -70,8 +70,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* set the systick's status and control register back into the default reset value */
|
/* set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,10 +111,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -70,8 +70,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* set the systick's status and control register back into the default reset value */
|
/* set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ void CpuInit(void)
|
||||||
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
||||||
* safety reasons. if the bootloader was started from a running user program, it could
|
* safety reasons. if the bootloader was started from a running user program, it could
|
||||||
* be that the user program did not properly disable the interrupt generation of
|
* be that the user program did not properly disable the interrupt generation of
|
||||||
* peripherals. */
|
* peripherals.
|
||||||
|
*/
|
||||||
CpuIrqDisable();
|
CpuIrqDisable();
|
||||||
} /*** end of CpuInit ***/
|
} /*** end of CpuInit ***/
|
||||||
|
|
||||||
|
@ -109,10 +110,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ void CpuInit(void)
|
||||||
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
||||||
* safety reasons. if the bootloader was started from a running user program, it could
|
* safety reasons. if the bootloader was started from a running user program, it could
|
||||||
* be that the user program did not properly disable the interrupt generation of
|
* be that the user program did not properly disable the interrupt generation of
|
||||||
* peripherals. */
|
* peripherals.
|
||||||
|
*/
|
||||||
CpuIrqDisable();
|
CpuIrqDisable();
|
||||||
} /*** end of CpuInit ***/
|
} /*** end of CpuInit ***/
|
||||||
|
|
||||||
|
@ -109,10 +110,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ void CpuInit(void)
|
||||||
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
/* bootloader runs in polling mode so disable the global interrupts. this is done for
|
||||||
* safety reasons. if the bootloader was started from a running user program, it could
|
* safety reasons. if the bootloader was started from a running user program, it could
|
||||||
* be that the user program did not properly disable the interrupt generation of
|
* be that the user program did not properly disable the interrupt generation of
|
||||||
* peripherals. */
|
* peripherals.
|
||||||
|
*/
|
||||||
CpuIrqDisable();
|
CpuIrqDisable();
|
||||||
} /*** end of CpuInit ***/
|
} /*** end of CpuInit ***/
|
||||||
|
|
||||||
|
@ -109,10 +110,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,10 +110,10 @@ void CpuStartUserProgram(void)
|
||||||
/* release the communication interface */
|
/* release the communication interface */
|
||||||
ComFree();
|
ComFree();
|
||||||
#endif
|
#endif
|
||||||
/* reset the timer */
|
|
||||||
TimerReset();
|
|
||||||
/* reset the HAL */
|
/* reset the HAL */
|
||||||
HAL_DeInit();
|
HAL_DeInit();
|
||||||
|
/* reset the timer */
|
||||||
|
TimerReset();
|
||||||
/* remap user program's vector table */
|
/* remap user program's vector table */
|
||||||
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
|
||||||
/* set the address where the bootloader needs to jump to. this is the address of
|
/* set the address where the bootloader needs to jump to. this is the address of
|
||||||
|
|
|
@ -71,8 +71,10 @@ void TimerInit(void)
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
void TimerReset(void)
|
void TimerReset(void)
|
||||||
{
|
{
|
||||||
/* Set the systick's status and control register back into the default reset value. */
|
/* Set the systick's registers back into the default reset value. */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
} /* end of TimerReset */
|
} /* end of TimerReset */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue