Help me out of this IAR compile Error : cannot fit "Block .bss"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help me out of this IAR compile Error : cannot fit "Block .bss"

Jump to solution
2,598 Views
wangfukai
Contributor I

When I added the TCP/IP code in my project of MK60FX512VLQ12, this Error came out:smileycry:

360软件小助手截图20140510200851.png

Some one says it is because of lacking of memory. But how could I change the config to fix the Error.

I tried to increase the optimization level of compile level, but some code was skipped.

Please help me out of this.

Labels (1)
0 Kudos
1 Solution
1,388 Views
mjbcswitzerland
Specialist V

Hi

1. The .bss section (variables initialised with 0) is about 75k in size and so occupies around 60% of the available SRAM of the K60

2. It is not absolutely clear whether you are building for execution in SRAM or in Flash. If in SRAM I can't imagine that there is then enough space for the bss, variable and code, however when building for Flash it will depend on the space required for initialised variables (including heap) plus stack sizes. This depends on the program and what it does.

3. I don't think that changing the linker script will help since the linker script is already telling the linker that it has about 128k SRAM to work with and this is the physical limit which can't be increased. However I may be wrong because the lnker script is breaking the SRAM into two areas, and possibly the linker wants to fit the 75k in just one of the two possible, but contiguous, areas. In this case it may be worth declaring the SRAM as one "single" area from 0x1fff0410... 0x20010000 instead.

4. If 3) doesn't help, you need to check what the space is being used for (the .bss and other variables - by studying the map file generated it is possible to see which chunks of storage are required by the various parts of the program) and see whether you can reduce this in the code by reducing buffer sizes (where configurable) or possibly reducing the heap size reserved (assuming it is not all needed). This will require a certain amount of understanding on the project parts used and the overall memory footprint/performance balance that can be adjusted to suit its aims. Possibly you could remove certain TCP/IP protocols from the stack to reduce memory requirements.

Regards

Mark

P.S. I notice that many students/developers in China use full versions of IAR. In Europe most people use CodeWarrior (or more recently KDS) because IAR is (although very good) very expensive. Does IAR have a different price politic or student versions that allows its widespread use in certain parts of the world?

View solution in original post

0 Kudos
4 Replies
1,389 Views
mjbcswitzerland
Specialist V

Hi

1. The .bss section (variables initialised with 0) is about 75k in size and so occupies around 60% of the available SRAM of the K60

2. It is not absolutely clear whether you are building for execution in SRAM or in Flash. If in SRAM I can't imagine that there is then enough space for the bss, variable and code, however when building for Flash it will depend on the space required for initialised variables (including heap) plus stack sizes. This depends on the program and what it does.

3. I don't think that changing the linker script will help since the linker script is already telling the linker that it has about 128k SRAM to work with and this is the physical limit which can't be increased. However I may be wrong because the lnker script is breaking the SRAM into two areas, and possibly the linker wants to fit the 75k in just one of the two possible, but contiguous, areas. In this case it may be worth declaring the SRAM as one "single" area from 0x1fff0410... 0x20010000 instead.

4. If 3) doesn't help, you need to check what the space is being used for (the .bss and other variables - by studying the map file generated it is possible to see which chunks of storage are required by the various parts of the program) and see whether you can reduce this in the code by reducing buffer sizes (where configurable) or possibly reducing the heap size reserved (assuming it is not all needed). This will require a certain amount of understanding on the project parts used and the overall memory footprint/performance balance that can be adjusted to suit its aims. Possibly you could remove certain TCP/IP protocols from the stack to reduce memory requirements.

Regards

Mark

P.S. I notice that many students/developers in China use full versions of IAR. In Europe most people use CodeWarrior (or more recently KDS) because IAR is (although very good) very expensive. Does IAR have a different price politic or student versions that allows its widespread use in certain parts of the world?

0 Kudos
1,388 Views
wangfukai
Contributor I

Thanks very much for answering my question. It is weekend here in Beijing. Is it also weekend in Europe?

1. When I changed 0x1fff0410--0x1fffffff  to 0x1ffe0410--0x1fffffff ,  no errors after compile but the system would be trapped at a while loop in startup code showed after.

360软件小助手截图20140511201250.png

    The variable 'n' in that loop stopped at 719 and never decrease.

2. When I changed 0x1fff0410--0x1fffffff to 0x1ffe0410--0x20001000 (not 0x20010000), no errors after compile and the system runs well.

3. As showed in the pic up, the code executes in flash.

4. It is a shame to say what I used is  a cracked IAR which is popular among Chinese students.

    I know IAR has some free-version such as V7.1 but also has restriction in code size. What I

    heard is that engineers in companies do not use the cracked IAR.

Best Regards.

Fukai

0 Kudos
1,387 Views
erland
Contributor I

I'm experiencing the same issue: Error[Lp014]: cannot fit "Block .bss" (min size 0x3254, alignment 0x4) into any of the ranges <[0x1ffff0c0-0x1fffffff], [0x20000000-0x20002fff]>

It vanished once I set my compiler optimization to high, but I would still like to know how you were able to set the range. I'm expecting some optimization related bugs when I start debugging, and would like to be able to turn optimization off.

Like you I'm using the full version of IAR. The device I'm programming is a Kinetis MKL15Z128VLH4, using the IAR Systems I-jet.

Regards,

Erland

0 Kudos
1,388 Views
wangfukai
Contributor I

Hi Erland,


     I changed RAM region 0x1fff0410--0x1fffffff to 0x1ffe0410--0x20001000. There are two ways to do this.


     1. Edit the icf file. There are many icf files in the directory build->IAR->config files. In my project I used "512KB_Pflash_512KB_Dflash.icf"

     That's how I changed it.

QQ截图20140723202356.jpg

  


  2. Change it with the IAR IDE

QQ截图20140723202748.jpg

0 Kudos