dev.h
2.24 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __DEV_H
#define __DEV_H
#include "stm32f4xx.h"
//#include "stm32f4xx_conf.h"
//#include "stdio.h"
//#include "stdbool.h"
//#include "stdlib.h"
//#include "string.h"
#define U485_RX_Pin GPIO_Pin_2
#define U485_RX_Port GPIOD
#define U485_TX_Pin GPIO_Pin_12
#define U485_TX_Port GPIOC
//MFGW01A1版本
#define EN_485_Pin_1 GPIO_Pin_3
#define EN_485_Port_1 GPIOD
//MFGW01B1以后版本
#define EN_485_Pin_2 GPIO_Pin_10
#define EN_485_Port_2 GPIOF
#define DBG_RXD_Pin GPIO_Pin_9
#define DBG_RXD_Port GPIOA
#define DBG_TXD_Pin GPIO_Pin_10
#define DBG_TXD_Port GPIOA
#define ARM_LED1_Pin GPIO_Pin_8
#define ARM_LED1_Port GPIOA
#define ARM_LED2_Pin GPIO_Pin_8
#define ARM_LED2_Port GPIOG
#define ARM_LED3_Pin GPIO_Pin_7
#define ARM_LED3_Port GPIOG
#define ARM_LED4_Pin GPIO_Pin_6
#define ARM_LED4_Port GPIOG
//以下为汇编函数
void WFI_SET(void); //执行WFI指令
void INTX_DISABLE(void); //关闭所有中断
void INTX_ENABLE(void); //开启所有中断
void MSR_MSP(u32 addr); //设置堆栈地址
#define BOOTLOADER_RUN 0x1234ABCD
#define BOOTLOADER_LOAD 0x4567AABB
#define BOOTLOADER_DEFAULT 0xFFFFFFFF
#define FLAG_BASE_ADDR 0x08004000 //Sector 3用于系统标志存储
#define PARAM_BASE_ADDR 0x08008000 //存储参数的基地址
#define APP_RUN_ADDR 0x08010000 //运行
#define APP_LOAD_ADDR 0x08080000 //更新
/* MCU STM32F407ZGT6 FLASH:1024k,SRAM:192k */
/**********************************************************
* SECTOR | BLOCK BASE ADDR | SIZE
*
* sector0 | 0x0800 0000~0x0800 3FFF | 16K //BOOTLOADER
*
* sector1 | 0x0800 4000~0x0800 7FFF | 16K //FLAG
*
* sector2 | 0x0800 8000~0x0800 BFFF | 16K //PARAM
*
* sector3 | 0x0800 C000~0x0800 FFFF | 16K //待定
*
* sector4 | 0x0801 0000~0x0801 FFFF | 64K //RUN APP
*
* sector5 | 0x0802 0000~0x0803 FFFF | 128K
*
* sector6 | 0x0804 0000~0x0805 FFFF | 128K
*
* sector7 | 0x0806 0000~0x0807 FFFF | 128K
* sector8 | 0x0808 0000~0x0809 FFFF | 128K //LOAD APP
* sector9 | 0x080A 0000~0x080B FFFF | 128K
* sector10 | 0x080C 0000~0x080D FFFF | 128K
* sector11 | 0x080E 0000~0x080F FFFF | 128K ...
*************************************************************/
#endif