detect os and lsb release
This commit is contained in:
parent
edc636b5be
commit
e33119b119
30
Makefile
30
Makefile
@ -1,28 +1,22 @@
|
|||||||
# detect OS
|
# detect OS
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
RM = del /q
|
RM := del /q
|
||||||
|
COM := COM3
|
||||||
else
|
else
|
||||||
UNAME_S := $(shell uname -s)
|
RM =: rm -rf
|
||||||
ifeq ($(UNAME_S),Linux)
|
|
||||||
RM = rm -rf
|
UNAME_S := $(shell cat /etc/*-release | grep 'DISTRIB_ID' | sed 's/DISTRIB_ID=\(\w*\)/\1/g')
|
||||||
|
ifeq ($(UNAME_S),Ubuntu)
|
||||||
|
CC := sdcc
|
||||||
|
COM := /dev/ttyUSB0
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Deepin)
|
||||||
RM = rm -rf
|
CC := ablrun sdcc
|
||||||
|
COM := /dev/ttyUSB0
|
||||||
endif
|
endif
|
||||||
# UNAME_P := $(shell uname -p)
|
|
||||||
# ifeq ($(UNAME_P),x86_64)
|
|
||||||
# CCFLAGS += -D AMD64
|
|
||||||
# endif
|
|
||||||
# ifneq ($(filter %86,$(UNAME_P)),)
|
|
||||||
# CCFLAGS += -D IA32
|
|
||||||
# endif
|
|
||||||
# ifneq ($(filter arm%,$(UNAME_P)),)
|
|
||||||
# CCFLAGS += -D ARM
|
|
||||||
# endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# set CC TOOL
|
# set CC TOOL
|
||||||
CC := sdcc
|
|
||||||
PACKIHX := packihx
|
PACKIHX := packihx
|
||||||
CFLAGS := -DUSE_FLOATS=1
|
CFLAGS := -DUSE_FLOATS=1
|
||||||
|
|
||||||
@ -54,7 +48,7 @@ uart_temp.hex: $(TARGET)
|
|||||||
-$(PACKIHX) $(TARGET) > uart_temp.hex
|
-$(PACKIHX) $(TARGET) > uart_temp.hex
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
-stcgal -P stc89 -p COM3 .\uart_temp.hex
|
-stcgal -P stc89 -p $(COM) -d uart_temp.hex
|
||||||
|
|
||||||
#led.bin:led.hex
|
#led.bin:led.hex
|
||||||
# objcopy -I ihex -O binary led.hex led.bin
|
# objcopy -I ihex -O binary led.hex led.bin
|
||||||
|
12
src/main.c
12
src/main.c
@ -53,14 +53,14 @@ void main(void)
|
|||||||
smg_display(temp_buf,4);
|
smg_display(temp_buf,4);
|
||||||
|
|
||||||
// 串口打印
|
// 串口打印
|
||||||
if(pre_temp_value != temp_value){
|
// if(pre_temp_value != temp_value){
|
||||||
pre_temp_value = temp_value;
|
// pre_temp_value = temp_value;
|
||||||
printf("temp = %.1f\n", temp_value/10.0);
|
// printf("temp = %.1f\n", temp_value/10.0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// delay
|
// delay
|
||||||
// delay_ms(10);
|
delay_ms(1000);
|
||||||
// printf("temp = %.1f\n", temp_value/10.0);
|
printf("temp = %.1f\r\n", temp_value/10.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user