SIMINFO: fetch device name from Makefile / compile parameters.
It's also possible to do this by stringifying MCU, but this requires double redirection, which isn't easily readable in a .c file. For stringification, see the bottom example at https://gcc.gnu.org/onlinedocs/cpp/Stringification.html
This commit is contained in:
parent
1cc1cc5c14
commit
a217465e65
|
|
@ -114,6 +114,7 @@ TARGET = $(PROGRAM).hex
|
||||||
SOURCES = $(wildcard *.c)
|
SOURCES = $(wildcard *.c)
|
||||||
|
|
||||||
CFLAGS += -DF_CPU=$(F_CPU)
|
CFLAGS += -DF_CPU=$(F_CPU)
|
||||||
|
CFLAGS += -DMCU_STR=\"$(MCU)\"
|
||||||
CFLAGS += -mmcu=$(MCU)
|
CFLAGS += -mmcu=$(MCU)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
|
|
|
||||||
2
mendel.c
2
mendel.c
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
#ifdef SIMINFO
|
#ifdef SIMINFO
|
||||||
#include "../simulavr/src/simulavr_info.h"
|
#include "../simulavr/src/simulavr_info.h"
|
||||||
SIMINFO_DEVICE("atmega644");
|
SIMINFO_DEVICE(MCU_STR);
|
||||||
SIMINFO_CPUFREQUENCY(F_CPU);
|
SIMINFO_CPUFREQUENCY(F_CPU);
|
||||||
SIMINFO_SERIAL_IN("D0", "-", BAUD);
|
SIMINFO_SERIAL_IN("D0", "-", BAUD);
|
||||||
SIMINFO_SERIAL_OUT("D1", "-", BAUD);
|
SIMINFO_SERIAL_OUT("D1", "-", BAUD);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue