summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h2
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c67
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig13
-rw-r--r--components/drivers/audio/audio.c2
-rw-r--r--tools/rtthread.mk17
5 files changed, 99 insertions, 2 deletions
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h b/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h
index b4720e93f0..54c18d5f3a 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h
+++ b/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h
@@ -35,7 +35,7 @@
#define HAL_MODULE_ENABLED
/*#define HAL_ADC_MODULE_ENABLED */
/*#define HAL_CRYP_MODULE_ENABLED */
-/*#define HAL_CAN_MODULE_ENABLED */
+#define HAL_CAN_MODULE_ENABLED
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */
/*#define HAL_CEC_MODULE_ENABLED */
/*#define HAL_CORTEX_MODULE_ENABLED */
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c b/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
index 26c9270e6b..5a7f5eedf6 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
+++ b/bsp/stm32/stm32f103-atk-warshipv3/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
@@ -294,6 +294,73 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
}
}
+/**
+* @brief CAN MSP Initialization
+* This function configures the hardware resources used in this example
+* @param hcan: CAN handle pointer
+* @retval None
+*/
+void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
+{
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ if(hcan->Instance==CAN1)
+ {
+ /* USER CODE BEGIN CAN1_MspInit 0 */
+
+ /* USER CODE END CAN1_MspInit 0 */
+ /* Peripheral clock enable */
+ __HAL_RCC_CAN1_CLK_ENABLE();
+
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ /**CAN GPIO Configuration
+ PA11 ------> CAN_RX
+ PA12 ------> CAN_TX
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_11;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = GPIO_PIN_12;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN CAN1_MspInit 1 */
+
+ /* USER CODE END CAN1_MspInit 1 */
+ }
+
+}
+/**
+* @brief CAN MSP De-Initialization
+* This function freeze the hardware resources used in this example
+* @param hcan: CAN handle pointer
+* @retval None
+*/
+void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
+{
+ if(hcan->Instance==CAN1)
+ {
+ /* USER CODE BEGIN CAN1_MspDeInit 0 */
+
+ /* USER CODE END CAN1_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_CAN1_CLK_DISABLE();
+
+ /**CAN GPIO Configuration
+ PA11 ------> CAN_RX
+ PA12 ------> CAN_TX
+ */
+ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
+
+ /* USER CODE BEGIN CAN1_MspDeInit 1 */
+
+ /* USER CODE END CAN1_MspDeInit 1 */
+ }
+
+}
+
static uint32_t FSMC_Initialized = 0;
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
index 80ef1ab3a6..d55f0f721b 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
+++ b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
@@ -188,7 +188,18 @@ menu "On-chip Peripheral Drivers"
bool "Enable ADC1"
default n
endif
-
+ menuconfig BSP_USING_CAN
+ bool "Enable CAN"
+ default n
+ select RT_USING_CAN
+ if BSP_USING_CAN
+ config BSP_USING_CAN1
+ bool "Enable CAN1"
+ default n
+ config BSP_USING_CAN2
+ bool "Enable CAN2"
+ default n
+ endif
config BSP_USING_ON_CHIP_FLASH
bool "Enable on-chip FLASH"
default n
diff --git a/components/drivers/audio/audio.c b/components/drivers/audio/audio.c
index 4cec8a4a9c..846dad07cf 100644
--- a/components/drivers/audio/audio.c
+++ b/components/drivers/audio/audio.c
@@ -19,7 +19,9 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
+#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
enum
{
diff --git a/tools/rtthread.mk b/tools/rtthread.mk
index fdc96d4156..7cf018cb52 100644
--- a/tools/rtthread.mk
+++ b/tools/rtthread.mk
@@ -55,6 +55,20 @@ $(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
endef
+define add_s_file
+$(eval S_SRC := $(1:$(BSP_ROOT)/%=%)) \
+$(eval S_SRC := $(S_SRC:$(RTT_ROOT)/%=%)) \
+$(eval SOBJ := $(1:%.s=%.o)) \
+$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
+$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
+$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
+$(eval OBJS += $(LOCALS)) \
+$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
+ @if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
+ @echo cc $$<
+ @$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
+endef
+
add_flg = $(eval CFLAGS += $1) \
$(eval AFLAGS += $1) \
$(eval CXXFLAGS += $1)
@@ -89,6 +103,9 @@ $(if $(SRCS),$(foreach f,$(SRCS),$(call add_cxx_file,$(f))))
SRCS := $(strip $(filter %.S,$(SRC_FILES)))
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_S_file,$(f))))
+SRCS := $(strip $(filter %.s,$(SRC_FILES)))
+$(if $(SRCS),$(foreach f,$(SRCS),$(call add_s_file,$(f))))
+
CFLAGS += $(CPPPATHS)
CXXFLAGS += $(CPPPATHS)
AFLAGS += $(CPPPATHS)