cancel
Showing results for 
Search instead for 
Did you mean: 

Data to Store Array

DCtech
Associate II

I keep the important information in 32 byte. But every block have 32 byte .There are more than 300 block and every block have 32 bytes of data. So I've 32*300 byte data. How can I keep in the RAM successfully. Sould I Keep with array (uint32_t) or pointer (malloc, alloc functions) ? Which one is logical and how ? I am using stm32f4 with 192kb RAM so RAM is surely enough. When I use this values I want to clear-free the memory.

1 REPLY 1
KnarfB
Principal III

I would use a global variable here, if your data is structured something like

struct record { int x; int y; /* more */ };
 
struct record data[300];
 
    for( int i=0; i<300; ++i ) {
        data[i].x = 42;
    }

Embedded programming should be as static as possible, so no malloc if not neccessary. You don't want to run out of resources at run-time.

hth

KnarfB