Skip to content

Commit

Permalink
[rtemodel] Adjust default heap in regions file according to total RAM
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored Sep 2, 2024
1 parent 804b635 commit ca01c9d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion libs/rtemodel/src/RteTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,12 @@ std::string RteTarget::GenerateRegionsHeaderContent() const
}
vector<RteItem*> memRO;
vector<RteItem*> memRW;
unsigned int totalRW = 0;
auto& deviceMems = device->GetEffectiveProperties("memory", GetProcessorName());
for (auto mem : deviceMems) {
if (mem->IsWriteAccess()) {
memRW.push_back(mem);
totalRW += stoul(mem->GetAttribute("size"), nullptr, 16);
} else {
memRO.push_back(mem);
}
Expand All @@ -1794,6 +1796,7 @@ std::string RteTarget::GenerateRegionsHeaderContent() const
for( auto mem : board->GetMemories(boardMemCollection)) {
if (mem->IsWriteAccess()) {
memRW.push_back(mem);
totalRW += stoul(mem->GetAttribute("size"), nullptr, 16);
} else {
memRO.push_back(mem);
}
Expand Down Expand Up @@ -1837,7 +1840,7 @@ std::string RteTarget::GenerateRegionsHeaderContent() const
oss << "// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>" << RteUtils::LF_STRING;
oss << "// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>" << RteUtils::LF_STRING;
oss << "#define __STACK_SIZE 0x00000200" << RteUtils::LF_STRING;
oss << "#define __HEAP_SIZE 0x00000000" << RteUtils::LF_STRING;
oss << "#define __HEAP_SIZE " << (totalRW >= 6144 ? "0x00000C00" : "0x00000000") << RteUtils::LF_STRING;
oss << "// </h>" << RteUtils::LF_STRING;

return oss.str();
Expand Down
2 changes: 1 addition & 1 deletion test/projects/RteTestM4/regions_RteTest_ARMCM4_FP_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00000200
#define __HEAP_SIZE 0x00000000
#define __HEAP_SIZE 0x00000C00
// </h>


Expand Down
2 changes: 1 addition & 1 deletion test/projects/RteTestM4/regions_RteTest_CM4_board_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00000200
#define __HEAP_SIZE 0x00000000
#define __HEAP_SIZE 0x00000C00
// </h>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00000200
#define __HEAP_SIZE 0x00000000
#define __HEAP_SIZE 0x00000C00
// </h>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00000200
#define __HEAP_SIZE 0x00000000
#define __HEAP_SIZE 0x00000C00
// </h>


Expand Down

0 comments on commit ca01c9d

Please sign in to comment.