02 platform_config.h

CPUの種別に依存した定義をするのではなく、ここではプリント基板に依存した定義をしています.

冒頭で、いろんなプリント基板をセレクトするようになっています.

ここでつかうSTM32-DISCOVERY(value line)を指すのは USE_STM32_VLD です.

CQ出版社のプリント基板とか、strawberry linuxのプリント基板と思われる名前が見えます.

以降では、USE_STM32_VLD 以外の記述は割愛します.

/* Uncomment the line corresponding to the STMicroelectronics evaluation board

used to run the example */

#if !defined (USE_STM32_P103) && \

!defined (USE_STM32_H103) && \

!defined (USE_CQ_STARM) && \

!defined (USE_CQ_ST103Z) && \

!defined (USE_STM3210E_EVAL) && \

!defined (USE_STBEE) && \

!defined (USE_STBEE_MINI) && \

!defined (USE_STBEE_MINI_SWD) && \

!defined (USE_STM32_VLD)

//#define USE_STM32_P103

//#define USE_STM32_H103

//#define USE_CQ_STARM

//#define USE_CQ_ST103Z

//#define USE_STM3210E_EVAL

#define USE_STBEE

//#define USE_STBEE_MINI

//#define USE_STBEE_MINI_SWD

//#define USE_STM32_VLD

#endif

たぶんdebug用の通信経路を選択しているんだと思います.USART1を指定してます.

以降ではUSE_USART1 以外の記述は割愛します.

/* Uncomment the mecro below interface you to use as cprintf() macro*/

#if !defined (USE_USART1) && \

!defined (USE_USART2) && \

!defined (USE_USART3) && \

!defined (USE_DCC) && \

!defined (USE_VCP)

#define USE_USART1

//#define USE_USART2

//#define USE_USART3

//#define USE_DCC

//#define USE_VCP

#endif

debug用通信関数の定義

//Define cprintf of actual interface function

#define USARTX_Configuration() USART_Configuration(USART1, 115200)

#define RECEIVE_DATA USART_ReceiveData(USART1)

#define cputchar(arg) USART_PrintChar(USART1, arg)

#define cprintf(...) USART_PrintFormatted(USART1, __VA_ARGS__)

#define RX_BUFFER_IS_NOT_EMPTY USART_GetFlagStatus(USART1, USART_FLAG_RXNE) != RESET

#define RX_BUFFER_IS_EMPTY USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET

#define TX_BUFFER_IS_NOT_EMPTY USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET

DFUって何だったか忘れました.USBでdebugするtoolだったかな?

//Define the location of vector table

#ifdef USE_DFU

#define VECTOR_OFFSET 0x3000

#else

#define VECTOR_OFFSET 0x0

#endif

STM32-DISCOVERY value lineの定義ファイルをインクルード

/* Define the STM32F10x hardware depending on the used evaluation board */

#include "STM32_VLD.h" 中身はこちらを参照

/* Uncomment the line corresponding to the STMicroelectronics evaluation board

used to run the example */

#if !defined (JTAG_SWD_Enabled) && \

!defined (JTAG_SWD_Enabled_without_NJTRST) && \

!defined (JTAG_Disabled_SWD_Enabled) && \

!defined (JTAG_SWD_Disabled)

#define JTAG_SWD_Enabled

//#define JTAG_SWD_Enabled_without_NJTRST

//#define JTAG_Disabled_SWD_Enabled

//#define JTAG_SWD_Disabled

#endif

/* Private function prototypes -----------------------------------------------*/

void BoardInit(void);

#endif /* __PLATFORM_CONFIG_H */