Compare commits
3 Commits
a6a30713e2
...
4684a8f80f
Author | SHA1 | Date | |
---|---|---|---|
4684a8f80f | |||
9b56239dce | |||
1e6e211903 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -16,3 +16,6 @@
|
||||
[submodule "eink/spi"]
|
||||
path = eink/spi
|
||||
url = git@git.blackmark.me:avr/spi.git
|
||||
[submodule "eink/avr-libstdcpp"]
|
||||
path = eink/avr-libstdcpp
|
||||
url = git@github.com:modm-io/avr-libstdcpp.git
|
||||
|
159
eink/Makefile
Normal file
159
eink/Makefile
Normal file
@ -0,0 +1,159 @@
|
||||
# Makefile for AVR C++ projects
|
||||
# From: https://gist.github.com/rynr/72734da4b8c7b962aa65
|
||||
|
||||
# ----- Update the settings of your project here -----
|
||||
|
||||
# Hardware
|
||||
MCU = atmega328p
|
||||
AVRDUDE_PARAMS = -c atmelice_isp
|
||||
FUSES = -U lfuse:w:0xff:m -U hfuse:w:0xd7:m -U efuse:w:0xfd:m
|
||||
|
||||
# Parameters
|
||||
PROJECT = $(lastword $(subst /, ,$(CURDIR)))
|
||||
INCS = -isystem avr-libstdcpp/include
|
||||
LIBS =
|
||||
DEFS = -DNDEBUG
|
||||
|
||||
# ----- These configurations are quite likely not to be changed -----
|
||||
|
||||
# Binaries
|
||||
GCC = avr-gcc
|
||||
G++ = avr-g++
|
||||
RM = rm -f
|
||||
AVRDUDE = avrdude
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
SIZE = avr-size
|
||||
|
||||
# Files
|
||||
EXT_C = c
|
||||
EXT_C++ = cpp
|
||||
EXT_ASM = asm
|
||||
|
||||
# ----- No changes should be necessary below this line -----
|
||||
|
||||
OBJECTS = \
|
||||
$(patsubst %.$(EXT_C),%.o,$(wildcard *.$(EXT_C)) $(wildcard **/*.$(EXT_C))) \
|
||||
$(patsubst %.$(EXT_C++),%.o,$(wildcard *.$(EXT_C++)) $(wildcard **/*.$(EXT_C++))) \
|
||||
$(patsubst %.$(EXT_ASM),%.o,$(wildcard *.$(EXT_ASM)) $(wildcard **/*.$(EXT_ASM)))
|
||||
|
||||
# Linker and compiler flags
|
||||
LDFLAGS = $(LIBS)
|
||||
LDFLAGS += -Wl,-Map=$(PROJECT).map
|
||||
LDFLAGS += -Wl,--gc-sections -mrelax
|
||||
|
||||
CFLAGS = $(INCS)
|
||||
CFLAGS += $(DEFS)
|
||||
CFLAGS += -Os
|
||||
CFLAGS += -std=c17
|
||||
CFLAGS += -funsigned-char -funsigned-bitfields -fshort-enums -ffunction-sections -fdata-sections -fno-threadsafe-statics -mrelax
|
||||
CFLAGS += -Wall -Wextra -pedantic -Wstrict-prototypes
|
||||
CFLAGS += -mmcu=$(MCU)
|
||||
|
||||
C++FLAGS = $(INCS)
|
||||
C++FLAGS += $(DEFS)
|
||||
C++FLAGS += -Os
|
||||
C++FLAGS += -std=c++20
|
||||
C++FLAGS += -funsigned-char -funsigned-bitfields -fshort-enums -ffunction-sections -fdata-sections -fno-threadsafe-statics -mrelax
|
||||
C++FLAGS += -Wall -Wextra -pedantic -Wno-array-bounds
|
||||
C++FLAGS += -mmcu=$(MCU)
|
||||
|
||||
ASMFLAGS = $(INCS)
|
||||
ASMFLAGS += $(DEFS)
|
||||
ASMFLAGS += -Os
|
||||
ASMFLAGS += -funsigned-char -funsigned-bitfields -fshort-enums -ffunction-sections -fdata-sections -fno-threadsafe-statics -mrelax
|
||||
ASMFLAGS += -Wall -Wextra -pedantic -Wstrict-prototypes
|
||||
ASMFLAGS += -x assembler-with-cpp
|
||||
ASMFLAGS += -mmcu=$(MCU)
|
||||
|
||||
all: $(PROJECT).elf $(OBJECTS) $(PROJECT).hex $(PROJECT).srec $(PROJECT).eeprom $(PROJECT).lss
|
||||
$(SIZE) -C --mcu=$(MCU) $(PROJECT).elf
|
||||
|
||||
%.elf: $(OBJECTS)
|
||||
$(GCC) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.$(EXT_C)
|
||||
$(GCC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.$(EXT_C++)
|
||||
$(G++) $(C++FLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.$(EXT_ASM)
|
||||
$(G++) $(ASMFLAGS) -c $< -o $@
|
||||
|
||||
%.hex: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O srec $< $@
|
||||
|
||||
%.eeprom: %.elf
|
||||
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
|
||||
|
||||
%.lss: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
clean:
|
||||
$(RM) $(PROJECT).elf $(OBJECTS) $(PROJECT).hex $(PROJECT).srec $(PROJECT).eeprom $(PROJECT).lss $(PROJECT).map
|
||||
|
||||
flash: $(PROJECT).hex
|
||||
sudo $(AVRDUDE) $(AVRDUDE_PARAMS) -p $(MCU) -U flash:w:$<:i
|
||||
|
||||
flash-eeprom: $(PROJECT).eeprom
|
||||
sudo $(AVRDUDE) $(AVRDUDE_PARAMS) -p $(MCU) -U eeprom:w:$<:i
|
||||
|
||||
flash-fuses:
|
||||
sudo $(AVRDUDE) $(AVRDUDE_PARAMS) -p $(MCU) $(FUSES)
|
||||
|
||||
flash-erase:
|
||||
sudo $(AVRDUDE) $(AVRDUDE_PARAMS) -p $(MCU) -e
|
||||
|
||||
help:
|
||||
@echo "usage:"
|
||||
@echo " make <target>"
|
||||
@echo ""
|
||||
@echo "targets:"
|
||||
@echo " all Builds everything"
|
||||
@echo " clean Remove any non-source files"
|
||||
@echo " flash Flashes firmware"
|
||||
@echo " flash-eeprom Flashes eeprom"
|
||||
@echo " flash-fuses Flashes fuses"
|
||||
@echo " flash-erase Erases entire chip including eeprom"
|
||||
@echo " help Shows this help"
|
||||
@echo " config Shows the current configuration"
|
||||
@echo " show-mcu Show list of all possible MCUs"
|
||||
|
||||
config:
|
||||
@echo "configuration:"
|
||||
@echo ""
|
||||
@echo "Binaries for:"
|
||||
@echo " C compiler: $(GCC)"
|
||||
@echo " C++ compiler: $(G++)"
|
||||
@echo " remove files $(RM)"
|
||||
@echo " Programmer: $(AVRDUDE)"
|
||||
@echo " Obj copier: $(OBJCOPY)"
|
||||
@echo " Obj dumper: $(OBJDUMP)"
|
||||
@echo " Size calc: $(SIZE)"
|
||||
@echo ""
|
||||
@echo "Hardware settings:"
|
||||
@echo " MCU: $(MCU)"
|
||||
@echo " Avrdude params: $(AVRDUDE_PARAMS)"
|
||||
@echo " Fuses: $(FUSES)"
|
||||
@echo ""
|
||||
@echo "Project settings:"
|
||||
@echo " Project name: $(PROJECT)"
|
||||
@echo " Include dirs: $(INCS)"
|
||||
@echo " Library dirs: $(LIBS)"
|
||||
@echo " Preprocessor defs: $(DEFS)"
|
||||
@echo " C compiler flags: $(CFLAGS)"
|
||||
@echo " C++ compiler flags: $(C++FLAGS)"
|
||||
@echo " ASM compiler flags: $(ASMFLAGS)"
|
||||
@echo " Linker flags: $(LDFLAGS)"
|
||||
@echo ""
|
||||
@echo "Defaults:"
|
||||
@echo " C-files: *.$(EXT_C)"
|
||||
@echo " C++-files: *.$(EXT_C++)"
|
||||
@echo " ASM-files: *.$(EXT_ASM)"
|
||||
|
||||
show-mcu:
|
||||
$(G++) --target-help
|
1
eink/avr-libstdcpp
Submodule
1
eink/avr-libstdcpp
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d289637d14cb9928a3690be4f2934aa2920f0f38
|
@ -15,7 +15,7 @@
|
||||
<AssemblyName>eink</AssemblyName>
|
||||
<Name>eink</Name>
|
||||
<RootNamespace>eink</RootNamespace>
|
||||
<ToolchainFlavour>avr-g++-9.1.0</ToolchainFlavour>
|
||||
<ToolchainFlavour>avr-g++-12.1.0</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
@ -123,7 +123,7 @@
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.compiler.warnings.ExtraWarnings>True</avrgcc.compiler.warnings.ExtraWarnings>
|
||||
<avrgcc.compiler.warnings.Pedantic>True</avrgcc.compiler.warnings.Pedantic>
|
||||
<avrgcc.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -std=c11</avrgcc.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcc.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -std=c17</avrgcc.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
||||
@ -140,7 +140,7 @@
|
||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -Wno-array-bounds -std=c++20 -isystem"%24(ProjectDir)/avr-libstdcpp/include"</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
@ -181,7 +181,7 @@
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.compiler.warnings.ExtraWarnings>True</avrgcc.compiler.warnings.ExtraWarnings>
|
||||
<avrgcc.compiler.warnings.Pedantic>True</avrgcc.compiler.warnings.Pedantic>
|
||||
<avrgcc.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -std=c11</avrgcc.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcc.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -std=c17</avrgcc.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
||||
@ -194,12 +194,12 @@
|
||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.346\include</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.compiler.directories.IncludePaths>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcccpp.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.optimization.DebugLevel>Maximum (-g3)</avrgcccpp.compiler.optimization.DebugLevel>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++20 -isystem"%24(ProjectDir)/avr-libstdcpp/include"</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
|
2
eink/io
2
eink/io
@ -1 +1 @@
|
||||
Subproject commit d89322bdaae6c08bedc65209373e0a1fc5c9af05
|
||||
Subproject commit bf94ebaac143c2a6f48abcd99573547030ce1bd8
|
@ -1,18 +1,19 @@
|
||||
#include "clock.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "eink/eink.hpp"
|
||||
#include "flash/flash.hpp"
|
||||
#include "io/io.hpp"
|
||||
#include "spi/spi.hpp"
|
||||
#include "uart/uart.hpp"
|
||||
#include "util/array.hpp"
|
||||
|
||||
using uart_t = uart::Uart0<>;
|
||||
REGISTER_UART0_INT_VECTORS(uart_t);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
constexpr auto IMAGE [[gnu::progmem]] = util::to_array<uint8_t>({
|
||||
constexpr auto IMAGE [[gnu::progmem]] = std::to_array<uint8_t>({
|
||||
0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x85, 0x79, 0x79, 0x79, 0x79, 0x79,
|
||||
0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79,
|
||||
0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x85, 0x79, 0x79, 0x79,
|
||||
|
2
eink/spi
2
eink/spi
@ -1 +1 @@
|
||||
Subproject commit 852ad5a3184ef6828e99b439fc078dd7ca83b5df
|
||||
Subproject commit 85346f258fd7cac32b4f4d9df0350b97b8e9d9e8
|
@ -1 +1 @@
|
||||
Subproject commit 119de3244588b19b4afb06f33f66f22bb80a89b5
|
||||
Subproject commit a5f8e8e3d7be26eaaeb5b29d44d02879bd5d36de
|
Loading…
Reference in New Issue
Block a user