This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430G2231: Program will not fit into available memory [...]

Part Number: MSP430G2231

Tool/software: TI C/C++ Compiler

Hello,


I'm trying to use BMP280 sensor with my MSP430G2231. My SPI communication seems to be ok but when i try ton convert the temperature thanks to the formula of the documentation, i've got this error :

"../lnk_msp430g2231.cmd", line 95: error #10099-D: program will not fit into available memory.  placement with alignment fails for section ".text" size 0x946 .  Available memory ranges:
   FLASH        size: 0x7e0        unused: 0x7d2        max hole: 0x7d2     
error #10010: errors encountered during linking; "Test_Capteur.out" not built

here is my code, if i comment this function there is no error :

double bmp280_compensate_T_double(long signed int adc_T, unsigned int dig_T1f, signed int dig_T2f, signed int dig_T3f)
{
	long long signed int t_fine;
	int var1, var2, T;
	var1 = (  (((double)adc_T)/16384.0) - (((double)dig_T1f)/1024.0)  ) * ((double)dig_T2f);


	var2 =  (     ( ( ((double)adc_T)/131072.0 ) - ( ((double)dig_T1f)/8192.0 ) ) *  (  ( ((double)adc_T)/131072.0 ) -  ( ((double) dig_T1f)/8192.0 ) )      ) *   (((double)dig_T3f));


	var2 = ((((double)adc_T)/131072.0 – ((double)dig_T1f)/8192.0) * (((double)adc_T)/131072.0 – ((double) dig_T1f)/8192.0)) * ((double)dig_T3f);
	t_fine = (long long signed int)(var1 + var2);
	T = (var1 + var2) * 5120.0;

	return T;
}

any help ?

Thanks !

  • Hi,
    the sensor API provided by Bosch is really, really huge.
    I had this same problem with this sensor and had to switch to a bigger MCU.
    In fact, it is not an error, it is just telling the truth :( It won't fit unless you reduce the code or better, go use another MCU.
    Good luck, buddy.
  • thks for your answer !
    That's why our profesors gave us another MSP430 with more memory :/
    But the momory seems to be unused no ? : FLASH size: 0x7e0 unused: 0x7d2 max hole: 0x7d2
    and i didn't include the BOSH API in my project so, it should be okay, right ? I just have like 400 lines of code at the most !!
    btw, it seems to be ok if i use the MSP430FR4331 for my project but i don't have the device at home :(

    Thks for your help ! :)
  • Hi,

    in addition to what kazola said you can check out the Compiler/diagnostic messages/ 10099 wiki page to fully understand the error.

    Besides the solution to choose a MCU with more memory, you can generally try for code size optimization, too (if the code isn't size optimized yet).

    Best regards,

    Britta

  • Yeah, you could do your own API by stripping the code you do not need.
    The I2C code is not long, the calibration and compensation is, am I right? :)
  • To my mind, it's not really long

    I've implemented my code today on msp430fr4133and everything is working. Thks for your help =)

**Attention** This is a public forum