I am following appnote 316 to configure stack usage monitoring. Keil is giving an error "E405: Invalid statement" on the print element. As far as I can tell this is valid and correct.
How do I resolve this issue?
Thanks
As I mentioned, I am following app note 316 which is about creating a SCVD file to monitor stack usage. Here is the script. After adding the SCVD via the "component viewer" I get the XML parsing error mentioned. If the 2 "print lines are removed it works. This should be valid code.
<?xml version="1.0" encoding="utf-8"?> <component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd"> <component name="MyExample" version="1.0.0"/> <objects> <object name="SystemStack"> <var name="StackStart" type="int32_t" value="0" /> <var name="StackSize" type="int32_t" value="0" /> <var name="StackMax" type="int32_t" value="0" /> <var name="StackUsed" type="int32_t" value="0" /> <calc> StackStart = __FindSymbol ("STACK$$Base"); StackSize = __FindSymbol ("STACK$$Limit") - StackStart; StackMax = __CalcMemUsed(StackStart, StackSize, 0xCDCDCDCD, 0xABABABAB); StackUsed = __FindSymbol ("STACK$$Limit") - __GetRegVal("MSP"); </calc> <out name="SystemStack"> <item property="Start" value="%x[StackStart]"/> <item property="Size" value="%x[StackSize]" /> <item> <print cond="__Running == 0" property="Used" value="%d[StackUsed*100/StackSize]%% [%d[StackUsed]]" /> <print cond="__Running == 1" property="Used" value="unknown" /> </item> <item alert="(StackMax >> 31)" property="Max" value="%d[(StackMax>>20) & 0xFF]%% [%d[StackMax & 0xFFFFF]]" /> </out> </object> </objects> </component_viewer>
Thanks for the fast reply.
Are you running a recent version of the Keil tools?
If you look at the "Revision history" on this page:
https://www.keil.com/pack/doc/compiler/EventRecorder/html/index.html
You can see they added features to the standard as time went by. Perhaps your version of the tools pre-dated the print command?
I tested this in MDK v 5.28a available at keil.com/demo
We are using 5.22. I don't see in that table what version the PRINT feature was introduced.
Hi AJ,
on the revision history, I think print was part of the "Changed protocol version to 1.1. " update that happened in the V1.4.0. If you can use arm Compiler pack v 1.40 or later (came out in March 2018) you should have access to 'print'