c++ - atmel 工作室制作垃圾代码。如何消除它?
问题描述
Atmel 工作室为汇编程序添加了一些代码。我的中断向量被忽略了。谁知道为什么会这样?
主文件
#include <avr/pgmspace.h>
#define k 2 //1-6 max 936ms on k=6
#define ts 13
uint8_t cstr[14]={' ','H','0','2','6','P','0','5','2','W','1','0','4',0};
uint16_t BTN_DELAY_TIME =1000;
#define ival(i) (uint16_t) ((i)*k*ts)
#define ps100(i) (uint8_t)((((((i)*ts)>>2)*k)>>3)/3)
#define ps10(i) (uint8_t) ((ival((i))-ps100((i))*100)/10)
#define ps1(i) (uint8_t) (ival((i))-ps100((i))*100-ps10((i))*10)
static const uint8_t pstr[12][3] PROGMEM=
{
{ps100(1)+0x30,ps10(1)+0x30,ps1(1)+0x30},
...
{ps100(12)+0x30,ps10(12)+0x30,ps1(12)+0x30}
};
const uint8_t * pstr_address=&pstr[0][0];
uint8_t E_KEY_ADDR=0x3F...
看这个文件-> asm_part.S
.extern cstr
...
.extern pstr_address
#define I2CADDR 0x4E
//This code must be the initial one!!!
.org 0x00
rjmp RESET_vect
rjmp RESET_vect
rjmp PCINT0_vect
rjmp TIM0_OVF_vect
RESET_vect:
.global main
main:
...
但是我们在头上有这段代码:
00000000 RJMP PC+0x001C Relative jump
00000001 RJMP PC+0x0034 Relative jump
00000002 RJMP PC+0x0033 Relative jump
00000003 RJMP PC+0x0032 Relative jump
00000004 RJMP PC+0x0031 Relative jump
00000005 RJMP PC+0x0030 Relative jump
00000006 RJMP PC+0x002F Relative jump
00000007 RJMP PC+0x002E Relative jump
00000008 RJMP PC+0x002D Relative jump
00000009 RJMP PC+0x002C Relative jump
...
00000035 RJMP PC-0x0035 Relative jump
--- C:\...\Release/.././asm_part.S
//This is my code start...
rjmp RESET_vect
attiny13A c++ 可执行文件的项目。优化-O0。
解决方案
推荐阅读
- javascript - ngx-dataTable 如何应用格式化功能
- node.js - 混淆 node_modules 被 .dockerignore 忽略
- python - arduino pyfirmata 模拟阅读
- php - 以编程方式设置发货 WooCommerce
- react-native - Xcode iOS 一直在运行旧版本的 React 原生应用
- powershell - Powershell删除空格,在每个字段后添加逗号
- python - 无法打开 .py 文件:“[Errno 2] 没有这样的文件或目录”
- logging - Grafana 日志插件不显示日志面板
- c# - 在 C# 中使用 POST 方法和使用 WebClient 的请求正文从服务器接收数据
- hibernate - 一个 Hibernate Entity 跨两个 Schema 共享