From 71ae941a09aec9e9841ddf273868e5be680e5599 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Mon, 11 Nov 2013 11:37:31 +0100 Subject: [PATCH] Add simulation info for SimulAVR. This shouldn't change the running binary at all, so it shouldn't harm. However, it allows to run Teacup inside SimulAVR and accessing Teacups' serial line through the console/terminal. For detailed instructions, see http://reprap.org/wiki/SimulAVR . --- Makefile-AVR | 9 ++++++++- mendel.c | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile-AVR b/Makefile-AVR index f021010..8be4173 100644 --- a/Makefile-AVR +++ b/Makefile-AVR @@ -127,7 +127,14 @@ CFLAGS += -finline-functions-called-once CFLAGS += -mcall-prologues LDFLAGS = -Wl,--as-needed -LDFLAGS += -Wl,--gc-sections +# Doesn't work for simulavr, can't allow dead code removal. +#LDFLAGS += -Wl,--gc-sections + +ifneq ($(realpath ../simulavr/src/simulavr_info.h),) + # Neccessary for simulavr support, doesn't hurt others. + CFLAGS += -DSIMINFO + LDFLAGS += -Wl,--section-start=.siminfo=0x900000 +endif LIBS = -lm diff --git a/mendel.c b/mendel.c index 019a38e..0cca0a0 100644 --- a/mendel.c +++ b/mendel.c @@ -50,6 +50,14 @@ #include "intercom.h" #include "simulator.h" +#ifdef SIMINFO + #include "../simulavr/src/simulavr_info.h" + SIMINFO_DEVICE("atmega644"); + SIMINFO_CPUFREQUENCY(F_CPU); + SIMINFO_SERIAL_IN("D0", "-", BAUD); + SIMINFO_SERIAL_OUT("D1", "-", BAUD); +#endif + /// initialise all I/O - set pins as input or output, turn off unused subsystems, etc void io_init(void) { // disable modules we don't use