Excluding a part of RAM, how to deny access from FreeRTOS

christoph-es wrote on Tuesday, June 05, 2018:

Hello there,
I reserved a small part (32 byte) of the RAM of my device. (0x2000 0000 - 0x2000 001F)
So in the linker-file I mapped the RAM starting at 0x2000 0020.
I can exclude accessing this addresses in my application code but I am not sure if the “remapping” of the RAM
prevents FreeRTOS to overwrite this addresses.
Does the FreeRTOS-Kernel has any possibilty to overwrite this part of the RAM?
I am using heap4.

Thank you in advance,
Christoph

richard_damon wrote on Tuesday, June 05, 2018:

FreeRTOS itself will only write to memory it has been told to. That would be memory allocated to it via globals, stack variables and allocated from the heap. If you have excluded the memory by the linker, then FreeRTOS itself won’t use it.
That said, if you program has an error, it could overwrite that memory as FreeRTOS won’t ‘protect’ that memory.

christoph-es wrote on Tuesday, June 05, 2018:

Hello Richard,
thank you for your fast response. Is there away to protect the memory with FreeRTOS without excluding it in the linker-file?

richard_damon wrote on Tuesday, June 05, 2018:

By definition, you are going to need a linker-file to tell the linker what to do and where it can place things. To reserve the memory, you are going to have to say something in the linker file to let the linker know not to put other things there.
There are several ways in the linker file to control how it does things.
The bluntest is what you describe, and just not tell the linker that memory is ram, and then it won’t use it.
You can normally also declare all of RAM space as RAM, but then within that there will be declerations for the various blocks of the various things that use ram, and you could add a decleration for a reserve block at the address you want, and that the ‘general’ block of ram follows.
The details will depend on the linker you are using.

christoph-es wrote on Wednesday, June 06, 2018:

Thank you very much for your help, I think this will improve the code.
Best regards,
Christoph