设备管理器找不到jlink驱动


需要安装的软件如下:

1. STM32CubeMX:通过官方渠道下载带makefile的HAL库工程。下载链接如下,需登录后方可下载。

书签:STM32CubeMX - STMicroelectronics

链接:[VS Code下载链接](code./)

书签:Visual Studio Code - Code Editing. Redefined

3. GNU Arm Embedded Toolchain:包含编译器(gcc)、调试器(gdb)、链接器(ld)等工具的arm用的GNU工具链。需配置环境变量。

链接:[GNU工具链下载链接](developer./tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)

书签:GNU Toolchain | GNU Arm Embedded Toolchain Downloads – Arm Developer

4. OpenOCD (windows版):一个开源的片上调试器,配置环境变量即可使用。

链接:前往[arm eabi](/arm-eabi/openocd/)下载OpenOCD。

书签:Download OpenOCD for Windows

5. Zadig:用于安装jlink的U驱动。虽然Jlink插上就能装驱动,但OpenOCD可能无法识别,需要此工具。

链接:[Zadig下载链接](zadig.akeo.ie/)

书签:Zadig - U driver installation made easy

接下来,需要将jlink接入电脑,并打开相关软件,选择OptionsList All Devices,选择J-link,然后在右侧选择WinU,点击Reinstall Driver。

还需要安装GIT用于版本管理。安装完成后,需要下载make文件并解压,将解压出来的文件复制到指定路径。

还需要关注Chinese (Simplified)、C/C++、C/C++ Snippets、ARM、Cortex-Debug等语言和工具的支持。

关于配置环境,需要创建一些必要的配置文件和文件夹,如tasks.json、openocd.cfg等。这些配置能够帮助VS Code了解外设寄存器的地址分布,展示寄存器内容到窗。需要下载STM32F103.svd文件并放在项目文件夹根目录。

```cpp

// Custom Logging Configuration

ifndef _LOG_H_

define _LOG_H_

include "SEGGER_RTT.h"

// Define log levels and their corresponding colors

define LOG_DEBUG 1

define LOG_PROTO(type, color, format, ...) \

SEGGER_RTT_printf(0, "%s%s" format "\r\n%s", color, type, __VA_ARGS__, RTT_CTRL_RESET) // Debugger output with formatting and color

define LOG_CLEAR() SEGGER_RTT_WriteString(0, RTT_CTRL_CLEAR) // Clear the log display

// Define log macros for different levels

define LOG(format, ...) LOG_PROTO("", "", format, __VA_ARGS__) // Standard log output

define LOGI(format, ...) LOG_PROTO("I: ", RTT_CTRL_TEXT_BRIGHT_GREEN, format, __VA_ARGS__) // Info level log output in green

define LOGW(format, ...) LOG_PROTO("W: ", RTT_CTRL_TEXT_BRIGHT_YELLOW, format, __VA_ARGS__) // Warning level log output in yellow

define LOGE(format, ...) LOG_PROTO("E: ", RTT_CTRL_TEXT_BRIGHT_RED, format, __VA_ARGS__) // Error level log output in red

// Include the log configuration only if debug is enabled

if LOG_DEBUG

// Define the log macros

else

// Disable the log macros

define LOG_CLEAR()

define LOG(...)

define LOGI(...)

define LOGW(...)

define LOGE(...)

endif // End of debug configuration

endif // !_LOG_H_

/ Private includes -/

/ USER CODE BEGIN Includes /

include "log.h" // Include the custom logging header file

/ USER CODE END Includes /

// Main loop code with logging examples

while (1) {

/ USER CODE END WHILE /

/ USER CODE BEGIN 3 /

cnt++; // Increment the counter variable 'cnt' (not shown in this snippet)

LOGE("this is an error !"); // Log an error message in red color

LOGI("this is an info with params ! CNT:%d", cnt); // Log an info message with counter value in green color (counter assumed defined above)

LOGW("this is a warning !"); // Log a warning message in yellow color (counter assumed defined above)

HAL_Delay(500); // Delay for half a second (implementation assumed to be provided by HAL library)

} // End of main loop code with logging examples block