首页 > 解决方案 > 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。

标签: c++assemblyprojectatmelgarbage

解决方案


推荐阅读