rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
openblt_chibios.cpp File Reference

Functions

void CpuInit ()
 
void TimerInit ()
 
void TimerReset ()
 
void TimerUpdate ()
 
blt_int32u TimerGet ()
 
void CpuMemCopy (blt_addr dest, blt_addr src, blt_int16u len)
 
void CpuMemSet (blt_addr dest, blt_int8u value, blt_int16u len)
 
void __cpu_deinit (void)
 
void CpuStartUserProgram (void)
 

Function Documentation

◆ __cpu_deinit()

void __cpu_deinit ( void  )

Definition at line 30 of file openblt_chibios.cpp.

30 {
31#if CORTEX_MODEL == 7
32 SCB_DisableICache();
33 SCB_DisableDCache();
34#endif
35}

Referenced by CpuStartUserProgram().

Here is the caller graph for this function:

◆ CpuInit()

void CpuInit ( )

Definition at line 8 of file openblt_chibios.cpp.

8{ }

◆ CpuMemCopy()

void CpuMemCopy ( blt_addr  dest,
blt_addr  src,
blt_int16u  len 
)

Definition at line 19 of file openblt_chibios.cpp.

20{
21 memcpy((void*)dest, (void*)src, len);
22}

Referenced by Rs232ReceivePacket().

Here is the caller graph for this function:

◆ CpuMemSet()

void CpuMemSet ( blt_addr  dest,
blt_int8u  value,
blt_int16u  len 
)

Definition at line 24 of file openblt_chibios.cpp.

25{
26 memset((void*)dest, value, len);
27}

◆ CpuStartUserProgram()

void CpuStartUserProgram ( void  )

Definition at line 42 of file openblt_chibios.cpp.

43{
44 void (*pProgResetHandler)(void);
45
46 /* check if a user program is present by verifying the checksum */
47 if (NvmVerifyChecksum() == BLT_FALSE)
48 {
49#if (BOOT_COM_DEFERRED_INIT_ENABLE > 0) && (BOOT_COM_ENABLE > 0)
50 /* bootloader will stay active so perform deferred initialization to make sure
51 * the communication interface that were not yet initialized are now initialized.
52 * this is needed to make sure firmware updates via these communication interfaces
53 * will be possible.
54 */
55 ComDeferredInit();
56#endif
57 /* not a valid user program so it cannot be started */
58 return;
59 }
60#if (BOOT_CPU_USER_PROGRAM_START_HOOK > 0)
61 /* invoke callback */
62 if (CpuUserProgramStartHook() == BLT_FALSE)
63 {
64 #if (BOOT_COM_DEFERRED_INIT_ENABLE > 0) && (BOOT_COM_ENABLE > 0)
65 /* bootloader will stay active so perform deferred initialization to make sure
66 * the communication interface that were not yet initialized are now initialized.
67 * this is needed to make sure firmware updates via these communication interfaces
68 * will be possible.
69 */
70 ComDeferredInit();
71 #endif
72 /* callback requests the user program to not be started */
73 return;
74 }
75#endif
76#if (BOOT_COM_ENABLE > 0)
77 /* release the communication interface */
78 ComFree();
79#endif
80 /* reset the HAL */
81 chSysDisable();
82 /* reset the timer */
83 TimerReset();
84
85 /* Core deinitialization to jump into Prog in fresh state.*/
87
88 /* remap user program's vector table */
89 SCB->VTOR = CPU_USER_PROGRAM_VECTABLE_OFFSET & (blt_int32u)0x1FFFFF80;
90 /* set the address where the bootloader needs to jump to. this is the address of
91 * the 2nd entry in the user program's vector table. this address points to the
92 * user program's reset handler.
93 */
94 pProgResetHandler = (void(*)(void))(*((blt_addr *)CPU_USER_PROGRAM_STARTADDR_PTR));
95 /* The Cortex-M4 core has interrupts enabled out of reset. the bootloader
96 * explicitly disables these for security reasons. Enable them here again, so it does
97 * not have to be done by the user program.
98 */
99 /* start the user program by activating its reset interrupt service routine */
100 pProgResetHandler();
101#if (BOOT_COM_DEFERRED_INIT_ENABLE > 0) && (BOOT_COM_ENABLE > 0)
102 /* theoretically, the code never gets here because the user program should now be
103 * running and the previous function call should not return. In case it did return
104 * for whatever reason, make sure all communication interfaces are initialized so that
105 * firmware updates can be started.
106 */
107 ComDeferredInit();
108#endif
109} /*** end of CpuStartUserProgram ***/
blt_bool CpuUserProgramStartHook(void)
Callback that gets called when the bootloader is about to exit and hand over control to the user prog...
Definition hooks.c:86
blt_bool NvmVerifyChecksum(void)
Verifies the checksum, which indicates that a valid user program is present and can be started.
Definition nvm.c:108
void __cpu_deinit(void)
void TimerReset()
unsigned int blt_int32u
Definition types.h:53
unsigned long blt_addr
Definition types.h:48

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimerGet()

blt_int32u TimerGet ( )

Definition at line 15 of file openblt_chibios.cpp.

15 {
16 return 0;
17}

Referenced by LedBlinkTask(), and Rs232ReceivePacket().

Here is the caller graph for this function:

◆ TimerInit()

void TimerInit ( )

Definition at line 10 of file openblt_chibios.cpp.

10{ }

◆ TimerReset()

void TimerReset ( )

Definition at line 11 of file openblt_chibios.cpp.

11{ }

Referenced by CpuStartUserProgram().

Here is the caller graph for this function:

◆ TimerUpdate()

void TimerUpdate ( )

Definition at line 13 of file openblt_chibios.cpp.

13{ }

Go to the source code of this file.