Visual Micro: Memory Usage information doesn't show in Ouput since TD 1.62

Sam Halvoe

Active member
Hello,
I use Visual Micro with Arduino IDE 2.3.10. In Visual Micro the Memory Usage information isn't shown in the Output since TeensyDuino 1.62.
In Arduino IDE 2 it is still present. For instance:
Code:
Memory Usage on Teensy 4.1:
  FLASH: code:38924, data:7112, headers:8232   free for files:8072196
   RAM1: variables:7968, code:36376, padding:29160   free for local variables:450784
   RAM2: variables:12416  free for malloc/new:511872
Output like this is missing in Visual Micro since TD 1.62.
Can you have a look what's wrong? Tell me if you need additional information.
Many thanks in advance.
Sam Halvoe
 
Starting with 1.62 we began using the "recipe.advanced_size.pattern" feature of Arduino CLI, which has JSON format rather than simple plain text. This fixed a long-standing problem on Arduino IDE 2 where the size info always appeared in red color, even when it was not any sort of error.

My best guess is Visual Micro doesn't implement platform.txt "recipe.advanced_size.pattern"? Or maybe it does, but use of stdin vs stderr might be a problem? Or maybe it does run teensy_size and receives data, but can't handle the JSON format?

I personally can't investigate the Visual Micro side, as I don't really use Windows and I have no direct experience using Visual Micro. But I can give more detailed info about the Teensy software. Hopefully this might be helpful for anyone from Visual Micro who wants to investigate. Might be best to ask on their forum or contact Visual Micro directly and give them a link to this forum conversation.

The advanced size JSON format is part of the Arduino Platform Specification. That page is lengthy, but a quick text search on that page for "advanced_size" will take you right to the info. This is the new line in Teensy's platform.txt file:

Code:
recipe.advanced_size.pattern="{teensytools.path}teensy_size" --json "{build.path}/{build.project_name}.elf"

You can see the teensy_size program has an optional "--json" command line parameter which causes it to give the JSON output format. If you run teensy_size without "--json", it will give output at simple plain text.

In fact, when using Arduino IDE 1.8.x, the Teensyduino installer writes a slightly different platform.txt file. It has this line:

Code:
recipe.hooks.postbuild.3.pattern="{teensytools.path}teensy_size" "{build.path}/{build.project_name}.elf"

If you look closely at Teensy's platform.txt, you'll see both are present but the command for the other software is commented out.

Another subtle detail is stdout vs stderr. The JSON output is sent to stdout. But plain text is sent to stderr, because Arduino IDE ignores stdout when File > Preferences is not set to verbose output during compile. Likewise, Arduino CLI replicated that behavior, which is the reason we've had to endure red text appearance in Arduino IDE 2.x.x. The Arduino developers added the advanced_size recipe specifically for this situation. The JSON data is always expected on stdout.

Hopefully future Visual Micro will become able to implement "recipe.advanced_size.pattern" as Arduino CLI does.

But one possible quick fix would be to edit the platform.txt file on your PC. Just delete the "recipe.advanced_size.pattern" line and uncomment the "recipe.hooks.postbuild.3.pattern" line that's meant for Arduino IDE 1.8.x.
 
Thank you for the comprehensive response. :)
I make post on the Visual Micro forum with this information.
 
Back
Top