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 ()
 
void __cpu_init ()
 
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 CpuStartUserProgram (void)
 

Function Documentation

◆ __cpu_init()

void __cpu_init ( )

Definition at line 16 of file openblt_chibios.cpp.

16 {
17 // *** this is about specifically stm32f7 ***
18 // This overrides the built-in __cpu_init() function
19 // We do this to avoid enabling the D/I caches, which
20 // we'll immediately have to turn back off when jumping
21 // to the main firmware (which will then enable them itself)
22}

◆ 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 28 of file openblt_chibios.cpp.

29{
30 memcpy((void*)dest, (void*)src, len);
31}

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 33 of file openblt_chibios.cpp.

34{
35 memset((void*)dest, value, len);
36}

◆ CpuStartUserProgram()

void CpuStartUserProgram ( void  )

Definition at line 43 of file openblt_chibios.cpp.

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

24 {
25 return 0;
26}

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.