From ea8bd605e3e3a23c55ed42b88b463b2bfde6f6c6 Mon Sep 17 00:00:00 2001 From: sgf201 Date: Thu, 9 Jul 2020 15:31:48 +0800 Subject: [PATCH 1/9] add CAN config and msp initial code --- .../CubeMX_Config/Inc/stm32f1xx_hal_conf.h | 2 +- .../CubeMX_Config/Src/stm32f1xx_hal_msp.c | 67 +++++++++++++++++++ .../stm32f103-atk-warshipv3/board/Kconfig | 13 +++- 3 files changed, 80 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 259acb159b..644a0c7ed3 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 ac85b3192f..f586b83845 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 @@ -213,6 +213,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 */ + } + +} + /* USER CODE BEGIN 1 */ diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig index aca91d47fc..ad78a28a77 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig @@ -175,7 +175,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 -- Gitee From b3f1bf13096c1fc17f3d88b0fb682e09f24ea5cb Mon Sep 17 00:00:00 2001 From: sgf201 Date: Thu, 9 Jul 2020 15:46:45 +0800 Subject: [PATCH 2/9] repalce tab with space in Kconfig file --- bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig index ad78a28a77..c424c79d0a 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig @@ -180,12 +180,12 @@ menu "On-chip Peripheral Drivers" 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 + 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" -- Gitee From 8e08b589641274bc5a595bd3a691793d757807d0 Mon Sep 17 00:00:00 2001 From: iysheng Date: Thu, 16 Jul 2020 22:25:09 +0800 Subject: [PATCH 3/9] [fix] Couldn't compile *.s src files --- tools/rtthread.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) -- Gitee From aa43f7b2870ad1a0bc2c1681e41824592dc89ddc Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 21:40:25 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index 9cdfa30722..42fe247f0c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -176,3 +176,4 @@ RT-Thread微信公众号: 如果您对RT-Thread感兴趣,并希望参与RT-Thread的开发并成为代码贡献者,请参阅[代码贡献指南](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md)。 +# 测试 -- Gitee From a229c2295507e9866ef96b0e4ea72a58b6888ca2 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 21:47:39 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=B5=8B=E8=AF=952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index 42fe247f0c..3753e46a2d 100644 --- a/README_zh.md +++ b/README_zh.md @@ -177,3 +177,4 @@ RT-Thread微信公众号: 如果您对RT-Thread感兴趣,并希望参与RT-Thread的开发并成为代码贡献者,请参阅[代码贡献指南](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md)。 # 测试 +# 测试2 -- Gitee From c6e5602fa5d69d9d2b24cd07c6026755edf81fc1 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 22:20:01 +0800 Subject: [PATCH 6/9] test3 --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index 3753e46a2d..a8a47e11a6 100644 --- a/README_zh.md +++ b/README_zh.md @@ -178,3 +178,4 @@ RT-Thread微信公众号: # 测试 # 测试2 +# 测试3 -- Gitee From 5d853655b28553cbd22c2b33ce3209186906527c Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 22:28:43 +0800 Subject: [PATCH 7/9] =?UTF-8?q?#=20=E6=B5=8B=E8=AF=954?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index a8a47e11a6..5b8062fb26 100644 --- a/README_zh.md +++ b/README_zh.md @@ -179,3 +179,4 @@ RT-Thread微信公众号: # 测试 # 测试2 # 测试3 +# 测试4 -- Gitee From 55084f8f4006de206ea37b1b1d4730ab3df7369e Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 22:58:16 +0800 Subject: [PATCH 8/9] =?UTF-8?q?#=20=E6=B5=8B=E8=AF=955?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index 5b8062fb26..fe52193c73 100644 --- a/README_zh.md +++ b/README_zh.md @@ -180,3 +180,4 @@ RT-Thread微信公众号: # 测试2 # 测试3 # 测试4 +# 测试5 -- Gitee From 0dec6a07253c88c9821d5b4801cd960e496df488 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 24 Sep 2020 23:07:30 +0800 Subject: [PATCH 9/9] =?UTF-8?q?#=20=E6=B5=8B=E8=AF=956?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_zh.md b/README_zh.md index fe52193c73..c1f3ac2b06 100644 --- a/README_zh.md +++ b/README_zh.md @@ -181,3 +181,4 @@ RT-Thread微信公众号: # 测试3 # 测试4 # 测试5 +# 测试6 -- Gitee