Linux上进行单片机开发
linux上可以使用sdcc进行单片机开发
ubuntu使用
apt-get install sdcc
即可安装。
附一个比较通用的Makefile
PRJ := test SRC := $(wildcard *.c) HEX := $(PRJ).hex IHX := obj/$(PRJ).ihx OBJ := $(foreach i, $(SRC), obj/$(i:.c=.rel)) MCU := -mmcs51 CC := sdcc $(MCU) AS := asx8051 #可能是sdas8051 LD := sdcc PACKIHX := packihx CFLAG := ASFLAG := -los LDFLAG := all: obj $(HEX) obj: @mkdir obj $(HEX): $(IHX) @echo "Create hex file ..." @$(PACKIHX) $< > $@ $(IHX): $(OBJ) @echo -ne "Linking ..." @$(LD) $(LDFLAG) $^ -o $@ @echo "OK" obj/%.rel: %.c @echo -ne "Compiling $< ..." @$(CC) -c $(CFLAG) $< -o $@
@echo "OK"
.PHONY: clean clean: @echo "Clear project ..." @-rm -f obj/* @echo "OK"