+/EE445L
embedded systems
git clone https://git.julia.blue/+/EE445L
5c1089c
master
1SRCS = $( wildcard src/*.c) $( wildcard lib/*.c) 2OBJS = $( addprefix obj/,$( notdir $( SRCS:.c=.o))) 3 4# CC = arm-none-eabi-gcc 5CC = clang --target=thumbv7em-unknown-none-eabi -Wno-keyword-macro -fshort-enums 6STDLIB = /usr/arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc_nano.a 7STDLIB += /usr/arm-none-eabi/lib/thumb/v7e-m+fp/hard/libm.a 8STDLIB_HEADERS = /usr/arm-none-eabi/include 9 10CFLAGS = -ggdb -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -Wall -pedantic 11CFLAGS += -fdata-sections -ffunction-sections -MD -std=iso9899:2017 -c 12CFLAGS += -I$( STDLIB_HEADERS ) -mfloat-abi=hard -O0 13 14OPENOCD = openocd -c 'source [find board/ek-tm4c123gxl.cfg]' 15 16all : out/out.elf 17 18obj/%.o : src/%.c 19$( CC ) -o $ @ $ ^ -Iinc$( CFLAGS ) 20 21obj/%.o : lib/%.c 22$( CC ) -o $ @ $ ^ -Iinc$( CFLAGS ) 23 24out/out.elf : $( OBJS ) 25arm-none-eabi-ld -o $ @ $ ^ $( STDLIB ) --gc-sections -T ../tm4c.ld 26 27flash : out/out.elf 28$( OPENOCD ) -c "program out/out.elf verify exit" 29 30run : out/out.elf 31$( OPENOCD ) -c "program out/out.elf verify reset exit" 32 33uart : run 34screen /dev/ttyACM0 115200 35 36debug : flash 37gdb-multiarch out/out.elf-x ../debug.gdb 38 39debug_gui : flash 40gdbgui -g arm-none-eabi-gdb--gdb-args= "-command=../debug_gui.gdb" out/out.elf 41 42size : out/out.elf 43llvm-nm --demangle --print-size --size-sort --no-weak --radix=d \ 44 out/out.elf| cut -f 2,4-d ' ' | numfmt --field 1--to=iec \ 45--padding -6 | sed '/^0/d' 46 47disassemble : out/out.elf 48llvm-objdump out/out.elf-d -S -C --arch-name=thumb --no-show-raw-insn \ 49--no-leading-addr > out/disassembly.asm 50 51clean : 52 -rm -rf obj 53 -rm -rf out 54 55$( shell mkdir -p out) 56$( shell mkdir -p obj) 57 58.PHONY : all clean debug debug_gui flash run size