Updated documentation.

This commit is contained in:
2022-07-29 13:28:13 +02:00
parent 57072f9ad0
commit d89f30e4ce
3 changed files with 19 additions and 7 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.vscode/
build/

View File

@@ -1,11 +1,19 @@
# Arduino C # Arduino C
Programming the Arduino in pure C. Programming the Arduino in pure C on Linux.
## Requirements
* arvdude
* arv-gcc
* avr-libc
## Compile and upload ## Compile and upload
Run using the following command (example port): Run using the following command (example port):
``` ```
sudo ./compile /dev/ttyUSB0 sudo ./compile.sh /dev/ttyUSB0
``` ```
The port can be found by looking inside `/dev`, the system file `ll /sys/class/tty/ttyUSB*`, or by running `lsusb`.

View File

@@ -14,17 +14,19 @@ echo "BAUD set to $BAUD"
rm -rf build || true rm -rf build || true
mkdir build mkdir build
# compile files
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/servo.o -Wall servo/servo.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/servo.o -Wall servo/servo.c
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/rf24.o -Wall rf24/rf24.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/rf24.o -Wall rf24/rf24.c
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/util.o -Wall ard/util.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/util.o -Wall ard/util.c
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/serial.o -Wall ard/serial.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/serial.o -Wall ard/serial.c
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/pins.o -Wall ard/pins.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/pins.o -Wall ard/pins.c
avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/main.o -Wall main.c avr-gcc -Os -DF_CPU=16000000UL -mmcu=$MMCU -c -o build/main.o -Wall main.c
# compile binary
avr-gcc -mmcu=$MMCU build/*.o -o build/main avr-gcc -mmcu=$MMCU build/*.o -o build/main
avr-objcopy -O ihex -R .eeprom build/main build/main.hex
avrdude -F -V -c arduino -p $AVR_TYPE -P $1 -b $BAUD -U flash:w:build/main.hex
rm -r build # create file to upload to arduino
avr-objcopy -O ihex -R .eeprom build/main build/main.hex
# upload to arduino
avrdude -F -V -c arduino -p $AVR_TYPE -P $1 -b $BAUD -U flash:w:build/main.hex