ide: the whole project in Solution Explorer, and a path Studio can resolve

Three things the solution got wrong, all found by opening it in the GUI rather
than building it headlessly.

The project listed only main.cpp, so none of the headers could be opened from
Solution Explorer. Every source and header is listed now, with <Link> mirroring
the on-disk src/ layout, which is what master's project did.

Neither configuration compiled in the GUI: libavr was found through
$(LIBAVR_ROOT), and a variable exported in a shell is not visible to Studio
launched from the Start menu. Release only looked healthy because its objects
were already up to date from a headless build. The path is now anchored to the
project directory, which also side-steps a second trap: a plain relative include
is resolved against the generated makefile's own directory, the configuration's
output directory, not the project's. Pinning libavr as a submodule would remove
the assumption that the two sit side by side, and is on libavr's task list.

Both configurations verified with LIBAVR_ROOT deliberately unset, Release still
byte-identical to the CMake build and the flag gate still green. Debug's own
translation unit carries DWARF-4 as intended.

Studio's per-user state under ide/.vs/ and the build logs are ignored.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 19:19:20 +02:00
committed by BlackMark
parent 00849d25d5
commit 2cdf56f8d6
3 changed files with 65 additions and 9 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ build/
ide/*.componentinfo.xml ide/*.componentinfo.xml
ide/Debug/ ide/Debug/
ide/Release/ ide/Release/
ide/.vs/
ide/*.log

View File

@@ -23,18 +23,28 @@ cmake --build --preset atmega328p-generated
`master` carries a Studio solution, so this branch does too: `ide/fantemp.atsln` `master` carries a Studio solution, so this branch does too: `ide/fantemp.atsln`
builds the same firmware — byte-identical `.text` and `.data` to the CMake builds the same firmware — byte-identical `.text` and `.data` to the CMake
build — from the same sources, with the flags mirrored by hand. Studio finds build — from the same sources, with the flags mirrored by hand.
libavr through `$(LIBAVR_ROOT)`, the same environment variable the CMake build
uses, and needs a GCC 16.1 toolchain registered as flavour `avr-g++-16.1.0`; Studio expects libavr checked out **beside this repo**, and finds it at
`$(MSBuildProjectDirectory)\..\..\libavr\include` — anchored to the project
rather than written relative to the generated makefile, which runs from the
configuration's output directory and would need a different number of `..`.
Unlike the CMake build there is no `LIBAVR_ROOT` to point elsewhere: an
environment variable set in a shell is not visible to Studio launched from the
Start menu, which fails as a missing `libavr/libavr.hpp` rather than as anything
about the variable. Pinning libavr as a submodule is the better answer and is on
libavr's task list.
It also needs a GCC 16.1 toolchain registered as flavour `avr-g++-16.1.0`;
nothing older can compile `-std=c++26`. nothing older can compile `-std=c++26`.
One generated file is required before the project will load, and one command 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/`): checks the flags have not drifted (both from libavr's `tools/atmelstudio/`):
```sh ```sh
python $LIBAVR_ROOT/tools/atmelstudio/componentinfo.py \ python ../libavr/tools/atmelstudio/componentinfo.py \
ide/fantemp.componentinfo.xml --device ATmega328P ide/fantemp.componentinfo.xml --device ATmega328P
python $LIBAVR_ROOT/tools/atmelstudio/check-flags.py --solution ide/fantemp.atsln \ python ../libavr/tools/atmelstudio/check-flags.py --solution ide/fantemp.atsln \
--compile-commands build/atmega328p-generated/compile_commands.json \ --compile-commands build/atmega328p-generated/compile_commands.json \
--log build/atmelstudio.log --log build/atmelstudio.log
``` ```

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
@@ -28,6 +28,18 @@
<ResetRule>0</ResetRule> <ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule> <eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey /> <EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.52.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings> <ToolchainSettings>
@@ -45,7 +57,7 @@
</avrgcccpp.compiler.symbols.DefSymbols> </avrgcccpp.compiler.symbols.DefSymbols>
<avrgcccpp.compiler.directories.IncludePaths> <avrgcccpp.compiler.directories.IncludePaths>
<ListValues> <ListValues>
<Value>$(LIBAVR_ROOT)\include</Value> <Value>$(MSBuildProjectDirectory)\..\..\libavr\include</Value>
</ListValues> </ListValues>
</avrgcccpp.compiler.directories.IncludePaths> </avrgcccpp.compiler.directories.IncludePaths>
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level> <avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
@@ -74,7 +86,7 @@
</avrgcccpp.compiler.symbols.DefSymbols> </avrgcccpp.compiler.symbols.DefSymbols>
<avrgcccpp.compiler.directories.IncludePaths> <avrgcccpp.compiler.directories.IncludePaths>
<ListValues> <ListValues>
<Value>$(LIBAVR_ROOT)\include</Value> <Value>$(MSBuildProjectDirectory)\..\..\libavr\include</Value>
</ListValues> </ListValues>
</avrgcccpp.compiler.directories.IncludePaths> </avrgcccpp.compiler.directories.IncludePaths>
<avrgcccpp.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcccpp.compiler.optimization.level> <avrgcccpp.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcccpp.compiler.optimization.level>
@@ -88,9 +100,41 @@
</ToolchainSettings> </ToolchainSettings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\src\board.hpp">
<SubType>compile</SubType>
<Link>src\board.hpp</Link>
</Compile>
<Compile Include="..\src\bootloader.hpp">
<SubType>compile</SubType>
<Link>src\bootloader.hpp</Link>
</Compile>
<Compile Include="..\src\controller.hpp">
<SubType>compile</SubType>
<Link>src\controller.hpp</Link>
</Compile>
<Compile Include="..\src\curve.hpp">
<SubType>compile</SubType>
<Link>src\curve.hpp</Link>
</Compile>
<Compile Include="..\src\main.cpp"> <Compile Include="..\src\main.cpp">
<SubType>compile</SubType> <SubType>compile</SubType>
<Link>src\main.cpp</Link>
</Compile>
<Compile Include="..\src\statistics.hpp">
<SubType>compile</SubType>
<Link>src\statistics.hpp</Link>
</Compile>
<Compile Include="..\src\terminal.hpp">
<SubType>compile</SubType>
<Link>src\terminal.hpp</Link>
</Compile>
<Compile Include="..\src\thermistor.hpp">
<SubType>compile</SubType>
<Link>src\thermistor.hpp</Link>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="src" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\Vs\Compiler.targets" /> <Import Project="$(AVRSTUDIO_EXE_PATH)\Vs\Compiler.targets" />
</Project> </Project>