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:
Markus Hitter 2015-02-25 15:42:50 +01:00
parent 1cc1cc5c14
commit a217465e65
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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);