@@ -194,43 +194,45 @@ bool ValidateSemantic::OutputDepResults(const RteDependencyResult& dependencyRes
194194 * @param device RteDeviceItem to run on
195195 * @return passed / failed
196196 */
197- bool ValidateSemantic::CheckMemory (RteDeviceItem* device)
197+ bool ValidateSemantic::CheckMemories (RteDeviceItem* device)
198198{
199199 string devName = device->GetName ();
200200
201201 list<RteDeviceProperty*> processors;
202202 device->GetEffectiveProcessors (processors);
203- for (auto proc : processors) {
204- const string& pName = proc ->GetName ();
203+ for (auto processor : processors) {
204+ const string& pName = processor ->GetName ();
205205 if (!pName.empty ()) {
206206 devName += " :" ;
207207 devName += pName;
208208 }
209209
210- LogMsg (" M071" , NAME (devName), proc ->GetLineNumber ());
210+ LogMsg (" M071" , NAME (devName), processor ->GetLineNumber ());
211211
212- const list<RteDeviceProperty*>& propGroup = device->GetEffectiveProperties (" memory" , pName);
213- if (propGroup .empty ()) {
212+ const list<RteDeviceProperty*>& memories = device->GetEffectiveProperties (" memory" , pName);
213+ if (memories .empty ()) {
214214 LogMsg (" M312" , TAG (" memory" ), NAME (device->GetName ()), device->GetLineNumber ());
215215 return false ;
216216 }
217217
218- map<const string, RteDeviceProperty*> propNameCheck;
219- for (auto prop : propGroup) {
220- const string& id = prop->GetEffectiveAttribute (" id" );
221- const string& name = prop->GetEffectiveAttribute (" name" );
222- const string& access = prop->GetEffectiveAttribute (" access" );
223- const string& start = prop->GetEffectiveAttribute (" start" );
224- const string& size = prop->GetEffectiveAttribute (" size" );
225- const string& pname = prop->GetEffectiveAttribute (" pname" );
226- int lineNo = prop->GetLineNumber ();
227-
228- string key = name.empty () ? id : name;
218+ map<const string, RteDeviceProperty*> memoryNameCheck;
219+ list<RteDeviceProperty*> rxRegionWithStartup;
220+
221+ for (auto memory : memories) {
222+ int lineNo = memory->GetLineNumber ();
223+ const string& id = memory->GetEffectiveAttribute (" id" );
224+ const string& name = memory->GetEffectiveAttribute (" name" );
225+ const string& access = memory->GetEffectiveAttribute (" access" );
226+ const string& start = memory->GetEffectiveAttribute (" start" );
227+ const string& size = memory->GetEffectiveAttribute (" size" );
228+ const string& pname = memory->GetEffectiveAttribute (" pname" );
229+ const string& startup = memory->GetEffectiveAttribute (" startup" );
230+
231+ string memoryName = name.empty () ? id : name;
229232 if (!pname.empty ()) {
230- key += " :" + pname;
233+ memoryName += " :" + pname;
231234 }
232-
233- LogMsg (" M070" , NAME (key), NAME2 (devName), lineNo); // Checking Memory '%NAME%' for device '%NAME2%'
235+ LogMsg (" M070" , NAME (memoryName), NAME2 (devName), lineNo); // Checking Memory '%NAME%' for device '%NAME2%'
234236
235237 if (id.empty ()) { // new description, where 'name' is just a string and 'access' describes the permissions
236238 if (name.empty () && access.empty ()) {
@@ -262,19 +264,32 @@ bool ValidateSemantic::CheckMemory(RteDeviceItem* device)
262264 LogMsg (" M308" , TAG (" size" ), TAG2 (" memory" ), lineNo); // Attribute '%TAG%' missing
263265 }
264266
265- if (!key .empty ()) {
266- auto propNameCheckIt = propNameCheck .find (key );
267- if (propNameCheckIt != propNameCheck .end ()) {
267+ if (!memoryName .empty ()) {
268+ auto propNameCheckIt = memoryNameCheck .find (memoryName );
269+ if (propNameCheckIt != memoryNameCheck .end ()) {
268270 RteDeviceProperty* propFound = propNameCheckIt->second ;
269271 if (propFound) {
270- LogMsg (" M311" , TAG (" memory" ), NAME (key ), LINE (propFound->GetLineNumber ()), lineNo);
272+ LogMsg (" M311" , TAG (" memory" ), NAME (memoryName ), LINE (propFound->GetLineNumber ()), lineNo);
271273 }
272274 }
273275 else {
274- propNameCheck[key] = prop;
276+ memoryNameCheck[memoryName] = memory;
277+ }
278+ }
279+
280+ // Check startup attribute
281+ if (startup == " 1" ) {
282+ rxRegionWithStartup.push_back (memory);
283+ if (access.find_first_of (" x" ) == string::npos) {
284+ LogMsg (" M608" , NAME (memoryName), ATTR (" startup" ), VALUE (" 1" ), ATTR2 (" access" ), VALUE2 (" x" ), lineNo);
275285 }
276286 }
277287 }
288+
289+ const int numOfMemories = rxRegionWithStartup.size ();
290+ if (!numOfMemories || numOfMemories > 1 ) {
291+ LogMsg (" M609" , NAME (devName), NUM (numOfMemories), processor->GetLineNumber ());
292+ }
278293 }
279294
280295 return true ;
@@ -562,7 +577,6 @@ bool ValidateSemantic::CheckDeviceDependencies(RteDeviceItem *device, RteProject
562577 int lineNo = device->GetLineNumber ();
563578
564579 CheckForUnsupportedChars (mcuName, " Dname" , lineNo);
565- CheckMemory (device);
566580
567581 XmlItem deviceStartup;
568582 deviceStartup.SetAttribute (" Cclass" , " Device" );
@@ -842,6 +856,7 @@ bool ValidateSemantic::TestMcuDependencies(RtePackage* pKg)
842856 pKg->GetEffectiveDeviceItems (devices);
843857 for (auto device : devices) {
844858 CheckDeviceDependencies (device, rteProject);
859+ CheckMemories (device);
845860 CheckDeviceAttributes (device);
846861 }
847862
0 commit comments