diff --git a/libs/rtemodel/src/RteTarget.cpp b/libs/rtemodel/src/RteTarget.cpp index 080b30b47..3dd7ea2f8 100644 --- a/libs/rtemodel/src/RteTarget.cpp +++ b/libs/rtemodel/src/RteTarget.cpp @@ -1778,10 +1778,12 @@ std::string RteTarget::GenerateRegionsHeaderContent() const } vector memRO; vector 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); } @@ -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); } @@ -1837,7 +1840,7 @@ std::string RteTarget::GenerateRegionsHeaderContent() const oss << "// Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>" << RteUtils::LF_STRING; oss << "// 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 << "// " << RteUtils::LF_STRING; return oss.str(); diff --git a/test/projects/RteTestM4/regions_RteTest_ARMCM4_FP_ref.h b/test/projects/RteTestM4/regions_RteTest_ARMCM4_FP_ref.h index 0b9be13d2..6d351cd5a 100644 --- a/test/projects/RteTestM4/regions_RteTest_ARMCM4_FP_ref.h +++ b/test/projects/RteTestM4/regions_RteTest_ARMCM4_FP_ref.h @@ -54,7 +54,7 @@ // Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> // Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> #define __STACK_SIZE 0x00000200 -#define __HEAP_SIZE 0x00000000 +#define __HEAP_SIZE 0x00000C00 // diff --git a/test/projects/RteTestM4/regions_RteTest_CM4_board_ref.h b/test/projects/RteTestM4/regions_RteTest_CM4_board_ref.h index 5c05e5685..9211c7d94 100644 --- a/test/projects/RteTestM4/regions_RteTest_CM4_board_ref.h +++ b/test/projects/RteTestM4/regions_RteTest_CM4_board_ref.h @@ -89,7 +89,7 @@ // Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> // Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> #define __STACK_SIZE 0x00000200 -#define __HEAP_SIZE 0x00000000 +#define __HEAP_SIZE 0x00000C00 // diff --git a/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest-Test-board_With.Memory.h b/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest-Test-board_With.Memory.h index 531eebd7a..a8ab6d6b1 100644 --- a/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest-Test-board_With.Memory.h +++ b/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest-Test-board_With.Memory.h @@ -89,7 +89,7 @@ // Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> // Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> #define __STACK_SIZE 0x00000200 -#define __HEAP_SIZE 0x00000000 +#define __HEAP_SIZE 0x00000C00 // diff --git a/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest_ARMCM3.h b/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest_ARMCM3.h index 6711b81d3..3f6fcd9bc 100644 --- a/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest_ARMCM3.h +++ b/tools/projmgr/test/data/TestSolution/LinkerOptions/ref/regions_RteTest_ARMCM3.h @@ -54,7 +54,7 @@ // Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> // Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> #define __STACK_SIZE 0x00000200 -#define __HEAP_SIZE 0x00000000 +#define __HEAP_SIZE 0x00000C00 //