diff --git a/.gitignore b/.gitignore index 1a659ff..1e8ed3f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,8 @@ build/ .cache/ # Atmel Studio: generated per machine, its build outputs, and per-user state -ide/*.componentinfo.xml -ide/Debug/ -ide/Release/ +ide/*/*.componentinfo.xml +ide/*/Debug/ +ide/*/Release/ ide/.vs/ ide/*.log diff --git a/README.md b/README.md index 2fade3e..89a2956 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,17 @@ reflect). The legacy yazoalfa-based driver lives on the `master` branch. ## Atmel Studio `master` carries a Studio solution, so this branch does too: `ide/ds3231.atsln` -builds `example/main.cpp` for the ATmega328P — the chip that solution targeted — -to a **byte-identical `.text`** (1242 B) against the CMake build, with the flags -mirrored by hand. One project, one chip: `avrdevice` is a project-level property -in Studio, so the attiny85 half of the presets has no equivalent here, and CMake -remains the build system. +builds `example/main.cpp` for both parts the presets cover, each to a +**byte-identical `.text`** against the CMake build — 1242 B on the ATmega328P, +1212 B on the ATtiny85 — with the flags mirrored by hand. CMake remains the +build system. + +`avrdevice` is a project-level property in Studio, so a part means a project, not +a configuration: `ide/atmega328p/` and `ide/attiny85/`. They need separate +directories rather than separate names — Studio builds into `/` whatever `OutputDirectory` says, so two projects sharing +one directory would also share one `example/main.o`, and building one after the +other without a rebuild would link the other part's object. Studio expects libavr checked out **beside this repo** and finds it at `$(MSBuildProjectDirectory)\..\..\libavr\include` — anchored to the project, @@ -45,15 +51,20 @@ One generated file is required before the project will load, and one command checks the flags have not drifted (both from libavr's `tools/atmelstudio/`): ```sh -python ../libavr/tools/atmelstudio/componentinfo.py \ - ide/ds3231.componentinfo.xml --device ATmega328P -python ../libavr/tools/atmelstudio/check-flags.py --solution ide/ds3231.atsln \ - --compile-commands build/atmega328p-generated/compile_commands.json \ - --log build/atmelstudio.log +for mcu in atmega328p attiny85; do + case $mcu in atmega328p) device=ATmega328P;; attiny85) device=ATtiny85;; esac + python ../libavr/tools/atmelstudio/componentinfo.py \ + "ide/$mcu/ds3231-$mcu.componentinfo.xml" --device "$device" + python ../libavr/tools/atmelstudio/check-flags.py --solution ide/ds3231.atsln \ + --project "ds3231-$mcu" \ + --compile-commands "build/$mcu-generated/compile_commands.json" \ + --log "build/as-$mcu.log" +done ``` -Release is what the gate compares, the presets defining no debug build; Debug -carries the `-Og -gdwarf-4` pair libavr's own debug preset uses. +One reference describes one part, hence `--project`. Release is what the gate +compares, the presets defining no debug build; Debug carries the `-Og +-gdwarf-4` pair libavr's own debug preset uses. Differences from legacy: weekday-rate alarms now actually set the DY bit (the old `setAlarmHelper` always cleared it), reads/writes are single diff --git a/ide/ds3231.cppproj b/ide/atmega328p/ds3231-atmega328p.cppproj similarity index 92% rename from ide/ds3231.cppproj rename to ide/atmega328p/ds3231-atmega328p.cppproj index 3b0c555..73a9112 100644 --- a/ide/ds3231.cppproj +++ b/ide/atmega328p/ds3231-atmega328p.cppproj @@ -12,8 +12,8 @@ $(MSBuildProjectName) .elf $(MSBuildProjectDirectory)\$(Configuration) - ds3231 - ds3231 + ds3231-atmega328p + ds3231-atmega328p ds3231 avr-g++-16.1.0 true @@ -45,8 +45,8 @@ - $(MSBuildProjectDirectory)\..\include - $(MSBuildProjectDirectory)\..\..\libavr\include + $(MSBuildProjectDirectory)\..\..\include + $(MSBuildProjectDirectory)\..\..\..\libavr\include Optimize for size (-Os) @@ -75,8 +75,8 @@ - $(MSBuildProjectDirectory)\..\include - $(MSBuildProjectDirectory)\..\..\libavr\include + $(MSBuildProjectDirectory)\..\..\include + $(MSBuildProjectDirectory)\..\..\..\libavr\include Optimize debugging experience (-Og) @@ -90,11 +90,11 @@ - + compile example\main.cpp - + compile include\ds3231\ds3231.hpp diff --git a/ide/attiny85/ds3231-attiny85.cppproj b/ide/attiny85/ds3231-attiny85.cppproj new file mode 100644 index 0000000..bd89e46 --- /dev/null +++ b/ide/attiny85/ds3231-attiny85.cppproj @@ -0,0 +1,108 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.CPP + 1d84c0f7-52b9-4a63-b7e1-9f2c48d5a306 + ATtiny85 + none + Executable + CPP + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + ds3231-attiny85 + ds3231-attiny85 + ds3231 + avr-g++-16.1.0 + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 0 + 0 + + + + + + -mmcu=attiny85 + True + True + True + True + False + + + NDEBUG + + + + + $(MSBuildProjectDirectory)\..\..\include + $(MSBuildProjectDirectory)\..\..\..\libavr\include + + + Optimize for size (-Os) + True + True + True + -std=c++26 -Wextra -mrelax -fno-exceptions -fno-rtti -fno-threadsafe-statics + True + -mrelax + + + + + + + -mmcu=attiny85 + True + True + True + True + False + + + DEBUG + + + + + $(MSBuildProjectDirectory)\..\..\include + $(MSBuildProjectDirectory)\..\..\..\libavr\include + + + Optimize debugging experience (-Og) + True + True + True + -std=c++26 -Wextra -mrelax -fno-exceptions -fno-rtti -fno-threadsafe-statics -gdwarf-4 + True + -mrelax + + + + + + compile + example\main.cpp + + + compile + include\ds3231\ds3231.hpp + + + + + + + + + diff --git a/ide/ds3231.atsln b/ide/ds3231.atsln index 5a0b1d1..b4a278c 100644 --- a/ide/ds3231.atsln +++ b/ide/ds3231.atsln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Atmel Studio Solution File, Format Version 11.00 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "ds3231", "ds3231.cppproj", "{7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}" +Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "ds3231-atmega328p", "atmega328p\ds3231-atmega328p.cppproj", "{7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}" +EndProject +Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "ds3231-attiny85", "attiny85\ds3231-attiny85.cppproj", "{1D84C0F7-52B9-4A63-B7E1-9F2C48D5A306}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}.Debug|AVR.Build.0 = Debug|AVR {7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}.Release|AVR.ActiveCfg = Release|AVR {7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}.Release|AVR.Build.0 = Release|AVR + {1D84C0F7-52B9-4A63-B7E1-9F2C48D5A306}.Debug|AVR.ActiveCfg = Debug|AVR + {1D84C0F7-52B9-4A63-B7E1-9F2C48D5A306}.Debug|AVR.Build.0 = Debug|AVR + {1D84C0F7-52B9-4A63-B7E1-9F2C48D5A306}.Release|AVR.ActiveCfg = Release|AVR + {1D84C0F7-52B9-4A63-B7E1-9F2C48D5A306}.Release|AVR.Build.0 = Release|AVR EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE