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

用 Uno 当烧录器给 atmega328 烧录 bootloader

用 Uno 当烧录器给 atmega328 烧录 bootloader

  • date: 2023-8-10
    https://backmountaindevil.github.io/#/hackaday/arduino/isp

引脚接线

把两个板子的 11(MOSI)、12(MISO)、13(SCK)、5V、GND 两两相连,还要把 Uno(烧录器)的 10 接到atmega328(待烧录的对象)的 RES(RESET) 上。这六根线必接,程序里还有三个 LED 状态指示,可以不接

接线,然后将示例中的 ArduinoISP 程序按照正常操作验证上传到 Uno 上,这一步通常没啥问题。其实这一步是把 ino 程序编译后缀为 hex 的固件,然后把固件刷上去(打开详细输出就能看到这些信息)

error

avrdude error: cannot find USBtiny device (0x2341/0x49)
avrdude error: unable to open programmer arduinoisp on port usb
烧录引导程序出错。

菜单栏:文件 - 首选项,显示详细输出,把上传给勾选上

再尝试一次获取详细信息,工具-编程器 选 Arduino as ISP(默认是 AVRISP),然后 工具-烧录引导程序

Arduino:1.8.19 (Linux), 开发板:"Arduino Uno"//bin/avrdude -C//etc/avrdude.conf -v -patmega328p -carduinoisp -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m avrdude: Version 7.2Copyright the AVRDUDE authors;see https://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is /etc/avrdude.confUser configuration file is /home/mifen/.avrdudercUser configuration file does not exist or is not a regular file, skippingUsing Port                    : usbUsing Programmer              : arduinoisp
avrdude usbtiny_open() error: cannot find USBtiny device (0x2341/0x49)
avrdude main() error: unable to open programmer arduinoisp on port usbavrdude done.  Thank you.烧录引导程序出错。

上面的 Port 感觉就不对,按理说是类似这样的 /dev/ttyUSB0,通过编译上传的详细信息可以看到 avrdude 在上传时也是识别到了对应端口,怎么到这一步骤就不行了呢。然后查了一下网上的,要么更新程序,要么用别的软件来搞,有准备尝试配置文件的方式,最后发现是编程器选错了,要选 Arduino as ISP 而不是 ArduinoISP,成功烧录的详细信息如下

成功烧录详情

//bin/avrdude -C//etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m avrdude: Version 7.2Copyright the AVRDUDE authors;see https://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is /etc/avrdude.confUser configuration file is /home/mifen/.avrdudercUser configuration file does not exist or is not a regular file, skippingUsing Port                    : /dev/ttyUSB0Using Programmer              : stk500v1Overriding Baud Rate          : 19200AVR Part                      : ATmega328PChip Erase delay              : 9000 usPAGEL                         : PD7BS2                           : PC2RESET disposition             : possible i/oRETRY pulse                   : SCKSerial program mode           : yesParallel program mode         : yesTimeout                       : 200StabDelay                     : 100CmdexeDelay                   : 25SyncLoops                     : 32PollIndex                     : 3PollValue                     : 0x53Memory Detail                 :Block Poll               Page                       PolledMemory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0x00 0x00flash                  65    10   128    0 yes     32768  128    256  4500  4500 0x00 0x00lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00Programmer Type : STK500Description     : Atmel STK500 version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard         : UnknownVtarget         : 0.0 VVaref           : 0.0 VOscillator      : OffSCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: erasing chipavrdude: processing -U lock:w:0x3F:m
avrdude: reading input file 0x3F for lockwith 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0x3F
avrdude avr_verify() warning: ignoring mismatch in unused bits of lock(device 0xff != input 0x3f); to prevent this warning setunused bits to 1 when writing (double check with datasheet)
avrdude: 1 byte of lock verifiedavrdude: processing -U efuse:w:0xFD:m
avrdude: reading input file 0xFD for efusewith 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte efuse ...
avrdude: 1 byte of efuse written
avrdude: verifying efuse memory against 0xFD
avrdude: 1 byte of efuse verifiedavrdude: processing -U hfuse:w:0xDE:m
avrdude: reading input file 0xDE for hfusewith 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte hfuse ...
avrdude: 1 byte of hfuse written
avrdude: verifying hfuse memory against 0xDE
avrdude: 1 byte of hfuse verifiedavrdude: processing -U lfuse:w:0xFF:m
avrdude: reading input file 0xFF for lfusewith 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lfuse ...
avrdude: 1 byte of lfuse written
avrdude: verifying lfuse memory against 0xFF
avrdude: 1 byte of lfuse verifiedavrdude done.  Thank you.//bin/avrdude -C//etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:/usr/share/arduino/hardware/archlinux-arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m avrdude: Version 7.2Copyright the AVRDUDE authors;see https://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is /etc/avrdude.confUser configuration file is /home/mifen/.avrdudercUser configuration file does not exist or is not a regular file, skippingUsing Port                    : /dev/ttyUSB0Using Programmer              : stk500v1Overriding Baud Rate          : 19200AVR Part                      : ATmega328PChip Erase delay              : 9000 usPAGEL                         : PD7BS2                           : PC2RESET disposition             : possible i/oRETRY pulse                   : SCKSerial program mode           : yesParallel program mode         : yesTimeout                       : 200StabDelay                     : 100CmdexeDelay                   : 25SyncLoops                     : 32PollIndex                     : 3PollValue                     : 0x53Memory Detail                 :Block Poll               Page                       PolledMemory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0x00 0x00flash                  65    10   128    0 yes     32768  128    256  4500  4500 0x00 0x00lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00Programmer Type : STK500Description     : Atmel STK500 version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard         : UnknownVtarget         : 0.0 VVaref           : 0.0 VOscillator      : OffSCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.To disable this feature, specify the -D option.
avrdude: erasing chipavrdude: processing -U flash:w:/usr/share/arduino/hardware/archlinux-arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex:i
avrdude: reading input file /usr/share/arduino/hardware/archlinux-arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex for flashwith 502 bytes in 2 sections within [0x7e00, 0x7fff]using 4 pages and 10 pad bytes
avrdude: writing 502 bytes flash ...
Writing | ################################################## | 100% 0.08s
avrdude: 502 bytes of flash written
avrdude: verifying flash memory against /usr/share/arduino/hardware/archlinux-arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex
Reading | ################################################## | 100% 0.00s
avrdude: 502 bytes of flash verifiedavrdude: processing -U lock:w:0x0F:m
avrdude: reading input file 0x0F for lockwith 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0x0F
avrdude avr_verify() warning: ignoring mismatch in unused bits of lock(device 0xcf != input 0x0f); to prevent this warning setunused bits to 1 when writing (double check with datasheet)
avrdude: 1 byte of lock verifiedavrdude done.  Thank you.

用国行(开发板信息BN显示未知、无SN)烧正规军(可以获取开发板信息如序列号)可以(上面就是),用正规军烧国行则不行,会报错如下

Arduino:1.8.19 (Linux), 开发板:"Arduino Uno"//bin/avrdude -C//etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m avrdude: Version 7.2Copyright the AVRDUDE authors;see https://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is /etc/avrdude.confUser configuration file is /home/mifen/.avrdudercUser configuration file does not exist or is not a regular file, skippingUsing Port                    : /dev/ttyACM0Using Programmer              : stk500v1Overriding Baud Rate          : 19200AVR Part                      : ATmega328PChip Erase delay              : 9000 usPAGEL                         : PD7BS2                           : PC2RESET disposition             : possible i/oRETRY pulse                   : SCKSerial program mode           : yesParallel program mode         : yesTimeout                       : 200StabDelay                     : 100CmdexeDelay                   : 25SyncLoops                     : 32PollIndex                     : 3PollValue                     : 0x53Memory Detail                 :Block Poll               Page                       PolledMemory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0x00 0x00flash                  65    10   128    0 yes     32768  128    256  4500  4500 0x00 0x00lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00Programmer Type : STK500Description     : Atmel STK500 version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard         : UnknownVtarget         : 0.0 VVaref           : 0.0 VOscillator      : OffSCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000
avrdude main() error: Yikes!  Invalid device signature.
avrdude main() error: expected signature for ATmega328P is 1E 95 0FDouble check connections and try again, or use -F to overridethis check.avrdude done.  Thank you.烧录引导程序出错。

根据上面的错误信息,我在终端加 -F 也不行,还是验证失败。奇怪的是,国行和正规军的差别在于串口芯片啊,Arduino as ISP 没走 ch340 国道啊,mcu 都是一样的咋就不行了?然后又对调一下(接线没动),发现出现了上面验证失败的错误,也就是说明接错线会发生这个错误。然而实际上刚才我有对调11、12看接线,没想到啊,看样子是刚才接线错了,重新拔掉接一遍就可以了。

指定引导程序

如果说要烧录指定的引导程序,如ATmega-Soldering-Station下的引导文件,那该怎么办呢?结合仓库的介绍和上面的详细信息可以知道两行指令,需要修改端口号和文件路径,在终端中运行即可

avrdude -C//etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m avrdude -C//etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/path/to/filename.hex:i -Ulock:w:0x0F:m 

想刷回原版引导,用 arduino 运行烧录引导程序程序即可

参考

Arduino 烧写bootloader cheng3100 2017.02.10

[Arduino]烧写Arduino BootLoader的几种方法 李万鑫 2017-06-27:和上面接线是一样的,只是看着不一样,因为 ISP 口有几个

Arduino: [已修复] IDE 1.6.9 + ArduinoISP =“找不到 USBtiny 设备 (0x2341/0x49)”错误消息 => 使用“Arduino 作为 ISP”2016-07-12 HP-Sparks

我找到了问题的根源:程序员选择的“ArduinoISP”与“Arduino as ISP”

相关文章:

用 Uno 当烧录器给 atmega328 烧录 bootloader

用 Uno 当烧录器给 atmega328 烧录 bootloader date: 2023-8-10 https://backmountaindevil.github.io/#/hackaday/arduino/isp 引脚接线 把两个板子的 11(MOSI)、12(MISO)、13(SCK)、5V、GND 两两相连,还要把 Uno(烧录器)的 10 接到atmeg…...

spring boot策略模式实用: 告警模块为例

spring boot策略模式实用: 告警模块 0 涉及知识点 策略模式, 模板方法, 代理, 多态, 反射 1 需求概括 场景: 每隔一段时间, 会获取设备运行数据, 如通过温湿度计获取到当前环境温湿度;需求: 对获取回来的进行分析, 超过配置的阈值需要产生对应的告警 2 方案设计 告警的类…...

Camunda 7.x 系列【10】使用 Rest API 运行流程实例

有道无术,术尚可求,有术无道,止于术。 本系列Spring Boot 版本 2.7.9 本系列Camunda 版本 7.19.0 源码地址:https://gitee.com/pearl-organization/camunda-study-demo 文章目录 1. 前言2. 官方接口文档3. 本地接口文档3.1 Postman3.2 Camunda Platform Run Swagger3.3 S…...

Python-OpenCV中的图像处理-边缘检测

Python-OpenCV中的图像处理-边缘检测 边缘检测Canny算子 边缘检测Canny算子 Canny 边缘检测是一种非常流行的边缘检测算法,是 John F.Canny 在 1986 年提出的。它是一个有很多步构成的算法:噪声去除、计算图像梯度、非极大值抑制、滞后阀值等。 Canny(i…...

一文了解Java序列化和反序列化:对象的存储与传输

一文了解Java序列化和反序列化:对象的存储与传输 作者:Stevedash 发布时间:2023年8月9日 21点30分 前言 Java序列化是一项强大而重要的技术,它允许我们将对象转换为字节流,以便在存储、传输和重建时使用。在本文中&…...

react-codemirror2 编辑器需点击一下或者延时才显示数据的问题

现象&#xff1a; <Codemirror/>组件的数据已经赋上值的情况下&#xff0c;初始状态不渲染数据&#xff0c;需要点击编辑框获取焦点后才展示&#xff0c;或者延迟了几秒才显示出来。 原因&#xff1a; 指定了一些依赖的版本&#xff0c;可能不兼容了一些功能&#xff0c…...

火山引擎联合Forrester发布《中国云原生安全市场现状及趋势白皮书》,赋能企业构建云原生安全体系

国际权威研究咨询公司Forrester 预测&#xff0c;2023年全球超过40%的企业将会采用云原生优先战略。然而&#xff0c;云原生在改变企业上云及构建新一代基础设施的同时&#xff0c;也带来了一系列的新问题&#xff0c;针对涵盖云原生应用、容器、镜像、编排系统平台以及基础设施…...

需要数电发票接口的,先熟悉下数电发票基本常识

最近有一些技术小伙伴来咨询数电发票接口的时候&#xff0c;对数电发票的一些常识不太了解&#xff0c; 导致沟通起来比较困难。比较典型的这三个问题&#xff1a; 一、开具数电票时&#xff0c;如何设置身份认证频次&#xff1f; 请公司的法定代表人或财务负责人登录江苏省电…...

node-sass是什么

一、Sass&#xff08;Syntactically Awesome Style Sheets&#xff09; 是一种CSS预处理器&#xff0c;它扩展了CSS的功能并提供了更强大的样式表语言。Sass允许开发人员使用变量、嵌套规则、混合&#xff08;Mixins&#xff09;、继承等高级功能来编写更简洁、可维护的样式代…...

C语言指针之 进阶

前言 今天来较为深入的介绍一下指针&#xff0c;希望大家能有所收获&#xff5e; 那么&#xff0c;先进行一些简单的基础知识复习吧。 字符指针 格式&#xff1a;char * 补充&#xff1a; 表达式“abcdef”的值是首字符a的地址 所以当像下面这么使用时&#xff0c;它的含…...

C++单例模式

文章目录 1、什么是单例2、一个好的单例应该具备的条件3、懒汉模式与饿汉模式4、单例实现&#xff1a;线程安全、内存安全的懒汉式单例&#xff08;基于C11的智能指针和互斥锁&#xff09; 1、什么是单例 单例 Singleton 是设计模式的一种&#xff0c;其特点是只提供唯一一个类…...

C++ 析构函数

析构函数 析构函数于构造函数相对应&#xff0c;构造函数是对象创建的时候自动调用的&#xff0c;而析构函数就是对象在销毁的时候自动调用的 特点&#xff1a; 1&#xff09;构造函数可以有多个来构成重载&#xff0c;但析构函数只能有一个&#xff0c;不能构成重载 2&…...

CSS——字体选择

在网页设计和开发中&#xff0c;字体选择是一个非常重要的因素。字体不仅仅是文字的表现形式&#xff0c;它们还能够传达出一种特定的情感和风格。在CSS中&#xff0c;我们可以通过使用字体代码来定义网页中使用的字体。 CSS提供了一种简单而灵活的方式来设置字体。通过使用fo…...

SpringBoot自动装配及run方法原理探究

自动装配 1、pom.xml spring-boot-dependencies&#xff1a;核心依赖在父工程中&#xff01;我们在写或者引入一些SpringBoot依赖的时候&#xff0c;不需要指定版本&#xff0c;就因为有这些版本仓库 1.1 其中它主要是依赖一个父工程&#xff0c;作用是管理项目的资源过滤及…...

Mybatis实现JsonObject对象与JSON之间交互

项目中使用PostGresql数据库进行数据存储&#xff0c;表中某字段为Json类型&#xff0c;用于存储Json格式数据。PG数据库能够直接存储Json算是一大特色&#xff0c;很多特定情境下使用直接存储Json字段数据能够大量节省开发时间&#xff0c;提高后台数据查询和转换效率。 1、基…...

spring boot 集成 jetcache【基础篇:@Cached、@CreateCache、@CacheRefresh】

手打不易&#xff0c;如果转摘&#xff0c;请注明出处&#xff01; 注明原文&#xff1a;https://zhangxiaofan.blog.csdn.net/article/details/129832925 目录 前言 版本 配置通用说明 项目结构 代码 启动类 实体类 基础使用——增删改查&#xff08;Cached、CacheInv…...

个人对前后端分离的一些看法

内容简介&#xff1a;前端开发过程中能完全不依赖后端的才是真正的前后端分离指的是工作过程中&#xff0c;前端的的代码中往往会掺杂一些后端的逻辑。后端返回了一个json对象 前端开发过程中能完全不依赖后端的才是真正的前后端分离 指的是工作过程中&#xff0c;前端的的代码…...

TailWindCss 在Hbuilderx中使用

基于这个插件 weapp-tailwindcss 地址 本次说明基于HbuilderX 创建的项目非CLI 安装步骤按照文档走&#xff0c;先安装上几个依赖。然后是几个配置文件 tailwind-input.css tailwind的css文件用来引入到app.vue /* #ifdef H5 */ tailwind base; /* 如果是小程序的话&#x…...

Unity导入图片时,通过设置属性快速实现资源的压缩

是在学习tilemap绘制世界地图的时候发现的这个功能。 之前一直只是粗略的知道这部分是对应图片资源的压缩的。比如Compression是指的压缩质量&#xff0c;想要完全不压缩就设置None&#xff0c;会导致图片资源会大一些。 在我的例子工程中&#xff0c;其他图片资源的尺寸都是6…...

AlmaLinux 9 安装 Go 1.20

AlmaLinux 9 安装 Golang 1.20 1. 下载 go 安装包2. 安装 go3. 配置环境变量4. 确认 go 版本 1. 下载 go 安装包 访问 https://go.dev/dl/&#xff0c;下载你想安装的版本&#xff0c;比如 go1.20.7.linux-amd64.tar.gz&#xff0c; 2. 安装 go (可选)删除旧版本&#xff0c;…...

多云管理“拦路虎”:深入解析网络互联、身份同步与成本可视化的技术复杂度​

一、引言&#xff1a;多云环境的技术复杂性本质​​ 企业采用多云策略已从技术选型升维至生存刚需。当业务系统分散部署在多个云平台时&#xff0c;​​基础设施的技术债呈现指数级积累​​。网络连接、身份认证、成本管理这三大核心挑战相互嵌套&#xff1a;跨云网络构建数据…...

Qt Widget类解析与代码注释

#include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->setupUi(this); }Widget::~Widget() {delete ui; }//解释这串代码&#xff0c;写上注释 当然可以&#xff01;这段代码是 Qt …...

线程与协程

1. 线程与协程 1.1. “函数调用级别”的切换、上下文切换 1. 函数调用级别的切换 “函数调用级别的切换”是指&#xff1a;像函数调用/返回一样轻量地完成任务切换。 举例说明&#xff1a; 当你在程序中写一个函数调用&#xff1a; funcA() 然后 funcA 执行完后返回&…...

Swagger和OpenApi的前世今生

Swagger与OpenAPI的关系演进是API标准化进程中的重要篇章&#xff0c;二者共同塑造了现代RESTful API的开发范式。 本期就扒一扒其技术演进的关键节点与核心逻辑&#xff1a; &#x1f504; 一、起源与初创期&#xff1a;Swagger的诞生&#xff08;2010-2014&#xff09; 核心…...

OPENCV形态学基础之二腐蚀

一.腐蚀的原理 (图1) 数学表达式&#xff1a;dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一&#xff0c;腐蚀跟膨胀属于反向操作&#xff0c;膨胀是把图像图像变大&#xff0c;而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...

LeetCode - 199. 二叉树的右视图

题目 199. 二叉树的右视图 - 力扣&#xff08;LeetCode&#xff09; 思路 右视图是指从树的右侧看&#xff0c;对于每一层&#xff0c;只能看到该层最右边的节点。实现思路是&#xff1a; 使用深度优先搜索(DFS)按照"根-右-左"的顺序遍历树记录每个节点的深度对于…...

SQL慢可能是触发了ring buffer

简介 最近在进行 postgresql 性能排查的时候,发现 PG 在某一个时间并行执行的 SQL 变得特别慢。最后通过监控监观察到并行发起得时间 buffers_alloc 就急速上升,且低水位伴随在整个慢 SQL,一直是 buferIO 的等待事件,此时也没有其他会话的争抢。SQL 虽然不是高效 SQL ,但…...

(一)单例模式

一、前言 单例模式属于六大创建型模式,即在软件设计过程中,主要关注创建对象的结果,并不关心创建对象的过程及细节。创建型设计模式将类对象的实例化过程进行抽象化接口设计,从而隐藏了类对象的实例是如何被创建的,封装了软件系统使用的具体对象类型。 六大创建型模式包括…...

嵌入式常见 CPU 架构

架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集&#xff0c;单周期执行&#xff1b;低功耗、CIP 独立外设&#xff1b;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel&#xff08;原始…...

【SpringBoot自动化部署】

SpringBoot自动化部署方法 使用Jenkins进行持续集成与部署 Jenkins是最常用的自动化部署工具之一&#xff0c;能够实现代码拉取、构建、测试和部署的全流程自动化。 配置Jenkins任务时&#xff0c;需要添加Git仓库地址和凭证&#xff0c;设置构建触发器&#xff08;如GitHub…...