cancel
Showing results for 
Search instead for 
Did you mean: 

Pointer Optimization

benoit2
Associate II
Posted on October 09, 2014 at 15:45

Hi everyone,

I'm working on an STM32F427 on a program with a huge linked list. I want to decrease the size of pointers used in this list in order to increase the number of elements in my ram.

For instance, the memory mapping says that regular ram is located between 0x20000000 to 0x2002FFFF and CCM ram between 0x10000000 and 0x1000FFFF.

So for example if i want to use the CCM ram for my linked list can i split the adresses in two parts. the significant part in my structure and concat the fixed part (0x1000) when i need it ?

Is it possible and safe ? How would you do that ?

Thank you,

Ben

#stm32f4-pointer
1 REPLY 1
stm322399
Senior
Posted on October 09, 2014 at 16:31

Benoit,

ARM compiler generally align structures on 4-bytes boundaries. So the CCM only provides 16384 possible position for structures. Instead of using a pointer, you can use an index in range 0 - 16383, which requires only 2 bytes of storage, instead of 4 for a regular pointer. The conversion between the index and the real pointer is trivial.