当前位置: 首页 > article >正文

Ubuntu2404 下搭建 Zephyr 开发环境

1. 系统要求

  • 操作系统:Ubuntu2404(64位)
  • 磁盘空间:至少 8GB 可用空间(Zephyr 及其工具链较大)

2. 安装必要工具

Tool

Min. Version

CMake

3.20.5

Python

3.10

Devicetree compiler

1.4.6

 2.1 安装系统依赖

# 更新软件源并安装基础工具
sudo apt update && sudo apt upgrade -y
sudo apt install -y --no-install-recommends git cmake ninja-build gperf \ccache dfu-util device-tree-compiler wget \python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1

2.2 验证主要依赖项版本

cmake --version
python3 --version
dtc --versioncmake version 3.22.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Python 3.10.12
Version: DTC 1.6.1

2.3 获取Zephyr和安装Python依赖项

2.3.1 安装Python venv安装包

sudo apt install -y python3-venv

2.3.2 创建Python 虚拟环境

# 创建虚拟环境
python3 -m venv ~/workspace/zephyr-venv

2.3.3 激活虚拟环境

source ~/workspace/zephyr-venv/bin/activate

2.3.4 安装west

# 使用国内镜像源速度快
pip install west -i https://pypi.mirrors.ustc.edu.cn/simple/

2.3.5 获取 Zephyr 源码

# 初始化 Zephyr 项目
west init ~/workspace/zephyr-project
cd ~/workspace/zephyr-project
west update

# west update主要下载submodules github源码(zephyr-venv) Weston@PC:~/workspace/zephyr-project$ west update
=== updating acpica (modules/lib/acpica):
HEAD is now at 8d24867bc Merge pull request #5 from dcpleung/kernel/mm_z_phys_map_unmap_rename
=== updating cmsis (modules/hal/cmsis):
HEAD is now at d1b8b20 Backport CMSIS_6#102 to CMSIS 5.9.0
=== updating cmsis-dsp (modules/lib/cmsis-dsp):
HEAD is now at d80a49b2 do not generate warnings when scalar functions are used with MVE
=== updating cmsis-nn (modules/lib/cmsis-nn):
HEAD is now at e9328d6 manifest: zephyr module file
=== updating cmsis_6 (modules/lib/cmsis_6):
HEAD is now at 783317a3 TZ applications can be secure-only (#204)
=== updating edtt (tools/edtt):
HEAD is now at b9ca3c7 Fix for for python >= 3.11
=== updating fatfs (modules/fs/fatfs):
HEAD is now at 16245c7 fs: Update driver to version 0.15a
=== updating hal_adi (modules/hal/adi):
HEAD is now at 8f33130 fix(Other): Add 'static inline' keywords to Zephyr Timer Wrapper functions (#1379)
=== updating hal_altera (modules/hal/altera):
HEAD is now at 4fe4df9 uart: do not build hal uart driver
=== updating hal_ambiq (modules/hal/ambiq):
HEAD is now at 9da9656 add back missing files for apollo3 and apollo4
=== updating hal_atmel (modules/hal/atmel):
HEAD is now at ca7e4c6 sam3x: spi: missing adc macro
=== updating hal_bouffalolab (modules/hal/bouffalolab):
HEAD is now at c6c44b8 pinctrl: pinconfig: Add autogen
=== updating hal_espressif (modules/hal/espressif):
HEAD is now at e794f935ff zephyr: port: Heap adapter
=== updating hal_ethos_u (modules/hal/ethos_u):
HEAD is now at 50ddffc Cache optimizations
=== updating hal_gigadevice (modules/hal/gigadevice):
HEAD is now at 2994b7d README.md: add pllmf and pack exception for gd32a50x
=== updating hal_infineon (modules/hal/infineon):
HEAD is now at d7b8432 Update CYW20829 BLE FW blobs
=== updating hal_intel (modules/hal/intel):
HEAD is now at 0447cd2 Update pm_regs.h
=== updating hal_microchip (modules/hal/microchip):
HEAD is now at 15ca197 hal: microchip: mec5: Fix bugs in EC subsystem debug enable
=== updating hal_nordic (modules/hal/nordic):
HEAD is now at a5a2277 nrfx: drivers: rramc: Declare functions as unused
=== updating hal_nuvoton (modules/hal/nuvoton):
HEAD is now at be1042d hal:nuvoton:m55m1: support emac
=== updating hal_nxp (modules/hal/nxp):
HEAD is now at 5e5a498e mcux: wifi: nxp: support override TX power limit file
=== updating hal_openisa (modules/hal/openisa):
HEAD is now at eabd530 fix-double-promotion in fsl_xcvr_trim
=== updating hal_quicklogic (modules/hal/quicklogic):
HEAD is now at bad8944 HAL: eoss3_dev: add missing `__cplusplus` handling
=== updating hal_renesas (modules/hal/renesas):
HEAD is now at 9d68ee7 portable: rp_crc: add runtime reconfigure for CRC
=== updating hal_rpi_pico (modules/hal/rpi_pico):
HEAD is now at 7b57b24 Merge pull request #8 from ajf58/merge-2.1.0
=== updating hal_silabs (modules/hal/silabs):
HEAD is now at 40a0237 wiseconnect: Use static allocation for threads
=== updating hal_st (modules/hal/st):
HEAD is now at 9f81b44 sensor/stmemsc: Align stmemsc i/f to v2.9.1
=== updating hal_stm32 (modules/hal/stm32):
HEAD is now at 6e4716f8 dts: st: update pinctrls related to dcmipp pins
=== updating hal_tdk (modules/hal/tdk):
HEAD is now at 6727477 Merge pull request #8 from tdk-invn-oss/main
=== updating hal_telink (modules/hal/telink):
HEAD is now at 4226c7f drivers: Disable BLE support
=== updating hal_ti (modules/hal/ti):
HEAD is now at 258652a simplelink_lpf3: Add README.md
=== updating hal_wch (modules/hal/wch):
HEAD is now at 1de9d3e Add hal_wch based on the 'ch32v003fun' project
=== updating hal_wurthelektronik (modules/hal/wurthelektronik):
HEAD is now at e3e2797 Remove preprocessor warnings for not enabling float
=== updating hal_xtensa (modules/hal/xtensa):
HEAD is now at b38620c zephyr: Add SoC overlay for i.MXRT700 HiFi1 DSP
=== updating hostap (modules/lib/hostap):
HEAD is now at 8412f4b23 [noup] zephyr: remove zephyr wpas monitor socket pair
=== updating liblc3 (modules/lib/liblc3):
HEAD is now at 48bbd3e Rename lc3 python package to lc3py, and bump version to 1.1.2
=== updating libmctp (modules/lib/libmctp):
HEAD is now at b97860e build MCTP zephyr library only when CONFIG_MCTP is enabled
=== updating libmetal (modules/hal/libmetal):
HEAD is now at 14f5195 lib: update libmetal to SHA 9a21915a5f8f
=== updating littlefs (modules/fs/littlefs):
HEAD is now at ed0531d Merge pull request #15 from Jappie3/zephyr
=== updating loramac-node (modules/lib/loramac-node):
HEAD is now at fb00b383 zephyr: configure FragDecoder using Kconfig
=== updating lvgl (modules/lib/gui/lvgl):
HEAD is now at 1ed1ddd88 docs(Alif): add docs for Alif chip vendor (#7622)
=== updating mbedtls (modules/crypto/mbedtls):
HEAD is now at 5f8899343 Merge pull request #70 from tomi-font/bump_to_3.6.3
=== updating mcuboot (bootloader/mcuboot):
HEAD is now at 81315483 Revert "zephyr: arm: Update reading the flash image reset vector"
=== updating mipi-sys-t (modules/debug/mipi-sys-t):
HEAD is now at 33e5c23 Fix for warning of potential error using = instead of ==
=== updating net-tools (tools/net-tools):
HEAD is now at 986bfeb Replace native_posix with native_sim
=== updating nrf_hw_models (modules/bsim_hw_models/nrf_hw_models):
HEAD is now at d5b95fd grtc hal replacement: Fix bug in nrf_grtc_int_group_enable/disable()
=== updating nrf_wifi (modules/lib/nrf_wifi):
HEAD is now at d89b42a Remove recovery code for radio test
=== updating open-amp (modules/lib/open-amp):
HEAD is now at f7f4d08 lib: update open-amp lib  to SHA 9a21915a5f8f
=== updating openthread (modules/lib/openthread):
HEAD is now at 3ae741f95 [instance] fix index computation in multi-instances context (#11099)
=== updating percepio (modules/debug/percepio):
HEAD is now at 49e6dc2 Merge branch 'main' into zephyr
=== updating picolibc (modules/lib/picolibc):
HEAD is now at 82d62ed1a zephyr: Disable LTO when building the library
=== updating segger (modules/debug/segger):
HEAD is now at cf56b1d readme: Add readme
=== updating tinycrypt (modules/crypto/tinycrypt):
HEAD is now at 1012a3e Fix warnings reported by UBSAN
=== updating trusted-firmware-a (modules/tee/tf-a/trusted-firmware-a):
HEAD is now at 713ffbf96 Merge pull request #4 from ceolin/v2.10.4
=== updating trusted-firmware-m (modules/tee/tf-m/trusted-firmware-m):
HEAD is now at e2288c13e Merge pull request #130 from tomi-font/bump_to_2.1.2
=== updating uoscore-uedhoc (modules/lib/uoscore-uedhoc):
HEAD is now at 54abc10 Merge pull request #5 from rlubos/upmerge-02-2025
=== updating zcbor (modules/lib/zcbor):
HEAD is now at 9b07780 Update version to 0.9.1

2.3.6 导入 Zephyr 环境变量

west zephyr-export

2.3.7  安装west python依赖包

# 使用国外镜像源比较慢
west packages pip --install

注意:永久切换pip使用国内镜像源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cnpip config list# 恢复默认配置pip config unset global.index-url
pip config unset global.trusted-host

常见镜像源地址

镜像名称

URL

清华大学

https://pypi.tuna.tsinghua.edu.cn/simple

阿里云

https://mirrors.aliyun.com/pypi/simple

腾讯云

https://mirrors.cloud.tencent.com/pypi/simple

华为云

https://repo.huaweicloud.com/repository/pypi/simple

3. 安装 Zephyr SDK

# 导出环境变量
echo "export ZEPHYR_BASE=~/workspace/zephyr-project/zephyr" >> ~/.bashrc
source ~/.bashrc# 下载并安装 SDK
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64.tar.xz
# 解压并安装
tar xvf zephyr-sdk-0.17.0_linux-x86_64.tar.xz
cd zephyr-sdk-0.17.0
./setup.shZephyr SDK 0.17.0 Setup** NOTE **
You only need to run this script once after extracting the Zephyr SDK
distribution bundle archive.Install host tools [y/n]? y
Register Zephyr SDK CMake package [y/n]? yInstalling host tools ...Registering Zephyr SDK CMake package ...
Zephyr-sdk (/home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0/cmake)
has been added to the user package registry in:
~/.cmake/packages/Zephyr-sdkAll done.
Press any key to exit ...
设置环境变量
echo "export ZEPHYR_TOOLCHAIN_VARIANT=zephyr" >> ~/.bashrc
echo "export ZEPHYR_SDK_INSTALL_DIR=$HOME/workspace/zephyr-sdk/zephyr-sdk-0.17.0" >> ~/.bashrc
source ~/.bashrc

4. 验证安装

(1) 检查环境

west --version
cmake --version
ninja --version
python --version# 所有命令应正常输出版本号
West version: v1.3.0
cmake version 3.22.1
1.10.2.git.kitware.jobserver-1
Python 3.10.12

(2) 编译示例项目

cd ~/workspace/zephyr-project/zephyr
west build -b blackpill_f401cc samples/hello_world(zephyr-venv) polaris@PC:~/workspace/zephyr-project/zephyr$ west build -b blackpill_f401cc samples/hello_world
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/polaris/workspace/zephyr-project/zephyr/samples/hello_world
-- CMake version: 3.22.1
-- Found Python3: /home/polaris/workspace/zephyr-venv/bin/python3 (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter 
-- Cache files will be written to: /home/polaris/.cache/zephyr
-- Zephyr version: 4.1.99 (/home/polaris/workspace/zephyr-project/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: blackpill_f401cc, qualifiers: stm32f401xc
-- Found host-tools: zephyr 0.17.0 (/home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0)
-- Found Dtc: /home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/polaris/workspace/zephyr-project/zephyr/boards/weact/blackpill_f401cc/blackpill_f401cc.dts
-- Generated zephyr.dts: /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/dts.cmake
Parsing /home/polaris/workspace/zephyr-project/zephyr/Kconfig
Loaded configuration '/home/polaris/workspace/zephyr-project/zephyr/boards/weact/blackpill_f401cc/blackpill_f401cc_defconfig'
Merged configuration '/home/polaris/workspace/zephyr-project/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/home/polaris/workspace/zephyr-project/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/polaris/workspace/zephyr-project/zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/polaris/workspace/zephyr-sdk/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Using ccache: /usr/bin/ccache
-- Found gen_kobject_list: /home/polaris/workspace/zephyr-project/zephyr/scripts/build/gen_kobject_list.py
-- Configuring done
-- Generating done
-- Build files have been written to: /home/polaris/workspace/zephyr-project/zephyr/build
-- west build: building application
[1/140] Preparing syscall dependency handling[3/140] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.1.99 (/home/polaris/workspace/zephyr-project/zephyr), build: v4.1.0-3774-gc35bb0de8023
[140/140] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age UsedFLASH:       15996 B       256 KB      6.10%RAM:        4544 B        64 KB      6.93%IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/zephyr.elf for board: blackpill_f401cc
  • -b blackpill_f401cc:指定 Black Pill STM32F401CC 开发板
  • 首次编译会下载工具链和依赖,耗时较长。

(3) 烧录与调试

west flash --runner blackmagicprobe
west debug --runner blackmagicprobe
west attach --runner blackmagicprobe# 使用blackmagicprobe烧录固件
west flash --runner blackmagicprobe
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner blackmagicprobe
-- runners.blackmagicprobe: using GDB serial: /dev/ttyACM0
Remote debugging using /dev/ttyACM0
Target voltage: 2.45V
Available Targets:
No. Att Driver1      STM32F411 M4
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x08001ac8 in ?? ()
Loading section rom_start, size 0x194 lma 0x8000000
Loading section text, size 0x3448 lma 0x8000194
Loading section .ARM.exidx, size 0x8 lma 0x80035dc
Loading section initlevel, size 0x80 lma 0x80035e4
Loading section device_area, size 0x180 lma 0x8003664
Loading section sw_isr_table, size 0x2a8 lma 0x80037e4
Loading section gpio_driver_api_area, size 0x24 lma 0x8003a8c
Loading section reset_driver_api_area, size 0x10 lma 0x8003ab0
Loading section clock_control_driver_api_area, size 0x1c lma 0x8003ac0
Loading section uart_driver_api_area, size 0x4c lma 0x8003adc
Loading section rodata, size 0x2ec lma 0x8003b28
Loading section datas, size 0x4c lma 0x8003e14
Loading section device_states, size 0x18 lma 0x8003e60
Loading section .last_section, size 0x4 lma 0x8003e78
Start address 0x0800087c, load size 15996
Transfer rate: 29 KB/sec, 592 bytes/write.
[Inferior 1 (Remote target) killed]# 使用blackmagicprobe在线调试固件
west debug --runner blackmagicprobe
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner blackmagicprobe
-- runners.blackmagicprobe: using GDB serial: /dev/ttyACM0
GNU gdb (Zephyr SDK 0.17.0) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".
Type "apropos word" to search for commands related to "word".
Remote debugging using /dev/ttyACM0
Target voltage: 2.48V
Available Targets:
No. Att Driver1      STM32F411 M4
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x08002b48 in ?? ()
Reading symbols from /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/zephyr.elf...
Loading section rom_start, size 0x194 lma 0x8000000
Loading section text, size 0x3448 lma 0x8000194
Loading section .ARM.exidx, size 0x8 lma 0x80035dc
Loading section initlevel, size 0x80 lma 0x80035e4
Loading section device_area, size 0x180 lma 0x8003664
Loading section sw_isr_table, size 0x2a8 lma 0x80037e4
Loading section gpio_driver_api_area, size 0x24 lma 0x8003a8c
Loading section reset_driver_api_area, size 0x10 lma 0x8003ab0
Loading section clock_control_driver_api_area, size 0x1c lma 0x8003ac0
Loading section uart_driver_api_area, size 0x4c lma 0x8003adc
Loading section rodata, size 0x2ec lma 0x8003b28
Loading section datas, size 0x4c lma 0x8003e14
Loading section device_states, size 0x18 lma 0x8003e60
Loading section .last_section, size 0x4 lma 0x8003e78
Start address 0x0800087c, load size 15996
Transfer rate: 30 KB/sec, 592 bytes/write.
(gdb) # 使用blackmagicprobe接入调试
west attach --runner blackmagicprobe
-- west attach: rebuilding
ninja: no work to do.
-- west attach: using runner blackmagicprobe
-- runners.blackmagicprobe: using GDB serial: /dev/ttyACM0
GNU gdb (Zephyr SDK 0.17.0) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".
Type "apropos word" to search for commands related to "word".
Remote debugging using /dev/ttyACM0
Target voltage: 2.39V
Available Targets:
No. Att Driver1      STM32F411 M4
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x08002b48 in ?? ()
Reading symbols from /home/polaris/workspace/zephyr-project/zephyr/build/zephyr/zephyr.elf...
(gdb) 

如果看到 Hello World! zephyr 输出,说明环境搭建成功!

问题: 解决github https下载失败超时问题

git config --local url."git@github.com:".insteadOf "https://github.com/"

这样会将所有 https://github.com/ 开头的 URL 自动替换为 SSH 协议

相关文章:

Ubuntu2404 下搭建 Zephyr 开发环境

1. 系统要求 操作系统&#xff1a;Ubuntu2404&#xff08;64位&#xff09;磁盘空间&#xff1a;至少 8GB 可用空间&#xff08;Zephyr 及其工具链较大&#xff09; 2. 安装必要工具 Tool Min. Version CMake 3.20.5 Python 3.10 Devicetree compiler 1.4.6 2.1 安装系…...

现代C++特性(一):基本数据类型扩展

文章目录 基础数据类型long long (C 11)numeric_limits()获取当前数据类型的最值warning C4309: “”: 截断常量值新字符类型char16_t和char32_tWindows编程常用字符类型wchar_tchar8_t (C 20) 基础数据类型 C中的基本类型是构建其他数据类型的基础&#xff0c;常见的基础类型…...

【C++进阶篇】C++11新特性(下篇)

C函数式编程黑魔法&#xff1a;Lambda与包装器实战全解析 一. lambda表达式1.1 仿函数使用1.2 lambda表达式的语法1.3 lambda表达式使用1.3.1 传值和传引用捕捉1.3.2 隐式捕捉1.3.3 混合捕捉 1.4 lambda表达式原理1.5 lambda优点及建议 二. 包装器2.1 function2.2 bind绑定 三.…...

全生命周期的智慧城市管理

前言 全生命周期的智慧城市管理。未来&#xff0c;城市将在 实现从基础设施建设、日常运营到数据管理的 全生命周期统筹。这将避免过去智慧城市建设 中出现的“碎片化”问题&#xff0c;实现资源的高效配 置和项目的协调发展。城市管理者将运用先进 的信息技术&#xff0c;如物…...

echarts柱状图实现动态展示时报错

echarts柱状图实现动态展示时报错 1、问题&#xff1a; 在使用Echarts柱状图时&#xff0c;当数据量过多&#xff0c;x轴展示不下的时候&#xff0c;可以使用dataZoom实现动态展示。如下图所示&#xff1a; 但是当鼠标放在图上面滚动滚轮时或拖动滚动条时会报错&#xff0c;…...

Redis故障转移

概述 本文主要讲述了Redis故障转移的原理及过程&#xff0c;可与「Redis高可用架构」文章一同阅读&#xff0c;可更好理解相关内容&#xff0c;及整个Redis高可用架构的实现原理。 Leader 选举 哨兵首先进入 WATI_START 状态进行准备&#xff0c;等待哨兵成为哨兵集群的 Leade…...

STM32学习笔记:定时器(TIM)原理与应用(详解篇)

前言 定时器是STM32微控制器中最重要且最常用的外设之一&#xff0c;它不仅能提供精确的定时功能&#xff0c;还能实现PWM输出、输入捕获、编码器接口等多种功能。本文将全面介绍STM32的通用定时器&#xff0c;包括其工作原理、配置方法和典型应用。 一、STM32定时器概述 定…...

JAVA获取ES连接并查询所有数据

我们的项目要获取es连接&#xff0c;新版本和旧版本有不小的区别&#xff0c;在8.17.0版本使用的是 ElasticsearchClient <dependency><groupId>co.elastic.clients</groupId><artifactId>elasticsearch-java</artifactId><version>8.17…...

408第一季 - 数据结构 - 线性表

只能用C/C&#xff01; 顺序表 闲聊 线性表的逻辑顺序和物理顺序相同 都是1234 顺序表的优点&#xff1a; 随机访问&#xff0c;随机访问的意思是访问的时间 和位置没有关系&#xff0c;访问下标1和100一样的&#xff0c;更深层就是直接计算 a100 * 数组大小&#xff0c;随便…...

第23讲、Odoo18 邮件系统整体架构

目录 Odoo 邮件系统整体架构邮件发送方式邮件模板配置SMTP 邮件服务器配置邮件发送过程开发中常见邮件发送需求常见问题排查提示与最佳实践完整示例&#xff1a;审批通过自动发邮件门户表单自动邮件通知案例邮件队列与异步发送邮件添加附件邮件日志与调试多语言邮件模板邮件安…...

【QT面试题】(三)

文章目录 Qt信号槽的优点及缺点Qt中的文件流和数据流区别&#xff1f;Qt中show和exec区别QT多线程使用的方法 (4种)QString与基本数据类型如何转换&#xff1f;QT保证多线程安全事件与信号的区别connect函数的连接方式&#xff1f;信号与槽的多种用法Qt的事件过滤器有哪些同步和…...

DeepSeek09-open-webui使用

Open WebUI 完全指南&#xff1a;从安装到知识库搭建与异常处理 最后更新&#xff1a;2025年6月7日 | 适用版本&#xff1a;Open WebUI v0.6.x 一、安装部署 1.1 系统要求 **Python 3.12 **&#xff08;严格版本要求&#xff0c;更高版本3.13不兼容&#xff09;Node.js 20.x内…...

HarmonyOS:Counter计数器组件

一、概述 计数器组件&#xff0c;提供相应的增加或者减少的计数操作。 说明 该组件从API Version 7开始支持。后续版本如有新增内容&#xff0c;则采用上角标单独标记该内容的起始版本。 二、属性 除支持通用属性外&#xff0c;还支持以下属性。 enableInc enableInc(value: b…...

数据类型 -- 字符

在C中&#xff0c;字符型&#xff08;char&#xff09;用于存储单个字符&#xff0c;如字母、数字、符号等。字符型是最基本的数据类型之一&#xff0c;常用于处理文本、字符数组&#xff08;字符串&#xff09;等场景。 1. 基本类型 • char&#xff1a;标准字符类型&#x…...

WordZero:让Markdown与Word文档自由转换的Golang利器

在日常工作中&#xff0c;我们经常需要在Markdown和Word文档之间进行转换。Markdown方便编写和版本控制&#xff0c;而Word文档更适合正式的商务环境。作为一名Golang开发者&#xff0c;我开发了WordZero这个库&#xff0c;专门解决这个痛点。 项目背景 GitHub仓库&#xff1…...

sqlsugar WhereIF条件的大于等于和等于查出来的坑

一、如下图所示&#xff0c;当我用 .WhereIF(input.Plancontroltype > 0, u > u.Plancontroltype (DnjqPlancontroltype)input.Plancontroltype) 这里面用等于的时候&#xff0c;返回结果一条数据都没有。 上图中生成的SQL如下&#xff1a; SELECT id AS Id ,code AS …...

Pandas 技术解析:从数据结构到应用场景的深度探索

序 我最早用Python做大数据项目时&#xff0c;接触最早的就是Pandas了。觉得对于IT技术人员而言&#xff0c;它是可以属于多场景的存在&#xff0c;因为它的本身就是数据驱动的技术生态中&#xff0c;对于软件工程师而言&#xff0c;它是快速构建数据处理管道的基石&#xff1…...

数据库系统概论(十七)超详细讲解数据库规范化与五大范式(从函数依赖到多值依赖,再到五大范式,附带例题,表格,知识图谱对比带你一步步掌握)

数据库系统概论&#xff08;十七&#xff09;超详细讲解数据库规范化与五大范式&#xff08;从函数依赖到多值依赖&#xff0c;再到五大范式&#xff0c;附带例题&#xff0c;表格&#xff0c;知识图谱对比带你一步步掌握&#xff09; 前言一、为什么需要规范化1. 我们先想一个…...

[c#]判定当前软件是否用管理员权限打开

有时一些软件的逻辑中需要使用管理员权限对某些文件进行修改时&#xff0c;那么该软件在执行或者打开的场合&#xff0c;就需要用使用管理员身份运行才能达到效果。那么在c#里&#xff0c;如何判定该软件是否是对管理员身份运的呢&#xff1f; 1.取得当前的windows用户。 2.取得…...

并发编程实战(生产者消费者模型)

在并发编程中使用生产者和消费者模式能够解决绝大多数的并发问题。该模式通过平衡生产线程和消费线程的工作能力来提高程序整体处理数据的速度。 生产者和消费者模式&#xff1a; 在线程的世界中生产者就是产生数据的线程&#xff0c;而消费者则是消费数据的线程。在多线程开…...

分布式微服务系统架构第144集:FastAPI全栈开发教育系统

加群联系作者vx&#xff1a;xiaoda0423 仓库地址&#xff1a;https://webvueblog.github.io/JavaPlusDoc/ https://1024bat.cn/ https://github.com/webVueBlog/fastapi_plus https://webvueblog.github.io/JavaPlusDoc/ 使用docker搭建常用开发环境 docker安装mysql docker ru…...

el-tabs 切换时数据不更新的问题

最近业务需求&#xff0c;需要在页面中使用tabs&#xff0c;使用过程中出现tabs切换&#xff0c;数据不更新的问题&#xff0c;以下是思路和解决办法。 Vue 会追踪你在模板中绑定的数据&#xff0c;并在数据发生变化时重新渲染相应的部分。但在使用 el-tabs 时&#xff0c;有时…...

git小乌龟不显示图标状态解决方案

第一步 在开始菜单的搜索处&#xff0c;输入regedit命令&#xff0c;打开注册表。 第二步 在注册表编辑器中&#xff0c;找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers 这一项。 第三步 让Tortoise相关的项目排在前…...

获取 OpenAI API Key

你可以按照以下步骤来获取 openai.api_key&#xff0c;用于调用 OpenAI 的 GPT-4、DALLE、Whisper 等 API 服务&#xff1a; &#x1f9ed; 获取 OpenAI API Key 的步骤&#xff1a; ✅ 1. 注册或登录 OpenAI 账号 打开 https://platform.openai.com/ 使用你的邮箱或 Google/…...

【Android基础回顾】五:AMS(Activity Manager Service)

Android 的 AMS&#xff08;Activity Manager Service&#xff09;是 Android 系统中的核心服务之一&#xff0c;负责管理整个应用生命周期、任务栈、进程和四大组件&#xff08;Activity、Service、BroadcastReceiver、ContentProvider&#xff09;的运行。它运行在系统进程 s…...

pycharm中提示C++ compiler not found -- please install a compiler

1.最近用pycharm编译一个开源库,编译的依赖c compiler 2.单单使用pycharm编译&#xff0c;编译器报错C compiler not found – please install a compiler 3.需要在配置环境中引入对应库 4.从新编译后没有提示:C compiler not found – please install a compiler错误。...

类型别名与类型自动推导

类型别名与类型的自动推导 类型别名 为什么要引入类型别名&#xff1f; 为了给类型赋予特殊含义或便于使用 典型用途 &#xff08;1&#xff09;增强代码可移植性 例如&#xff1a;size_t &#xff08;在不同系统中可能是unsigned int 或 unsigned long&#xff09; 首先是…...

一站式直播工具:助力内容创作者高效开启直播新时代

近年来&#xff0c;随着互联网技术的不断进步和短视频、直播行业的爆发式增长&#xff0c;越来越多的企业和个人投入到直播电商、互动娱乐、在线教育等场景。直播运营过程中&#xff0c;涉及到数据统计、弹幕互动、流程自动化、内容同步等诸多环节。如何提升运营效率、减少人工…...

【学习笔记】Lamba表达式[匿名函数]

【学习笔记】Lamba表达式[匿名函数] Lamba表达式格式函数模板Lamba表达式例子 Lamba表达式格式 格式&#xff1a; [捕获列表](参数列表) -> 返回类型 { 函数体 }1、捕获列表&#xff1a;指定如何访问外部变量&#xff08;如 [&x] 引用捕获&#xff0c;[x] 值捕获&#…...

学习笔记(26):线性代数-张量的降维求和,简单示例

学习笔记(26)&#xff1a;线性代数-张量的降维求和&#xff0c;简单示例 1.先理解 “轴&#xff08;Axis&#xff09;” 的含义 张量的 “轴” 可以理解为 维度的方向索引 。对于形状为 (2, 3, 4) 的张量&#xff0c;3 个轴的含义是&#xff1a; 轴 0&#xff08;axis0&…...