-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
55 lines (44 loc) · 1.16 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// FISH STM32F4 DISCO
// for stm32f4xx.h usage
#define STM32F40XX
//Without this:
// Fatal Error[Pe035]: #error directive:
// "Please select first the target STM32F4xx device
// used in your application (in stm32f4xx.h file)"
// For CMSIS function usage
#include "stm32f4xx.h"
#include "core_cm4.h" // For CMSIS NVIC_SystemReset function
#pragma call_graph_root = "interrupt"
__weak void HardFault_Handler( void ) {
// Don't use printf or other large lib constructs, use your own or tool debug io
NVIC_SystemReset();
}
//__weak void HardFault_Handler( void ) { FM3_COLD(); }
void C_CMSIS_DISABLE_IRQS() {
__disable_irq();
}
void C_CMSIS_ENABLE_IRQS() {
__enable_irq();
}
/*
void C_CMSIS_REV(unsigned long word)
{
// prototype is:
// unsigned long __REV(unsigned long);
// This works if word is passed in r0
__REV(word);
// Results is returned in r0
}
*/
#ifdef USE_CMAIN // defined in FISH_STM32F4_CONFIG_DEFINES.h
// May use this to prototype Smart-IO board attached to the fishy disco~!
int main(void) {
extern void FM3_COLD();
volatile static int i = 0 ;
while(1) {
FM3_COLD(); // FISH_return2c returns here
i++ ;
}
return 0 ;
}
#endif