feat(ex00): Full ex00
This commit is contained in:
parent
a107d84981
commit
39e535df0e
3 changed files with 46 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
*.o
|
||||
*.hex
|
||||
*.bin
|
||||
42
ex00/Makefile
Normal file
42
ex00/Makefile
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Makefile
|
||||
MCU=atmega328p
|
||||
F_CPU=16000000
|
||||
CC=avr-gcc
|
||||
OBJCOPY=avr-objcopy
|
||||
CFLAGS=-nostdlib -std=c99 -Wall -Wextra -g -Os -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I.
|
||||
TARGET=main
|
||||
SERIAL=-P /dev/ttyUSB0 -b 115200
|
||||
|
||||
SRC_DIR=.
|
||||
OBJ_DIR=build
|
||||
|
||||
SRC_FILES=main.c
|
||||
OBJ_FILES=$(patsubst %.c,%.o,$(SRC_FILES))
|
||||
|
||||
SRC=$(addprefix $(SRC_DIR)/,$(SRC_FILES))
|
||||
OBJ=$(addprefix $(OBJ_DIR)/,$(OBJ_FILES))
|
||||
|
||||
all: flash
|
||||
|
||||
re: fclean all
|
||||
|
||||
fclean: clean
|
||||
clean:
|
||||
rm -rf $(OBJ_DIR)
|
||||
rm -f $(TARGET).hex
|
||||
|
||||
hex: $(TARGET).hex
|
||||
|
||||
flash: hex
|
||||
avrdude -p $(MCU) -c arduino -U flash:w:$(TARGET).hex:i $(SERIAL)
|
||||
|
||||
$(OBJ_DIR)/$(TARGET).bin: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(OBJ) -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
mkdir -p $(shell dirname $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
$(TARGET).hex: $(OBJ_DIR)/$(TARGET).bin
|
||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
1
ex00/main.c
Normal file
1
ex00/main.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
int main(void) {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue