7 years, 5 months ago.

IAR linker error

Hi, I have exported to IAR an mbed project for STM32F042K6T6 processor. On mbed compiles correctly but on iar i have a linker error: "Error[Lp011]: section placement failed. Unable to allocate space for sections/blocks with a total estimated minimum size of 0x8019 bytes (max align 0x8) in <[0x08000000-0x08007fff]> (total uncommitted space 0x7f40)." Seems that linker is not able to put all code in flash memory, in fact if i comment all code living only the main function all works fine. Can anyone help me?

Thanks

Alessandro Parmiani

1 Answer

7 years, 5 months ago.

Hi Alessandro,

I am going to go with the obvious answer. That micro has 32kB flash which lives between 0x0800 0000 and 0x0800 7FFF. It appears your compiled size is 0x8091 bytes which of course is too much. The online compiler uses Keil MDK and probably produces code that is just a bit smaller and so works.

32kB flash really is not enough for an mbed project unless you are looking at a single blinky led or something. I would consier getting a new board with, say 256k or more flash. Or if you are really stuck you can look for ways to shrink the compile size. Compiler should have an option to compile for small size. Also make sure to use the IAR's version of the newlib-nano library.

Graham

Accepted Answer