From 00c9b1f9d0a1465df420147c1cf4395eab669441 Mon Sep 17 00:00:00 2001
From: Dimitrios Stoupis <dimitris.apple@gmail.com>
Date: Sun, 2 Dec 2018 14:01:39 +0000
Subject: [PATCH] Add platform specific memory address limits

---
 CMakeLists.txt                                 |  6 ++----
 .../ARM/MemoryAddressLimits_STM32F7.hpp        | 18 ++++++++++++++++++
 inc/Services/MemoryManagementService.hpp       | 16 +---------------
 test/Message.cpp                               |  2 +-
 4 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 inc/Platform/ARM/MemoryAddressLimits_STM32F7.hpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b2e3cac..3411d8ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,15 +22,13 @@ add_library(common OBJECT
         src/Services/MemoryManagementService.cpp
         src/Services/ParameterService.cpp
         src/Services/RequestVerificationService.cpp
-        src/Services/TestService.cpp
-        )
+        src/Services/TestService.cpp)
 
 # Specify the .cpp files for the executables
 add_executable(ecss_services
         src/main.cpp
         $<TARGET_OBJECTS:common>
-        src/Platform/x86/Service.cpp
-        )
+        src/Platform/x86/Service.cpp)
 
 IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt")
     # Gather all the .cpp files corresponding to tests
diff --git a/inc/Platform/ARM/MemoryAddressLimits_STM32F7.hpp b/inc/Platform/ARM/MemoryAddressLimits_STM32F7.hpp
new file mode 100644
index 00000000..e30651f9
--- /dev/null
+++ b/inc/Platform/ARM/MemoryAddressLimits_STM32F7.hpp
@@ -0,0 +1,18 @@
+#ifndef ECSS_SERVICES_MEMORYADDRESSLIMITS_STM32F7_HPP
+#define ECSS_SERVICES_MEMORYADDRESSLIMITS_STM32F7_HPP
+
+// Memory limits definitions
+#define DTCMRAM_LOWER_LIM 0x20000000UL
+#define DTCMRAM_UPPER_LIM 0x20020000UL
+#define ITCMRAM_LOWER_LIM 0x00000000UL
+#define ITCMRAM_UPPER_LIM 0x00010000UL
+#define RAM_D1_LOWER_LIM 0x24000000UL
+#define RAM_D1_UPPER_LIM 0x24080000UL
+#define RAM_D2_LOWER_LIM 0x30000000UL
+#define RAM_D2_UPPER_LIM 0x30048000UL
+#define RAM_D3_LOWER_LIM 0x38000000UL
+#define RAM_D3_UPPER_LIM 0x38010000UL
+#define FLASH_LOWER_LIM 0x08000000UL
+#define FLASH_UPPER_LIM 0x08200000UL
+
+#endif //ECSS_SERVICES_MEMORYADDRESSLIMITS_STM32F7_HPP
diff --git a/inc/Services/MemoryManagementService.hpp b/inc/Services/MemoryManagementService.hpp
index 98f8dfcb..04b82019 100644
--- a/inc/Services/MemoryManagementService.hpp
+++ b/inc/Services/MemoryManagementService.hpp
@@ -1,26 +1,12 @@
 #ifndef ECSS_SERVICES_MEMMANGSERVICE_HPP
 #define ECSS_SERVICES_MEMMANGSERVICE_HPP
 
-// Memory limits definitions
-#define DTCMRAM_LOWER_LIM 0x20000000UL
-#define DTCMRAM_UPPER_LIM 0x20020000UL
-#define ITCMRAM_LOWER_LIM 0x00000000UL
-#define ITCMRAM_UPPER_LIM 0x00010000UL
-#define RAM_D1_LOWER_LIM 0x24000000UL
-#define RAM_D1_UPPER_LIM 0x24080000UL
-#define RAM_D2_LOWER_LIM 0x30000000UL
-#define RAM_D2_UPPER_LIM 0x30048000UL
-#define RAM_D3_LOWER_LIM 0x38000000UL
-#define RAM_D3_UPPER_LIM 0x38010000UL
-#define FLASH_LOWER_LIM 0x08000000UL
-#define FLASH_UPPER_LIM 0x08200000UL
-
-
 #include <memory>
 #include <iostream>
 #include "Service.hpp"
 #include "Services/RequestVerificationService.hpp"
 #include "Helpers/CRCHelper.hpp"
+#include "Platform/ARM/MemoryAddressLimits_STM32F7.hpp"
 
 
 class MemoryManagementService : public Service {
diff --git a/test/Message.cpp b/test/Message.cpp
index dce148d3..d31c2be2 100644
--- a/test/Message.cpp
+++ b/test/Message.cpp
@@ -134,7 +134,7 @@ TEST_CASE("Requirement 7.3.5 (Signed integer)", "[message][ecss]") {
 
 	SECTION("7.4.3") {
 		// Make sure the endianness of the message data is correct
-		// As per the ECSS standard, stored data should be big-endian. However, ARM and x86
+		// As per the ECSS standard, stored data should be big-endian. However, ARM and ARM
 		// processors store data in little endian format. As a result, special care needs to be
 		// taken for compliance.
 		CHECK(message.data[1] == 0xe4);
-- 
GitLab