Try to replace
public static List<ConfigVM> configsVM = new List<ConfigVM>();
for
public List<ConfigVM> configsVM {get;set}
Then initialize your list in the contructor
public TreeVM (){ configsVM = new List<ConfigVM> ();}
Do the same for the other class.
Then in your XAML try to do this:
<Grid x:Name="GridForTreeView" DataContext="{Binding vm:TreeVM}">
<TreeView x:Name="ComPortsTree"
ItemsSource="{Binding configsVM }" ItemTemplate= {StaticResource hierachTemplate} />
</Grid>
and in your hierarchical:
<HierarchicalDataTemplate x:Name="hierachTemplate" ItemsSource="{Binding comPortsVM }">
Guess that's it...give it a try