initial thingies
This commit is contained in:
commit
4ad293bd35
32
.vscode/c_cpp_properties.json
vendored
Normal file
32
.vscode/c_cpp_properties.json
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"includePath": [
|
||||||
|
"/usr/avr/include"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
|
"compilerPath": "/usr/lib64/ccache/clang",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AVR",
|
||||||
|
"intelliSenseMode": "${default}",
|
||||||
|
"compilerPath": "",
|
||||||
|
"cStandard": "${default}",
|
||||||
|
"cppStandard": "${default}",
|
||||||
|
"includePath": [],
|
||||||
|
"compilerArgs": [
|
||||||
|
"-g",
|
||||||
|
"-Os",
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-fpermissive",
|
||||||
|
"-fno-exceptions",
|
||||||
|
"-fno-threadsafe-statics",
|
||||||
|
"-pipe"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
46
Makefile
Normal file
46
Makefile
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
TARGET=main
|
||||||
|
MCU=atmega2560
|
||||||
|
SOURCES=main.c
|
||||||
|
|
||||||
|
PORT=/dev/ttyACM0
|
||||||
|
BAUD=115200
|
||||||
|
|
||||||
|
OBJECTS=$(SOURCES:.c=.o)
|
||||||
|
CFLAGS=-c -Os
|
||||||
|
LDFLAGS=
|
||||||
|
|
||||||
|
LIB=-L/usr/avr/lib
|
||||||
|
INC=-I/usr/avr/include
|
||||||
|
|
||||||
|
yeet: hex eeprom program clean
|
||||||
|
|
||||||
|
hex: $(TARGET).hex
|
||||||
|
|
||||||
|
eeprom: $(TARGET)_eeprom.hex
|
||||||
|
|
||||||
|
$(TARGET).hex: $(TARGET).elf
|
||||||
|
avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex
|
||||||
|
|
||||||
|
$(TARGET)_eeprom.hex: $(TARGET).elf
|
||||||
|
avr-objcopy -O ihex -j .eeprom --change-section-lma .eeprom=1 $(TARGET).elf $(TARGET)_eeprom.hex
|
||||||
|
|
||||||
|
$(TARGET).elf: $(OBJECTS)
|
||||||
|
avr-gcc $(LDFLAGS) $(INC) $(LIB) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
avr-gcc $(CFLAGS) $(INC) $(LIB) -mmcu=$(MCU) $< -o $@
|
||||||
|
|
||||||
|
size:
|
||||||
|
avr-size --mcu=$(MCU) -C $(TARGET).elf
|
||||||
|
|
||||||
|
program:
|
||||||
|
avrdude -p$(MCU) -P$(PORT) -b$(BAUD) -v -V -cwiring -D "-Uflash:w:$(TARGET).hex:i"
|
||||||
|
|
||||||
|
clean_tmp:
|
||||||
|
rm -rf *.o
|
||||||
|
rm -rf *.elf
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf *.o
|
||||||
|
rm -rf *.elf
|
||||||
|
rm -rf *.hex
|
Loading…
Reference in a new issue