# (C) 2020 Philip Endecott. # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENCE.txt or copy at https://www.boost.org/LICENSE_1_0.txt ARCH=arm-none-eabi CPU=arm7tdmi-s AS=${ARCH}-as CFLAGS=-mcpu=${CPU} CC=${ARCH}-gcc CFLAGS=-mcpu=${CPU} -mthumb -Os -W -Wall -DRAD_CONTROLLER # -DENABLE_DEBUG CXX=${ARCH}-g++ CXXFLAGS=${CFLAGS} --std=c++17 -fno-exceptions LD=${ARCH}-ld NEWLIBDIR=/usr/lib/${ARCH}/newlib/thumb # There are several newlib buils for different architecture variants, all # installed by the Debian package; this one seems to be armv4t. GCCLIBDIR=/usr/lib/gcc/${ARCH}/7.3.1/thumb LDFLAGS=-L${NEWLIBDIR} -L${GCCLIBDIR} OBJCOPY=${ARCH}-objcopy %.o: %.s ${AS} ${ASFLAGS} -o $@ $< %.o: %.c ${CC} ${CFLAGS} -c $< %.o: %.cc ${CXX} ${CXXFLAGS} -c $< %.elf: %.o vectors.o start.o stubs.o lipstick.ld ${LD} --script=lipstick.ld -o $@ ${LDFLAGS} vectors.o start.o $< --start-group -lc stubs.o -lgcc --end-group %.hex: %.elf ${OBJCOPY} $< -O ihex $@ BAUD=38400 PORT=/dev/ttyUSB0 %.prog: %.hex lpc21isp $< ${PORT} ${BAUD} 19660 %.progterm: %.hex lpc21isp -term $< ${PORT} ${BAUD} 19660 .SECONDARY: # Causes all intermediates, i.e. .o and .elf files, to be kept. .PHONY: %.prog %.progterm hello_world.o: registers.hh demo.o: adc.hh arm.hh clocks.hh registers.hh rtc.hh uart.hh circular_buffer.hh modbus.o: adc.hh arm.hh clocks.hh registers.hh rtc.hh uart.hh buffer.hh timer.hh wdt.hh power.hh