嗨害嗨

分类 随便看看 下的文章

20/9
2023

一种适用于51单片机的sdcc makefile编译脚本

首先安装好sdcc并设置好环境变量

NAME="main"
CLEAN=DEL
DEL=del
RM=rm -rf

z_sdcc=sdcc
z_packihx=packihx
z_makebin=makebin


$NAME.hex: main.rel uart.rel
    ${z_sdcc} main.rel uart.rel
    ${z_packihx} main.ihx > main.hex
    ${z_makebin} -p main.ihx main.bin

uart.rel: .\src\uart.h .\src\uart.c
                z_sdcc -c .\src\uart.c -Isrc

main.rel: .\src\uart.h .\src\STC15Fxxxx.h .\src\main.c
                z_sdcc -c .\src\main.c -Isrc

clean:

    ${CLEAN} *.asm *.lst *.mem *.rst *.lnk *.rel *.sym *.ihx *.hex *.map *.lk *.bin

+ MORE