Just looking for a little advice on memory allocation.
I am using an STM32H7 processor with ITCM and DTCM ram. I am looking for speed and so I wish to put critical code in ITCM and critical data in DTCM.
I am setting up the MPU outside of the operating system and don’t wish to use FreeRTOS MPU features.
I had a look at the mpu_wrappers.h file and noticed the following code:
#define PRIVILEGED_FUNCTION #define PRIVILEGED_DATA #define FREERTOS_SYSTEM_CALL #define portUSING_MPU_WRAPPERS 0
I figured that if I do the following in this file then functions would be placed in ITCM and data would be placed in DTCM.
#define USE_DTCM __attribute__((section (".DTCM_MISC"))) //#define USE_DTCM #define USE_ITCM __attribute__((section(".ITCM_SECTION"))) //#define USE_ITCM #define PRIVILEGED_FUNCTION USE_ITCM #define PRIVILEGED_DATA USE_DTCM #define FREERTOS_SYSTEM_CALL #define portUSING_MPU_WRAPPERS 0
Where .ITCM_MISC and .DTCM_MISC are the definitions for the two memory regions as defined in the GCC linker script.
Is this method going to achieve my objective?
Is there a better way of doing it? In other words what would a real programmer do not a hacker like me?