问题描述
我一直在学习 make 程序。我想通过 AtMega8 对 LCD 进行编程并使用 Makefile 对其进行编译。我写了这个基本代码:
man find
我写了这个 Makefile:
#ifndef __AVR_ATmega8__
#define __AVR_ATmega8__
#endif
#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
#include "hd44780.h"
int main(void)
{
lcd_init();
lcd_clrscr();
lcd_puts("Hello World");
while (1);
return 0;
}
编译时make显示错误:
all: main.hex clean
main.o: main.cpp hd44780.h
avr-gcc -Wall -Os -mmcu=atmega8 -c $< -o $@
main.elf: main.o
avr-gcc -Wall -Os -mmcu=atmega8 -o main.elf main.o
main.hex: main.elf
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size --format=avr --mcu=atmega8 main.elf
.PHONY: clean
clean:
rm main.o main.elf
有什么问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)