From a217465e651aeb3262015bfe0e49a2fc5d9bdfe2 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 25 Feb 2015 15:42:50 +0100 Subject: [PATCH] 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 --- Makefile-AVR | 1 + mendel.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile-AVR b/Makefile-AVR index 02a432c..4e0a0b9 100644 --- a/Makefile-AVR +++ b/Makefile-AVR @@ -114,6 +114,7 @@ TARGET = $(PROGRAM).hex SOURCES = $(wildcard *.c) CFLAGS += -DF_CPU=$(F_CPU) +CFLAGS += -DMCU_STR=\"$(MCU)\" CFLAGS += -mmcu=$(MCU) CFLAGS += -g CFLAGS += -Wall diff --git a/mendel.c b/mendel.c index dd9a99c..e581129 100644 --- a/mendel.c +++ b/mendel.c @@ -52,7 +52,7 @@ #ifdef SIMINFO #include "../simulavr/src/simulavr_info.h" - SIMINFO_DEVICE("atmega644"); + SIMINFO_DEVICE(MCU_STR); SIMINFO_CPUFREQUENCY(F_CPU); SIMINFO_SERIAL_IN("D0", "-", BAUD); SIMINFO_SERIAL_OUT("D1", "-", BAUD);