diff --git a/.gitignore b/.gitignore index a4fb4fb..1a659ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ build/ .cache/ + +# Atmel Studio: generated per machine, its build outputs, and per-user state +ide/*.componentinfo.xml +ide/Debug/ +ide/Release/ +ide/.vs/ +ide/*.log diff --git a/README.md b/README.md index a6f184b..2fade3e 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,37 @@ cmake --build --preset attiny85-generated Presets cover attiny85/atmega328p in both libavr modes (generated and 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. + +Studio expects libavr checked out **beside this repo** and finds it at +`$(MSBuildProjectDirectory)\..\..\libavr\include` — anchored to the project, +because a plain relative path is resolved against the generated makefile's +directory (the configuration's output directory), not the project's. There is no +`LIBAVR_ROOT` escape hatch: a variable exported in a shell is invisible to Studio +launched from the Start menu. It also needs a GCC 16.1 toolchain registered as +flavour `avr-g++-16.1.0`, nothing older reaching `-std=c++26`. + +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 +``` + +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 coherent bus transactions, and errors are reported instead of ignored. diff --git a/ide/ds3231.atsln b/ide/ds3231.atsln new file mode 100644 index 0000000..5a0b1d1 --- /dev/null +++ b/ide/ds3231.atsln @@ -0,0 +1,22 @@ + +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}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7B3E5A41-9C26-4D18-8F52-6A0D31C74BE9}.Debug|AVR.ActiveCfg = Debug|AVR + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ide/ds3231.cppproj b/ide/ds3231.cppproj new file mode 100644 index 0000000..3b0c555 --- /dev/null +++ b/ide/ds3231.cppproj @@ -0,0 +1,108 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.CPP + 7b3e5a41-9c26-4d18-8f52-6a0d31c74be9 + ATmega328P + none + Executable + CPP + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + ds3231 + ds3231 + ds3231 + avr-g++-16.1.0 + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 0 + 0 + + + + + + -mmcu=atmega328p + 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=atmega328p + 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 + + + + + + + + +