]> Zhao Yanbai Git Server - acecode.git/commitdiff
F103HAL-支持Serial Wire调式
authorAceVest <zhaoyanbai@126.com>
Sat, 1 Jun 2019 06:21:56 +0000 (14:21 +0800)
committerAceVest <zhaoyanbai@126.com>
Sat, 1 Jun 2019 06:21:56 +0000 (14:21 +0800)
learn/stm32/F103HAL/.mxproject
learn/stm32/F103HAL/F103HAL.ioc
learn/stm32/F103HAL/Inc/gpio.h [new file with mode: 0644]
learn/stm32/F103HAL/Inc/stm32f1xx_hal_conf.h
learn/stm32/F103HAL/STM32F103C8TX_FLASH.ld
learn/stm32/F103HAL/Src/gpio.c [new file with mode: 0644]
learn/stm32/F103HAL/Src/main.c
learn/stm32/F103HAL/Src/stm32f1xx_hal_msp.c

index 9361152c3d5a99b6098b132b1fe75757b1fff736..0c15174f96ed41c293612d396013001fbedaa8e7 100644 (file)
@@ -1,14 +1,14 @@
 [PreviousGenFiles]\r
 HeaderPath=/Users/ace/workspace/acecode/learn/stm32/F103HAL/Inc\r
-HeaderFiles=stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;\r
+HeaderFiles=stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;gpio.h;\r
 SourcePath=/Users/ace/workspace/acecode/learn/stm32/F103HAL/Src\r
-SourceFiles=stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c;\r
+SourceFiles=stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c;gpio.c;\r
 \r
 [PreviousLibFiles]\r
 LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cmSimd.h;\r
 \r
 [PreviousUsedCubeIDEFiles]\r
-SourceFiles=Src/main.c;Src/stm32f1xx_it.c;Src/stm32f1xx_hal_msp.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;null;\r
+SourceFiles=Src/main.c;Src/gpio.c;Src/stm32f1xx_it.c;Src/stm32f1xx_hal_msp.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;null;\r
 HeaderPath=Drivers/STM32F1xx_HAL_Driver/Inc;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;Drivers/CMSIS/Device/ST/STM32F1xx/Include;Drivers/CMSIS/Include;Inc;\r
 CDefines=USE_HAL_DRIVER;STM32F103xB;\r
 \r
index 8839091d15f681360c6556d308022f36d42c46b2..85d924b6a1c29684d00ee5e36d167b0d7773d20d 100644 (file)
@@ -8,9 +8,10 @@ Mcu.IP2=SYS
 Mcu.IPNb=3
 Mcu.Name=STM32F103C(8-B)Tx
 Mcu.Package=LQFP48
-Mcu.Pin0=VP_SYS_VS_ND
-Mcu.Pin1=VP_SYS_VS_Systick
-Mcu.PinsNb=2
+Mcu.Pin0=PA13
+Mcu.Pin1=PA14
+Mcu.Pin2=VP_SYS_VS_Systick
+Mcu.PinsNb=3
 Mcu.ThirdPartyNb=0
 Mcu.UserConstants=
 Mcu.UserName=STM32F103C8Tx
@@ -26,6 +27,10 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
 NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
 NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
+PA13.Mode=Serial_Wire
+PA13.Signal=SYS_JTMS-SWDIO
+PA14.Mode=Serial_Wire
+PA14.Signal=SYS_JTCK-SWCLK
 PCC.Checker=false
 PCC.Line=STM32F103
 PCC.MCU=STM32F103C(8-B)Tx
@@ -39,7 +44,7 @@ ProjectManager.AskForMigrate=true
 ProjectManager.BackupPrevious=false
 ProjectManager.CompilerOptimize=6
 ProjectManager.ComputerToolchain=false
-ProjectManager.CoupleFile=false
+ProjectManager.CoupleFile=true
 ProjectManager.CustomerFirmwarePackage=
 ProjectManager.DefaultFWLocation=true
 ProjectManager.DeletePrevious=true
@@ -61,7 +66,7 @@ ProjectManager.StackSize=0x400
 ProjectManager.TargetToolchain=STM32CubeIDE
 ProjectManager.ToolChainLocation=
 ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false
 RCC.APB1Freq_Value=8000000
 RCC.APB2Freq_Value=8000000
 RCC.FamilyName=M
@@ -69,8 +74,6 @@ RCC.IPParameters=APB1Freq_Value,APB2Freq_Value,FamilyName,PLLCLKFreq_Value,PLLMC
 RCC.PLLCLKFreq_Value=8000000
 RCC.PLLMCOFreq_Value=4000000
 RCC.TimSysFreq_Value=8000000
-VP_SYS_VS_ND.Mode=No_Debug
-VP_SYS_VS_ND.Signal=SYS_VS_ND
 VP_SYS_VS_Systick.Mode=SysTick
 VP_SYS_VS_Systick.Signal=SYS_VS_Systick
 board=custom
diff --git a/learn/stm32/F103HAL/Inc/gpio.h b/learn/stm32/F103HAL/Inc/gpio.h
new file mode 100644 (file)
index 0000000..1e2e3a2
--- /dev/null
@@ -0,0 +1,57 @@
+/**\r
+  ******************************************************************************\r
+  * File Name          : gpio.h\r
+  * Description        : This file contains all the functions prototypes for \r
+  *                      the gpio  \r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.\r
+  * All rights reserved.</center></h2>\r
+  *\r
+  * This software component is licensed by ST under BSD 3-Clause license,\r
+  * the "License"; You may not use this file except in compliance with the\r
+  * License. You may obtain a copy of the License at:\r
+  *                        opensource.org/licenses/BSD-3-Clause\r
+  *\r
+  ******************************************************************************\r
+  */\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __gpio_H\r
+#define __gpio_H\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "main.h"\r
+\r
+/* USER CODE BEGIN Includes */\r
+\r
+/* USER CODE END Includes */\r
+\r
+/* USER CODE BEGIN Private defines */\r
+\r
+/* USER CODE END Private defines */\r
+\r
+void MX_GPIO_Init(void);\r
+\r
+/* USER CODE BEGIN Prototypes */\r
+\r
+/* USER CODE END Prototypes */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /*__ pinoutConfig_H */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
index 5dfaa8f102f9b37b5fba5c5feb15e5174e7cef7e..d96c45b7c397530b4dfa1a4ee8f6d6f21a2a7506 100644 (file)
@@ -59,7 +59,7 @@
 /*#define HAL_DMA_MODULE_ENABLED   */\r
 /*#define HAL_ETH_MODULE_ENABLED   */\r
 /*#define HAL_FLASH_MODULE_ENABLED   */\r
-/*#define HAL_GPIO_MODULE_ENABLED   */\r
+#define HAL_GPIO_MODULE_ENABLED\r
 /*#define HAL_I2C_MODULE_ENABLED   */\r
 /*#define HAL_I2S_MODULE_ENABLED   */\r
 /*#define HAL_IRDA_MODULE_ENABLED   */\r
index c7338cb6c06751eb13ba06f4c91e68504eb94e2d..31506ff12df3068c8790ff5620219f264bfe91f7 100644 (file)
@@ -55,8 +55,8 @@ ENTRY(Reset_Handler)
 /* Highest address of the user mode stack */
 _estack = 0x20004fff;  /* end of "RAM" Ram type memory */
 
-_Min_Heap_Size = 0x200       /* required amount of heap  */
-_Min_Stack_Size = 0x400      /* required amount of stack */
+_Min_Heap_Size = 0x200 ;       /* required amount of heap  */
+_Min_Stack_Size = 0x400 ;      /* required amount of stack */
 
 /* Memories definition */
 MEMORY
diff --git a/learn/stm32/F103HAL/Src/gpio.c b/learn/stm32/F103HAL/Src/gpio.c
new file mode 100644 (file)
index 0000000..aee7ed1
--- /dev/null
@@ -0,0 +1,52 @@
+/**\r
+  ******************************************************************************\r
+  * File Name          : gpio.c\r
+  * Description        : This file provides code for the configuration\r
+  *                      of all used GPIO pins.\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.\r
+  * All rights reserved.</center></h2>\r
+  *\r
+  * This software component is licensed by ST under BSD 3-Clause license,\r
+  * the "License"; You may not use this file except in compliance with the\r
+  * License. You may obtain a copy of the License at:\r
+  *                        opensource.org/licenses/BSD-3-Clause\r
+  *\r
+  ******************************************************************************\r
+  */\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "gpio.h"\r
+/* USER CODE BEGIN 0 */\r
+\r
+/* USER CODE END 0 */\r
+\r
+/*----------------------------------------------------------------------------*/\r
+/* Configure GPIO                                                             */\r
+/*----------------------------------------------------------------------------*/\r
+/* USER CODE BEGIN 1 */\r
+\r
+/* USER CODE END 1 */\r
+\r
+/** Configure pins as \r
+        * Analog \r
+        * Input \r
+        * Output\r
+        * EVENT_OUT\r
+        * EXTI\r
+*/\r
+void MX_GPIO_Init(void)\r
+{\r
+\r
+  /* GPIO Ports Clock Enable */\r
+  __HAL_RCC_GPIOA_CLK_ENABLE();\r
+\r
+}\r
+\r
+/* USER CODE BEGIN 2 */\r
+\r
+/* USER CODE END 2 */\r
+\r
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
index c351884e023d136cc565fe8519ad0ae1833c4d97..d211515350118d1888ed347265266158b2a23687 100644 (file)
@@ -20,6 +20,7 @@
 \r
 /* Includes ------------------------------------------------------------------*/\r
 #include "main.h"\r
+#include "gpio.h"\r
 \r
 /* Private includes ----------------------------------------------------------*/\r
 /* USER CODE BEGIN Includes */\r
@@ -86,6 +87,7 @@ int main(void)
   /* USER CODE END SysInit */\r
 \r
   /* Initialize all configured peripherals */\r
+  MX_GPIO_Init();\r
   /* USER CODE BEGIN 2 */\r
 \r
   /* USER CODE END 2 */\r
index d3741bc8db157bc78ac4475c65b09c42df1809ed..f15a06a37790a5fe15c7cd5692ec138ba84dbba0 100644 (file)
@@ -72,9 +72,9 @@ void HAL_MspInit(void)
 \r
   /* System interrupt init*/\r
 \r
-  /** DISABLE: JTAG-DP Disabled and SW-DP Disabled \r
+  /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled \r
   */\r
-  __HAL_AFIO_REMAP_SWJ_DISABLE();\r
+  __HAL_AFIO_REMAP_SWJ_NOJTAG();\r
 \r
   /* USER CODE BEGIN MspInit 1 */\r
 \r