Compare commits

..
1 Commits
Author SHA1 Message Date
jimmy f5fbe735a4 Initial commit 2020-12-17 21:42:47 +00:00
10 changed files with 0 additions and 126 deletions

No files matched your search

-4
View File
@@ -1,4 +0,0 @@
*.hex
*.elf
*.bin
-3
View File
@@ -1,3 +0,0 @@
[submodule "test/usart"]
path = test/usart
url = https://git.chch.tech/avr/usart.git
-19
View File
@@ -1,19 +0,0 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/lib/avr/include/"
],
"defines": [
"__AVR_ATmega16__"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu18",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
-3
View File
@@ -1,3 +0,0 @@
{
"git.ignoreLimitWarning": true
}
-7
View File
@@ -1,7 +0,0 @@
#!/bin/sh
avrdude -p $1 -c $2 -t << END
write eeprom 0 $3
dump eeprom 0 16
quit
END
-38
View File
@@ -1,38 +0,0 @@
MCU?=atmega32
F_CPU=8000000
PROG?=dragon_jtag
DEBUGGER = dragon
PORT?=/dev/ttyUSB0
TYPE?=DEBUG
CC=avr-g++
OBJCOPY=avr-objcopy
CFLAGS=-Wall -g -O -mmcu=${MCU} -DF_CPU=${F_CPU} -I. -std=gnu++11 -D${TYPE} -Wno-write-strings
TARGET=main
SRCS=src/eeprom.cpp test/main.cpp test/usart/src/usart.cpp
default: build flash
build:
${CC} ${CFLAGS} -o bin/${TARGET}.bin ${SRCS}
${CC} ${CFLAGS} -o bin/${TARGET}.elf ${SRCS}
${OBJCOPY} -j .text -j .data -O ihex bin/${TARGET}.bin bin/${TARGET}.hex
flash:
avrdude -p ${MCU} -c ${PROG} -P ${PORT} ${BAUD} -U flash:w:bin/main.hex
clean:
rm -f bin/*
debug: flash avarice
avr-gdb -ex "target remote :4242" bin/main.elf
avarice:
sleep 1
avarice --file bin/main.elf --part ${MCU} --${DEBUGGER} :4242 &
term:
screen /dev/ttyUSB0 1000000
eeprom:
sh eeprom.sh
-28
View File
@@ -1,28 +0,0 @@
#include "eeprom.h"
namespace eeprom
{
void write(uint8_t address, uint8_t data) {
/* Wait for completion of previous write */
while(EECR & (1<<EEWE));
/* Set up address and data registers */
EEAR = address;
EEDR = data;
/* Write logical one to EEMWE */
EECR |= (1<<EEMWE);
/* Start eeprom write by setting EEWE */
EECR |= (1<<EEWE);
}
uint8_t read(uint8_t address) {
/* Wait for completion of previous write */
while(EECR & (1<<EEWE));
/* Set up address register */
EEAR = address;
/* Start eeprom read by writing EERE */
EECR |= (1<<EERE);
/* Return data from data register */
return EEDR;
}
} // namespace eeprom
-8
View File
@@ -1,8 +0,0 @@
#pragma once
#include <avr/io.h>
namespace eeprom
{
void write(uint8_t address, uint8_t data);
uint8_t read(uint8_t address);
} // namespace eeprom
-15
View File
@@ -1,15 +0,0 @@
#include "../src/eeprom.h"
#include "usart/src/usart.h"
#include <avr/io.h>
#include <util/delay.h>
int main() {
usart::init(1000000);
printf("\033[2J");
for(int i=0;i<16;i++)
printf("%i %x\n\r", i, eeprom::read(i));
DDRB |= (1<<PB3);
}
Submodule test/usart deleted from 05034f9256.