cancel
Showing results for 
Search instead for 
Did you mean: 

Heap size

cricart
Associate II
Posted on January 11, 2017 at 11:32

Hi,

I'm working with a stm32f437VI. I need more heap memory. I changed the Heap size in de startup_stm32f427x.s (Heap_Size       EQU     0x00000200), but when I did a malloc and worked with the variable, and exception error happen.  I don't know if this is the way to increase the heap memory, or exsist other way. 

Thanks in advance,

7 REPLIES 7
Khouloud GARSI
Lead II
Posted on January 11, 2017 at 13:14

Hi

Ricart.Carles

,

Could you please indicate the heap_size value you need to use.

Khouloud.

Posted on January 12, 2017 at 09:31

Hi,

I need to work with a 4kbytes .

carles.

Khouloud GARSI
Lead II
Posted on January 13, 2017 at 19:22

Hi

Ricart.Carles

,

Hi I need more information for further investigation:

I did a malloc and worked with the variable, and exception error happen.

Could you please give as more details about the encountered error.

2. What IDE are you using?

Khouloud.

Posted on January 16, 2017 at 09:22

Hi,

I'm working with keil5.

The error is  a 'HardFault_Handler'.

When I increase the heap size in the way that I told you before, the compiler accepts the malloc. If I don't increase the memory, the compiler give me an error becouse the heap size is small than the memory allocated. This part looks fine, but when I work with the memory allocated, the exception error occurs. If I work with a small memory allocated (less than ->

Heap_Size       EQU     0x00000200)

 , the program works.But when I increase the allocated memory and increase the heap_size, the programs doesn't works.

carles.

Khouloud GARSI
Lead II
Posted on January 17, 2017 at 16:22

Hi

Ricart.Carles

,

I do not see any issue that could cause this encountered hard fault.

Please share your code in order

toreproduce your case and

to identify what is going wrong.

Khouloud.

Posted on January 17, 2017 at 17:05

Simple question, what address does malloc() give you? How are you then accessing the memory? Are you casting to a structure pointer?

Show the specific code that is faulting. Ideally use a proper Hard Fault Handler instead of a while() loop

Present the problem in a fashion that can be solved, 'doesn't work' really doesn't help diagnose what is actually wrong.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on February 09, 2017 at 16:50

This was resolved how?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..