Skip to content

Commit eb380d7

Browse files
committed
stm: Put TARGET in mpconfigport.h; support PYBv4.
1 parent 8517bce commit eb380d7

7 files changed

Lines changed: 59 additions & 417 deletions

File tree

stm/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ STMSRC=lib
1717
FATFSSRC=fatfs
1818
CC3KSRC=cc3k
1919
DFU=../tools/dfu.py
20-
TARGET=PYBOARD
2120
OSC_VALUE=8000000
2221

2322
AS = arm-none-eabi-as
@@ -27,7 +26,7 @@ OBJCOPY = arm-none-eabi-objcopy
2726
SIZE = arm-none-eabi-size
2827

2928
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40_41xxx -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=$(OSC_VALUE)
30-
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(CMSIS) -I$(STMSRC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) -D$(TARGET)
29+
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(CMSIS) -I$(STMSRC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4)
3130
#CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE
3231

3332
#Debugging/Optimization

stm/led.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@
3232
#define PYB_LED_ON(port, pin) (port->BSRRH = pin)
3333
#define PYB_LED_OFF(port, pin) (port->BSRRL = pin)
3434

35+
#elif defined(PYBOARD4)
36+
#define PYB_LED1_PORT (GPIOA)
37+
#define PYB_LED1_PIN (GPIO_Pin_13)
38+
39+
#define PYB_LED2_PORT (GPIOA)
40+
#define PYB_LED2_PIN (GPIO_Pin_14)
41+
42+
#define PYB_LED3_PORT (GPIOA)
43+
#define PYB_LED3_PIN (GPIO_Pin_15)
44+
45+
#define PYB_LED4_PORT (GPIOB)
46+
#define PYB_LED4_PIN (GPIO_Pin_4)
47+
48+
#define PYB_OTYPE (GPIO_OType_PP)
49+
50+
#define PYB_LED_ON(port, pin) (port->BSRRL = pin)
51+
#define PYB_LED_OFF(port, pin) (port->BSRRH = pin)
52+
3553
#elif defined(STM32F4DISC)
3654
#define PYB_LED1_PORT (GPIOD)
3755
#define PYB_LED1_PIN (GPIO_Pin_14)

stm/lib/stm324x7i_eval.c

Lines changed: 10 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -41,124 +41,6 @@
4141
#include "stm324x7i_eval.h"
4242
//#include "stm32f4xx_i2c.h"
4343

44-
/** @addtogroup Utilities
45-
* @{
46-
*/
47-
48-
/** @addtogroup STM32_EVAL
49-
* @{
50-
*/
51-
52-
/** @addtogroup STM324x7I_EVAL
53-
* @{
54-
*/
55-
56-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL
57-
* @brief This file provides firmware functions to manage Leds, push-buttons,
58-
* COM ports, SD card on SDIO and serial EEPROM (sEE) available on
59-
* STM324x7I-EVAL evaluation board from STMicroelectronics.
60-
* @{
61-
*/
62-
63-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_TypesDefinitions
64-
* @{
65-
*/
66-
/**
67-
* @}
68-
*/
69-
70-
71-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Defines
72-
* @{
73-
*/
74-
/**
75-
* @}
76-
*/
77-
78-
79-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Macros
80-
* @{
81-
*/
82-
/**
83-
* @}
84-
*/
85-
86-
87-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Variables
88-
* @{
89-
*/
90-
#if 0
91-
GPIO_TypeDef* GPIO_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT,
92-
LED4_GPIO_PORT};
93-
const uint16_t GPIO_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN,
94-
LED4_PIN};
95-
const uint32_t GPIO_CLK[LEDn] = {LED1_GPIO_CLK, LED2_GPIO_CLK, LED3_GPIO_CLK,
96-
LED4_GPIO_CLK};
97-
98-
GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT, TAMPER_BUTTON_GPIO_PORT,
99-
KEY_BUTTON_GPIO_PORT};
100-
101-
const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN, TAMPER_BUTTON_PIN,
102-
KEY_BUTTON_PIN};
103-
104-
const uint32_t BUTTON_CLK[BUTTONn] = {WAKEUP_BUTTON_GPIO_CLK, TAMPER_BUTTON_GPIO_CLK,
105-
KEY_BUTTON_GPIO_CLK};
106-
107-
const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {WAKEUP_BUTTON_EXTI_LINE,
108-
TAMPER_BUTTON_EXTI_LINE,
109-
KEY_BUTTON_EXTI_LINE};
110-
111-
const uint16_t BUTTON_PORT_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PORT_SOURCE,
112-
TAMPER_BUTTON_EXTI_PORT_SOURCE,
113-
KEY_BUTTON_EXTI_PORT_SOURCE};
114-
115-
const uint16_t BUTTON_PIN_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PIN_SOURCE,
116-
TAMPER_BUTTON_EXTI_PIN_SOURCE,
117-
KEY_BUTTON_EXTI_PIN_SOURCE};
118-
const uint16_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn, TAMPER_BUTTON_EXTI_IRQn,
119-
KEY_BUTTON_EXTI_IRQn};
120-
121-
GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT};
122-
123-
GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT};
124-
125-
const uint32_t COM_TX_PORT_CLK[COMn] = {EVAL_COM1_TX_GPIO_CLK};
126-
127-
const uint32_t COM_RX_PORT_CLK[COMn] = {EVAL_COM1_RX_GPIO_CLK};
128-
129-
const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN};
130-
131-
const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN};
132-
133-
const uint16_t COM_TX_PIN_SOURCE[COMn] = {EVAL_COM1_TX_SOURCE};
134-
135-
const uint16_t COM_RX_PIN_SOURCE[COMn] = {EVAL_COM1_RX_SOURCE};
136-
137-
const uint16_t COM_TX_AF[COMn] = {EVAL_COM1_TX_AF};
138-
139-
const uint16_t COM_RX_AF[COMn] = {EVAL_COM1_RX_AF};
140-
141-
DMA_InitTypeDef sEEDMA_InitStructure;
142-
NVIC_InitTypeDef NVIC_InitStructure;
143-
#endif
144-
145-
/**
146-
* @}
147-
*/
148-
149-
150-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_FunctionPrototypes
151-
* @{
152-
*/
153-
154-
/**
155-
* @}
156-
*/
157-
158-
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Functions
159-
* @{
160-
*/
161-
16244
/**
16345
* @brief DeInitializes the SDIO interface.
16446
* @param None
@@ -240,12 +122,21 @@ void SD_LowLevel_Init(void)
240122
GPIO_Init(GPIOC, &GPIO_InitStructure);
241123

242124
/*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */
243-
// dpgeorge: switch is normally open, connected to VDD when card inserted
125+
#if defined(PYBOARD)
126+
// dpgeorge: PYBv2-v3: switch is normally open, connected to VDD when card inserted
244127
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
245128
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // needs to be 2MHz due to restrictions on PC13
246129
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
247130
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
248131
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);
132+
#elif defined(PYBOARD4)
133+
// dpgeorge: PYBv4: switch is normally open, connected to GND when card inserted
134+
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
135+
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
136+
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
137+
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
138+
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);
139+
#endif
249140

250141
/* Enable the SDIO APB2 Clock */
251142
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, ENABLE);
@@ -337,26 +228,4 @@ void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize)
337228
DMA_Cmd(SD_SDIO_DMA_STREAM, ENABLE);
338229
}
339230

340-
341-
/**
342-
* @}
343-
*/
344-
345-
346-
/**
347-
* @}
348-
*/
349-
350-
/**
351-
* @}
352-
*/
353-
354-
/**
355-
* @}
356-
*/
357-
358-
/**
359-
* @}
360-
*/
361-
362231
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)