stm32开发工具之addr2line.exe使用

目录

简述

应用场景

使用步骤

1、通过J-Link Commander 工具查看设备运行异常前的返回地址

2、将addr2line.exe工具放置在xxxx.axf(包含调试信息的二进制文件)统计目录中。(后面附有addr2line.exe工具获取方法。)

3、补充(addr2line.exe工具获取方法):

(1)  安装工具dllrepair.exe,然后用此工具下载addr2line.exe。

(2) 直接提供百度网盘下载链接:


简述

        addr2line.exe是一个将程序地址转换为源代码函数和行号的工具。方便通过.axf/.alf二进制文件找到程序出现bug的地方。

        注意:本文addr2line.exe为windows环境下使用

                   linux环境下的工具为arm-none-eabi-addr2line.exe/arm-none-eabi-addr2line 

应用场景

        设备长时间运行突然卡死,需要找到问题出现的源码位置时。

使用步骤

1、通过J-Link Commander 工具查看设备运行异常前的返回地址

2、将addr2line.exe工具放置在xxxx.axf(包含调试信息的二进制文件)统计目录中。(后面附有addr2line.exe工具获取方法。)

命令格式自行百度:

示例:addr2line.exe  -e  xxxxxxxxxxx.axf  -f    080154AC

        (显示函数名称、文件名和行号)

3、补充(addr2line.exe工具获取方法):

(1)  安装工具dllrepair.exe,然后用此工具下载addr2line.exe。

        dllrepair.exe下载路径:addr2line.exe官方下载 | 免费exe文件下载 - Windows文件下载站

(2) 直接提供百度网盘下载链接:

        链接:https://pan.baidu.com/s/1BkWdlDXSqwwsRI2k2zA55A 
        提取码:1234 


        

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
基于HAL库开发STM32 OLED可以参考以下步骤: 1. 初始化I2C总线,配置OLED的I2C地址,数据传输速率等。 2. 在HAL库中,使用HAL_I2C_Master_Transmit和HAL_I2C_Master_Receive函数可以实现I2C总线的数据传输。 3. 配置OLED显示屏的初始化参数,比如分辨率、亮度、对比度等。 4. 初始化OLED显示屏,可以使用OLED_Init函数,该函数会按照前面设置的参数进行初始化。 5. 在代码中编写需要显示的内容,并通过函数将其显示在OLED屏幕上。 6. 在程序中增加控制代码,可以实现动态刷新屏幕内容等功能。 以下是一份参考代码,仅供参考: ``` #include "oled.h" #include "delay.h" #include "i2c.h" #define OLED_CMD 0x00 #define OLED_DATA 0x40 void OLED_WR_Byte(uint8_t dat, uint8_t cmd) { uint8_t data_t; if(cmd==OLED_CMD)data_t=0x00; else data_t=0x40; data_t=dat; HAL_I2C_Master_Transmit(&hi2c1, OLED_ADDR, data_t, 2, 1000); } void OLED_Display_On(void) { OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令 OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON } void OLED_Display_Off(void) { OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令 OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF } void OLED_Clear(void) { uint8_t i,n; for(i=0;i<8;i++) { OLED_WR_Byte(0xb0+i,OLED_CMD); //设置页地址(0~7) OLED_WR_Byte(0x00,OLED_CMD); //设置显示位置—列低地址 OLED_WR_Byte(0x10,OLED_CMD); //设置显示位置—列高地址 for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA); } //更新显示 } void OLED_Init(void) { HAL_Delay(200); OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel OLED_WR_Byte(0x00,OLED_CMD);//---set low column address OLED_WR_Byte(0x10,OLED_CMD);//---set high column address OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F) OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常 OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常 OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64) OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F) OLED_WR_Byte(0x00,OLED_CMD);//-not offset OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration OLED_WR_Byte(0x12,OLED_CMD); OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02) OLED_WR_Byte(0x02,OLED_CMD);// OLED_Clear(); } void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size) { uint8_t c=0,i=0,j=0; switch(Char_Size) { case 16: { while(chr[c]!='\0') { if(chr[c]>127) { i=chr[c]-128; j=chr[c+1]-128; c+=2; OLED_ShowChinese(x,y,i,j,16); x+=16; } else { OLED_ShowChar(x,y,chr[c],16); c++; x+=8; } } }break; case 12: { while(chr[c]!='\0') { if(chr[c]>127) { i=chr[c]-128; j=chr[c+1]-128; c+=2; OLED_ShowChinese(x,y,i,j,12); x+=12; } else { OLED_ShowChar(x,y,chr[c],12); c++; x+=6; } } }break; default: { while (chr[c]!='\0') { if (chr[c]>127) { i=chr[c]-128; j=chr[c+1]-128; c+=2; OLED_ShowChinese(x,y,i,j,12); x+=12; } else { OLED_ShowChar(x,y,chr[c],16); c++; x+=8; } } }break; } } void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t Char_Size) { uint8_t c=0,i=0,j=0; switch(Char_Size) { case 12: { c=chr-' '; if(x>116) {x=0;y+=12;} OLED_Set_Pos(x,y); for(i=0;i<6;i++) { OLED_WR_Byte(F6x8[c][i],OLED_DATA); } }break; case 16: { c=chr-' '; if(x>112) {x=0;y+=16;} OLED_Set_Pos(x,y); for(i=0;i<8;i++) { OLED_WR_Byte(F8X16[c*16+i],OLED_DATA); } OLED_Set_Pos(x,y+8); for(i=0;i<8;i++) { OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA); } }break; default: { c=chr-' '; if(x>120) {x=0;y+=16;} OLED_Set_Pos(x,y); for(i=0;i<8;i++) { OLED_WR_Byte(F8X16[c*16+i],OLED_DATA); } OLED_Set_Pos(x,y+8); for(i=0;i<8;i++) { OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA); } }break; } } void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no,uint8_t size) { uint8_t t,t1,c=0,i=0; uint8_t adder=32*(no-1); while(c<size) { t=Hzk[size-12][adder]; t1=Hzk[size-12][adder+1]; for(i=0;i<8;i++) { if(t&0x80)OLED_Set_Pos(x+i,y); t<<=1; if(t1&0x80)OLED_WR_Byte(0xff,OLED_DATA); else OLED_WR_Byte(0,OLED_DATA); t1<<=1; } c++; adder+=2; y++; if(y>63)return; if((y-y%8)==((y-1)-(y-1)%8)) {y=y-y%8+8;} } } void OLED_Set_Pos(uint8_t x, uint8_t y) { OLED_WR_Byte(0xb0+y,OLED_CMD); OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD); OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD); } void Draw_BMP(uint8_t x,uint8_t y,const uint8_t *pBmp,uint8_t chWidth,uint8_t chHeight) { uint16_t i,j,n,m,k; uint8_t temp; n=(chWidth%8==0)?chWidth/8:chWidth/8+1; for(i=0;i<chHeight;i++) { OLED_Set_Pos(x,y+i); for(j=0;j<n;j++) { temp = pBmp[i*n+j]; for(k=0;k<8;k++) { if(temp&0x80)OLED_WR_Byte(1,OLED_DATA); else OLED_WR_Byte(0,OLED_DATA); temp<<=1; } } } } ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值