I use CCS5.4, and did test shown below. I do not understand why optimization level 4 produces larger file then 3. Also, would you have recommendations to minimize program size? I am tight on memory, but have plenty of speed and power to run.
1) =========================================================================================================
Optimization Level: 4
Speed vs Size: 5
Error: "../lnk_msp430fr5739.cmd", line 127: error #10099-D: program will not fit into available memory. placement with alignment fails for section "ALL_FRAM" size 0x7737. Available memory ranges: FRAM size: 0x3d80 unused: 0x37de max hole: 0x37de GROUP(ALL_FRAM) error #10010: errors encountered during linking; "C1202.out" not built
From C1202.map file from debug folder:
.text 0 00000800 00006cc8
00000800 00003634 debug.obj (.text:_Z10debug_scanv)
00003e34 00000728 debug.obj (.text:_ZN12StateMachine12stateF_derefEPKj)
0000455c 000005d8 modem.obj (.text:_Z15Modem_read_smsFPj)
The debug.obj function called debug_scan is 13876 bytes long, its huge. Makes sense, probably in-lining everything.
2) =========================================================================================================
Optimization Level: 4
Speed vs Size: 0
Error: "../lnk_msp430fr5739.cmd", line 127: error #10099-D: program will not fit into available memory. placement with alignment fails for section "ALL_FRAM" size 0x4fbf . Available memory ranges:
FRAM size: 0x3d80 unused: 0x37de max hole: 0x37de
GROUP(ALL_FRAM)
error #10010: errors encountered during linking; "C1202.out" not built
From C1202.map file from debug folder:
.text 0 00000800 00004550
00000800 00001a34 debug.obj (.text:_Z10debug_scanv)
00002234 00000448 debug.obj (.text:_ZN12StateMachine12stateF_derefEPKj)
0000267c 000003c2 modem.obj (.text:_Z15Modem_read_smsFPj)
The debug.obj function called debug_scan is 6708 bytes long, its still large. Does not make sense the function is only 1 page long, cannot be that big, it is optimizing for size.
3) =========================================================================================================
Optimization Level: off
Error: "../lnk_msp430fr5739.cmd", line 127: error #10099-D: program will not fit into available memory. placement with alignment fails for section "ALL_FRAM" size 0x3c8b . Available memory ranges:
>> Compilation failure
FRAM size: 0x3d80 unused: 0x37de max hole: 0x37de
From C1202.map file from debug folder:
.text 0 00000800 0000320a FAILED TO ALLOCATE
So it looks like the program size is 0x3c8b, which is smallest with optimization off so far. This does not make sense
4) =========================================================================================================
Optimization Level: 0
Speed vs Size: 0
"../lnk_msp430fr5739.cmd", line 127: error #10099-D: program will not fit into available memory. placement with alignment fails for section "ALL_FRAM" size 0x3e97 . Available memory ranges:
>> Compilation failure
FRAM size: 0x3d80 unused: 0x37de max hole: 0x37de
GROUP(ALL_FRAM)
From C1202.map file from debug folder:
.text 0 00000800 00003416
00000800 000005d4 sensor.obj (.text:_Z14Sensor_uploadFPj)
00000dd4 000002ec modem.obj (.text:_Z18Modem_upload_dataFPj)
000010c0 00000286 main.obj (.text:main)
000017fe 00000218 debug.obj (.text:_Z10debug_scanv)
Wow What a change, size of debug.obj function debug_scan is down to 536 from 6708 bytes (more then 90% reduction). What is going on?
5) =========================================================================================================
Optimization Level: 2
Speed vs Size: 0
No Error, works fine
From C1202.map file from debug folder:
.text 0 0000d000 00002e1c
0000d000 000003a6 sensor.obj (.text:_Z14Sensor_uploadFPj)
0000d3a6 0000027c modem.obj (.text:_Z18Modem_upload_dataFPj)
0000d622 00000208 modem.obj (.text:_Z20Modem_get_at_promptFPj)
0000d82a 00000206 modem.obj (.text:_Z15Modem_read_smsFPj)
0000da30 000001e6 debug.obj (.text:_Z10debug_scanv)
When I upload the program, console outputs the following:
MSP430: Loading complete. Code Size - Text: 11804 bytes Data: 1182 bytes.
Thanks...