Initialize JTAG hardware

- To debug with ST-Link
This commit is contained in:
2026-06-17 18:27:19 +02:00
parent 1d70a35f95
commit 9980dafb5c
3 changed files with 687 additions and 672 deletions
+85 -84
View File
@@ -1,84 +1,85 @@
/* USER CODE BEGIN Header */ /* USER CODE BEGIN Header */
/** /**
****************************************************************************** ******************************************************************************
* @file : main.h * @file : main.h
* @brief : Header for main.c file. * @brief : Header for main.c file.
* This file contains the common defines of the application. * This file contains the common defines of the application.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* Copyright (c) 2026 STMicroelectronics. * Copyright (c) 2026 STMicroelectronics.
* Copyright (c) 2026 Erick Ahmed. * Copyright (c) 2026 Erick Ahmed.
* *
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
****************************************************************************** ******************************************************************************
*/ */
/* USER CODE END Header */ /* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/ /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H #ifndef __MAIN_H
#define __MAIN_H #define __MAIN_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
/* Private includes ----------------------------------------------------------*/ /* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */ /* USER CODE BEGIN Includes */
#include <stdint.h> #include <stdint.h>
/* USER CODE END Includes */ #include "canlog.h"
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */ /* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */ /* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */ /* Exported macro ------------------------------------------------------------*/
#define DEBUG /* USER CODE BEGIN EM */
#ifdef DEBUG #define DEBUG
static inline void ITM_Print(const char *str) { #ifdef DEBUG
while (*str) { static inline void ITM_Print(const char *str) {
uint32_t timeout = 1000; while (*str) {
while ((ITM->PORT[0].u32 == 0) && (timeout-- > 0)); uint32_t timeout = 1000;
while ((ITM->PORT[0].u32 == 0) && (timeout-- > 0));
if (timeout > 0) {
ITM->PORT[0].u8 = (uint8_t)(*str); if (timeout > 0) {
} ITM->PORT[0].u8 = (uint8_t)(*str);
str++; }
} str++;
} }
#define DEBUG_PRINT(x) ITM_Print(x) }
#else #define DEBUG_PRINT(x) ITM_Print(x)
#define DEBUG_PRINT(x) #else
#endif #define DEBUG_PRINT(x)
/* USER CODE END EM */ #endif
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void); /* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN Private defines */
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
/* USER CODE END Private defines */
#ifdef __cplusplus
} #ifdef __cplusplus
#endif }
#endif
#endif /* __MAIN_H */
#endif /* __MAIN_H */
+562 -566
View File
File diff suppressed because it is too large Load Diff
+40 -22
View File
@@ -68,24 +68,30 @@ Mcu.IP8=USART1
Mcu.IPNb=9 Mcu.IPNb=9
Mcu.Name=STM32F405RGTx Mcu.Name=STM32F405RGTx
Mcu.Package=LQFP64 Mcu.Package=LQFP64
Mcu.Pin0=PB12 Mcu.Pin0=PA0-WKUP
Mcu.Pin1=PB13 Mcu.Pin1=PB12
Mcu.Pin10=PB3 Mcu.Pin10=PC10
Mcu.Pin11=PB4 Mcu.Pin11=PC11
Mcu.Pin12=PB5 Mcu.Pin12=PC12
Mcu.Pin13=PB8 Mcu.Pin13=PD2
Mcu.Pin14=PB9 Mcu.Pin14=PB3
Mcu.Pin15=VP_FREERTOS_VS_CMSIS_V2 Mcu.Pin15=PB4
Mcu.Pin16=VP_SYS_VS_tim6 Mcu.Pin16=PB5
Mcu.Pin2=PC8 Mcu.Pin17=PB6
Mcu.Pin3=PC9 Mcu.Pin18=PB7
Mcu.Pin4=PA9 Mcu.Pin19=PB8
Mcu.Pin5=PA10 Mcu.Pin2=PB13
Mcu.Pin6=PC10 Mcu.Pin20=PB9
Mcu.Pin7=PC11 Mcu.Pin21=VP_FREERTOS_VS_CMSIS_V2
Mcu.Pin8=PC12 Mcu.Pin22=VP_SYS_VS_tim6
Mcu.Pin9=PD2 Mcu.Pin3=PC8
Mcu.PinsNb=17 Mcu.Pin4=PC9
Mcu.Pin5=PA9
Mcu.Pin6=PA10
Mcu.Pin7=PA13
Mcu.Pin8=PA14
Mcu.Pin9=PA15
Mcu.PinsNb=23
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32F405RGTx Mcu.UserName=STM32F405RGTx
@@ -111,20 +117,32 @@ NVIC.TIM6_DAC_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
NVIC.TimeBase=TIM6_DAC_IRQn NVIC.TimeBase=TIM6_DAC_IRQn
NVIC.TimeBaseIP=TIM6 NVIC.TimeBaseIP=TIM6
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
PA0-WKUP.Mode=SYS_WakeUp0
PA0-WKUP.Signal=SYS_WKUP
PA10.Mode=Asynchronous PA10.Mode=Asynchronous
PA10.Signal=USART1_RX PA10.Signal=USART1_RX
PA13.Mode=JTAG_5_pins
PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=JTAG_5_pins
PA14.Signal=SYS_JTCK-SWCLK
PA15.Mode=JTAG_5_pins
PA15.Signal=SYS_JTDI
PA9.Mode=Asynchronous PA9.Mode=Asynchronous
PA9.Signal=USART1_TX PA9.Signal=USART1_TX
PB12.Mode=CAN_Activate PB12.Mode=CAN_Activate
PB12.Signal=CAN2_RX PB12.Signal=CAN2_RX
PB13.Mode=CAN_Activate PB13.Mode=CAN_Activate
PB13.Signal=CAN2_TX PB13.Signal=CAN2_TX
PB3.Locked=true PB3.Mode=JTAG_5_pins
PB3.Signal=GPIO_Output PB3.Signal=SYS_JTDO-SWO
PB4.Locked=true PB4.Mode=JTAG_5_pins
PB4.Signal=GPIO_Output PB4.Signal=SYS_JTRST
PB5.Locked=true PB5.Locked=true
PB5.Signal=GPIO_Output PB5.Signal=GPIO_Output
PB6.Locked=true
PB6.Signal=GPIO_Output
PB7.Locked=true
PB7.Signal=GPIO_Output
PB8.Mode=CAN_Activate PB8.Mode=CAN_Activate
PB8.Signal=CAN1_RX PB8.Signal=CAN1_RX
PB9.Locked=true PB9.Locked=true