Code size increase following MCUXpresso upgrade

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

Code size increase following MCUXpresso upgrade

Jump to solution
480 Views
jstark
Contributor II

  I've developed some instrumentation which uses an MK22DX128 and noted a substantial code size increase since MCUXpresso-11.7. This was first experienced with 11.9, and testing today using the most current revision (25.6.3) yields similar results. Reported code and data sizes for the same source base are shown below.

MCUXpresso-11.7.1

Debug

PROGRAM_FLASH: 91812 B 128 KB 70.07%

Release

  PROGRAM_FLASH: 83748 B 128 KB 63.89%


MCUXpresso-25.6.136

Debug

PROGRAM_FLASH: 126084 B 128 KB 96.19%

Release

PROGRAM_FLASH: 117836 B 128 KB 89.90%

  The project was exported from 11.7 and imported without change into 25.6, and as far as I can tell is compiled using the same build parameters. Had I not recently deleted some diagnostics from the source base, the code would exceed available flash storage if compiled using the current revision of MCUXpresso. As it is likely that future updates to the source base will be required,  I am concerned about ongoing support. At present, I have an older machine running Ubuntu-20.04 to host 11.7, however I cannot be assured that it will be available indefinitely.

  Compiler options have been determined to be identical in both build environments and are listed below. Because my application depend upon 64-bit variables (both integer and floating point), Newlib is required.

  I'm hoping that the difference in generated code size is due to some build parameter which I've overlooked. If that may be the case, any assistance in identifying and correcting the discrepancy would be most appreciated.

  - J

Compiler options

-D__USE_CMSIS
-DCR_INTEGER_PRINTF
-DSDK_DEBUGCONSOLE=0
-D__MCUXPRESSO
-DNDEBUG
-DFSL_RTOS_BM
-DSDK_OS_BAREMETAL
-DCPU_MK22DX128VLF5
-DCPU_MK22DX128VLF5_cm4
-D__NEWLIB__
-I"/home/jstark/MCUXpresso/PTR-2/source"
-I"/home/jstark/MCUXpresso/PTR-2"
-I"/home/jstark/MCUXpresso/PTR-2/startup"
-I"/home/jstark/MCUXpresso/PTR-2/CMSIS"
-Os
-fno-common
-g
-gdwarf-4
-Wall
-c
-fmessage-length=0
-fno-builtin
-ffunction-sections
-fdata-sections
-fsingle-precision-constant
-fmacro-prefix-map="$(<D)/"=
-mcpu=cortex-m4
-mthumb
-D__NEWLIB__
-fstack-usage

0 Kudos
Reply
1 Solution
394 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jstark 

MCUXpresso IDE v25.06 is based on Arm GNU Toolchain version 14.2.Rel1, while MCUXpresso IDE v11.7 uses GCC 10.x.
The compiler upgrade is significant, which may introduce additional code.
Moreover, the newer Newlib provides more complete support for 64-bit integers and floating-point operations, but it is also more bloated.
Also you should check whether your project includes printf calls to the console, as this can consume a large amount of flash memory.

 

BR

Alice

View solution in original post

0 Kudos
Reply
1 Reply
395 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jstark 

MCUXpresso IDE v25.06 is based on Arm GNU Toolchain version 14.2.Rel1, while MCUXpresso IDE v11.7 uses GCC 10.x.
The compiler upgrade is significant, which may introduce additional code.
Moreover, the newer Newlib provides more complete support for 64-bit integers and floating-point operations, but it is also more bloated.
Also you should check whether your project includes printf calls to the console, as this can consume a large amount of flash memory.

 

BR

Alice

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2205538%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECode%20size%20increase%20following%20MCUXpresso%20upgrade%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2205538%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%26nbsp%3B%20I've%20developed%20some%20instrumentation%20which%20uses%20an%20MK22DX128%20and%20noted%20a%20substantial%20code%20size%20increase%20since%20MCUXpresso-11.7.%20This%20was%20first%20experienced%20with%2011.9%2C%20and%20testing%20today%20using%20the%20most%20current%20revision%20(25.6.3)%20yields%20similar%20results.%20Reported%20code%20and%20data%20sizes%20for%20the%20same%20source%20base%20are%20shown%20below.%3C%2FP%3E%3CP%3E%3CSTRONG%3EMCUXpresso-11.7.1%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EDebug%3C%2FP%3E%3CP%3EPROGRAM_FLASH%3A%2091812%20B%20128%20KB%2070.07%25%3C%2FP%3E%3CP%3ERelease%3C%2FP%3E%3CP%3E%26nbsp%3B%20PROGRAM_FLASH%3A%2083748%20B%20128%20KB%2063.89%25%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3EMCUXpresso-25.6.136%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EDebug%3C%2FP%3E%3CP%3EPROGRAM_FLASH%3A%20126084%20B%20128%20KB%2096.19%25%3C%2FP%3E%3CP%3ERelease%3C%2FP%3E%3CP%3EPROGRAM_FLASH%3A%20117836%20B%20128%20KB%2089.90%25%3C%2FP%3E%3CP%3E%26nbsp%3B%20The%20project%20was%20exported%20from%2011.7%20and%20imported%20without%20change%20into%2025.6%2C%20and%20as%20far%20as%20I%20can%20tell%20is%20compiled%20using%20the%20same%20build%20parameters.%20Had%20I%20not%20recently%20deleted%20some%20diagnostics%20from%20the%20source%20base%2C%20the%20code%20would%20exceed%20available%20flash%20storage%20if%20compiled%20using%20the%20current%20revision%20of%20MCUXpresso.%20As%20it%20is%20likely%20that%20future%20updates%20to%20the%20source%20base%20will%20be%20required%2C%26nbsp%3B%20I%20am%20concerned%20about%20ongoing%20support.%20At%20present%2C%20I%20have%20an%20older%20machine%20running%20Ubuntu-20.04%20to%20host%2011.7%2C%20however%20I%20cannot%20be%20assured%20that%20it%20will%20be%20available%20indefinitely.%3C%2FP%3E%3CP%3E%26nbsp%3B%20Compiler%20options%20have%20been%20determined%20to%20be%20identical%20in%20both%20build%20environments%20and%20are%20listed%20below.%20Because%20my%20application%20depend%20upon%2064-bit%20variables%20(both%20integer%20and%20floating%20point)%2C%20Newlib%20is%20required.%3C%2FP%3E%3CP%3E%26nbsp%3B%20I'm%20hoping%20that%20the%20difference%20in%20generated%20code%20size%20is%20due%20to%20some%20build%20parameter%20which%20I've%20overlooked.%20If%20that%20may%20be%20the%20case%2C%20any%20assistance%20in%20identifying%20and%20correcting%20the%20discrepancy%20would%20be%20most%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%20-%20J%3C%2FP%3E%3CP%3ECompiler%20options%3C%2FP%3E%3CP%3E-D__USE_CMSIS%3CBR%20%2F%3E-DCR_INTEGER_PRINTF%3CBR%20%2F%3E-DSDK_DEBUGCONSOLE%3D0%3CBR%20%2F%3E-D__MCUXPRESSO%3CBR%20%2F%3E-DNDEBUG%3CBR%20%2F%3E-DFSL_RTOS_BM%3CBR%20%2F%3E-DSDK_OS_BAREMETAL%3CBR%20%2F%3E-DCPU_MK22DX128VLF5%3CBR%20%2F%3E-DCPU_MK22DX128VLF5_cm4%3CBR%20%2F%3E-D__NEWLIB__%3CBR%20%2F%3E-I%22%2Fhome%2Fjstark%2FMCUXpresso%2FPTR-2%2Fsource%22%3CBR%20%2F%3E-I%22%2Fhome%2Fjstark%2FMCUXpresso%2FPTR-2%22%3CBR%20%2F%3E-I%22%2Fhome%2Fjstark%2FMCUXpresso%2FPTR-2%2Fstartup%22%3CBR%20%2F%3E-I%22%2Fhome%2Fjstark%2FMCUXpresso%2FPTR-2%2FCMSIS%22%3CBR%20%2F%3E-Os%3CBR%20%2F%3E-fno-common%3CBR%20%2F%3E-g%3CBR%20%2F%3E-gdwarf-4%3CBR%20%2F%3E-Wall%3CBR%20%2F%3E-c%3CBR%20%2F%3E-fmessage-length%3D0%3CBR%20%2F%3E-fno-builtin%3CBR%20%2F%3E-ffunction-sections%3CBR%20%2F%3E-fdata-sections%3CBR%20%2F%3E-fsingle-precision-constant%3CBR%20%2F%3E-fmacro-prefix-map%3D%22%24(%3CD%3E%3C%2FD%3E-mcpu%3Dcortex-m4%3CBR%20%2F%3E-mthumb%3CBR%20%2F%3E-D__NEWLIB__%3CBR%20%2F%3E-fstack-usage%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2206774%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Code%20size%20increase%20following%20MCUXpresso%20upgrade%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2206774%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F165087%22%20target%3D%22_blank%22%3E%40jstark%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMCUXpresso%20IDE%20v25.06%20is%20based%20on%20Arm%20GNU%20Toolchain%20version%2014.2.Rel1%2C%20while%20MCUXpresso%20IDE%20v11.7%20uses%20GCC%2010.x.%3CBR%20%2F%3EThe%20compiler%20upgrade%20is%20significant%2C%20which%20may%20introduce%20additional%20code.%3CBR%20%2F%3EMoreover%2C%20the%20newer%20Newlib%20provides%20more%20complete%20support%20for%2064-bit%20integers%20and%20floating-point%20operations%2C%20but%20it%20is%20also%20more%20bloated.%3CBR%20%2F%3EAlso%20you%20should%20check%20whether%20your%20project%20includes%20%3CCODE%3Eprintf%3C%2FCODE%3E%20calls%20to%20the%20console%2C%20as%20this%20can%20consume%20a%20large%20amount%20of%20flash%20memory.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E