From 6e39a08139266d6aa750b544182f678b4b7e8537 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Mon, 2 Jan 2017 22:16:43 -0500 Subject: [PATCH] Fake registers, functions, values, and macros --- smoother/Makefile | 19 ++++++++++-- smoother/avr/interrupt.h | 3 ++ smoother/avr/io.h | 64 ++++++++++++++++++++++++++++++++++++++++ smoother/avr/pgmspace.h | 3 ++ smoother/avr/wdt.h | 0 smoother/util/delay.h | 3 ++ 6 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 smoother/avr/interrupt.h create mode 100644 smoother/avr/io.h create mode 100644 smoother/avr/pgmspace.h create mode 100644 smoother/avr/wdt.h create mode 100644 smoother/util/delay.h diff --git a/smoother/Makefile b/smoother/Makefile index c6f0b4f..f1ede92 100644 --- a/smoother/Makefile +++ b/smoother/Makefile @@ -32,7 +32,22 @@ VPATH = .. GCC_BIN = PROJECT = mbed_blinky -OBJECTS = src/main.o + +OBJECTS = \ + src/main.o \ + ../grbl/protocol.o \ + ../grbl/stepper.o \ + ../grbl/eeprom.o \ + ../grbl/settings.o \ + ../grbl/planner.o \ + ../grbl/nuts_bolts.o \ + ../grbl/limits.o \ + ../grbl/jog.o \ + ../grbl/print.o \ + ../grbl/probe.o \ + ../grbl/report.o \ + ../grbl/system.o \ + SYS_OBJECTS = mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/analogin_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/analogout_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/can_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/ethernet_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/gpio_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/gpio_irq_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/i2c_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/mbed_board.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/pinmap.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/port_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/pwmout_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/rtc_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/serial_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/sleep.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/spi_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/startup_LPC17xx.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/system_LPC17xx.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/us_ticker.o INCLUDE_PATHS = -I../. -I../src -I../mbed/. -I../mbed/TARGET_LPC1768 -I../mbed/TARGET_LPC1768/TARGET_NXP -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X/TARGET_MBED_LPC1768 -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X/device -I../mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM -I../mbed/drivers -I../mbed/hal -I../mbed/platform LIBRARY_PATHS = -L../mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM @@ -84,7 +99,7 @@ all: $(PROJECT).bin $(PROJECT).hex size .c.o: +@$(call MAKEDIR,$(dir $@)) - $(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CPPC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $< .cpp.o: +@$(call MAKEDIR,$(dir $@)) diff --git a/smoother/avr/interrupt.h b/smoother/avr/interrupt.h new file mode 100644 index 0000000..994261e --- /dev/null +++ b/smoother/avr/interrupt.h @@ -0,0 +1,3 @@ +#define ISR(f) void f() +inline void cli() {} +inline void sei() {} diff --git a/smoother/avr/io.h b/smoother/avr/io.h new file mode 100644 index 0000000..8edaaa1 --- /dev/null +++ b/smoother/avr/io.h @@ -0,0 +1,64 @@ +#include + +struct DummyReg { + operator uint8_t() {return 0;} + uint8_t operator=(uint8_t x) {return x;} + uint8_t operator&=(uint8_t x) {return *this = *this & x;} + uint8_t operator|=(uint8_t x) {return *this = *this | x;} +}; + +extern DummyReg DDRA; +extern DummyReg DDRB; +extern DummyReg DDRC; +extern DummyReg DDRD; + +extern DummyReg PORTA; +extern DummyReg PORTB; +extern DummyReg PORTC; +extern DummyReg PORTD; + +extern DummyReg PINA; +extern DummyReg PINB; +extern DummyReg PINC; +extern DummyReg PIND; + +extern DummyReg EEAR; +extern DummyReg EECR; +extern DummyReg EEDR; +extern DummyReg EEMPE; +extern DummyReg EEPE; +extern DummyReg OCIE0A; +extern DummyReg OCIE0B; +extern DummyReg OCIE1A; +extern DummyReg OCR1A; +extern DummyReg PCICR; +extern DummyReg PCIE0; +extern DummyReg PCIE1; +extern DummyReg PCMSK0; +extern DummyReg PCMSK1; +extern DummyReg SREG; +extern DummyReg TCCR0A; +extern DummyReg TCCR0B; +extern DummyReg TCCR0B; +extern DummyReg TCCR1A; +extern DummyReg TCCR1B; +extern DummyReg TCNT0; +extern DummyReg TIMSK0; +extern DummyReg TIMSK1; +extern DummyReg TOIE0; + +static const int COM1A0 = 0; +static const int COM1A1 = 0; +static const int COM1B0 = 0; +static const int COM1B1 = 0; +static const int CS01 = 0; +static const int CS10 = 0; +static const int CS11 = 0; +static const int CS12 = 0; +static const int EEMWE = 0; +static const int EERE = 0; +static const int EEWE = 0; +static const int WGM10 = 0; +static const int WGM11 = 0; +static const int WGM12 = 0; +static const int WGM13 = 0; diff --git a/smoother/avr/pgmspace.h b/smoother/avr/pgmspace.h new file mode 100644 index 0000000..2985548 --- /dev/null +++ b/smoother/avr/pgmspace.h @@ -0,0 +1,3 @@ +#define PSTR(s) s + +inline char pgm_read_byte_near(const char* p) {return *p;} diff --git a/smoother/avr/wdt.h b/smoother/avr/wdt.h new file mode 100644 index 0000000..e69de29 diff --git a/smoother/util/delay.h b/smoother/util/delay.h new file mode 100644 index 0000000..227e197 --- /dev/null +++ b/smoother/util/delay.h @@ -0,0 +1,3 @@ +#define F_CPU 1000000UL +inline void _delay_ms(double) {} +inline void _delay_us(double) {}