English 中文(简体)
未能使用闪光密码到ATmega328p
原标题:Makefile failing to flash code to ATmega328p

几个月前,。 因此,我用C文撰写的“联系”方案,在Arduino R3 Uno的“ATmega328p”中爆发,如果我有《国际职工会》的定义,我就没有成功。 最后,我把这个问题缩小到我的马克茨书撰写方式上(我正在使用该书的avr-gccrdude),并通过将该守则复制到Arduino IDE,并利用内在工具将其上载。

现在,我想回头来理解马克茨失败的原因。 我先通过<代码>avr-gcc和avrdude的文件,认为我已将这个问题缩小到我写给的记忆区。 样本C项目Im与以下项目合作:

int main(void)
{
    // set the data direction for the pin connected to
    // onboard LED
    DDRB |= _BV(DDB5);
    PORTB |= _BV(PORTB5);

    // no-op loop
    while (1) ;;

    // keep compiler happy
    return 0;
}

该方案是有意简单的;它只是转而列入《伦敦发展权利宣言》,并保留。 此时此刻,用以下文字进行点火:

AVRFLAGS = -F -v -p m328p -c arduino -P /dev/ttyACM0 -U flash:w:blink.hex


default: blink.elf
    avr-objcopy -O ihex blink.elf blink.hex

blink.o:
    avr-gcc -g -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o blink.o blink.c

blink.elf: blink.o
    avr-gcc -o blink.elf blink.o

flash:
    sudo avrdude ${AVRFLAGS} blink.hex

clean:
    rm -rf *.o *.hex *.elf

HOWEVER, 此时此刻,我又在档案的顶点上添加了ISR:

ISR (TIMER1_COMPA_vect)
{
  PORTB ^= _BV(PORTB5);
}

一切的爆发和尝试都会打破。 我曾试图这样做,同时没有《时间表/承诺1》的制定法(为示范目的而在此加以修改),而且不认为这影响到闪电的成功。 我利用了这一准确的ISR——和时间/目标1的准确相同的固定代码——在其他仅进行罚款的方案中,提供了使用Arduino IDE 内在工具的闪电;否则,它接收数据的Arduino Uno blinks, 然后,在LED上开始闪电并保持闪光。 每当任何方案都很少爆发时,这种突发事件就呈现出完全相同的模式。 I ve edited with -j .text -j .data, .eeprom, and other options, but to no effect.

我只想知道为什么失败了。

最佳回答

页: 1 没有这一选择,就没有增加抗逆转录病毒疗法和打断病媒表。 虽然你只有一个<代码>main()功能,但从地址0(传统病媒)开始,一切似乎都可行。 由于你加入了国际职工会,现在国际职工会的法典正在讨论0。

GNU 可使用<代码>COMPILE.c和LINK.c内在变量,以获得正确的汇编和联系指令。

问题回答

暂无回答




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签