"memory allocation failed, heap is locked" in main.c

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
stefanh
Posts: 5
Joined: Thu Jun 02, 2016 8:31 pm

"memory allocation failed, heap is locked" in main.c

Post by stefanh » Thu Jun 02, 2016 8:51 pm

Hi,

I am trying to run micropython on a OLIMEX STM32-E407 board.
It is similar to the STM32F4 Discovery, so I used this config files as my starting point.
I can build everything, flash the board and start it.

But already in main.c in the main()-function I get always the following error:
"memory allocation failed, heap is locked"
and the program is stuck in the __fatal_error()-function.

most of the time it happens at line 538:
FRESULT res = f_stat(boot_py, NULL);
but sometime also in line 587:
mod_network_init();

I am using the latest code from the github master branch.

Any advice whats going wrong here?

My first try was with this repo
https://github.com/markushx/micropython ... limex-e407
and it worked fine. But since it is very old I will try to port the latest code of micropython to the STM32-E407

Thanks for your help,
stefan

stefanh
Posts: 5
Joined: Thu Jun 02, 2016 8:31 pm

Re: "memory allocation failed, heap is locked" in main.c

Post by stefanh » Sat Jun 04, 2016 11:30 pm

Finally got it working, had some wrong settings for the clock.
If somebody is also interested in this port, I made a pull request to the official micropython repository
https://github.com/micropython/micropython/pull/2159

Post Reply