Jul 17, 2018
02:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2018
02:12 AM
Hi.
I've downloaded the latest toolchain from arm (gcc7) and compiled a project with the same settings as with older gcc4.9 (standard from DAVE distribution).
The code size increased about 10%.
I had a closer look to the listing and espacially to XMC_GPIO_Init().
With gcc4.9 it tooks 180Bytes, with gcc7 it tooks 524Bytes.
Does anyone know the root cause of this?
Greetings
I've downloaded the latest toolchain from arm (gcc7) and compiled a project with the same settings as with older gcc4.9 (standard from DAVE distribution).
The code size increased about 10%.
I had a closer look to the listing and espacially to XMC_GPIO_Init().
With gcc4.9 it tooks 180Bytes, with gcc7 it tooks 524Bytes.
Does anyone know the root cause of this?
Greetings
4 Replies
Jul 17, 2018
03:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2018
03:01 AM
Hi,
I just tried using the GPIO example for XMC47 in the XMCLib.
Regards,
Jesus
I just tried using the GPIO example for XMC47 in the XMCLib.
GCC 49
text data bss dec hex filename
1896 0 2072 3968 f80 XMCLIB_GPIO.elf
GCC7
text data bss dec hex filename
1900 0 2072 3972 f84 XMCLIB_GPIO.elf
Regards,
Jesus
Attachments are accessible only for community members.
Jul 17, 2018
03:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2018
03:23 AM
Thanks for testing.
I extracted the section from the listing from my compilation.
Can you please post your listing and if possible your compiler / linker log?
In addition here are my compiler options for gcc7:
-DXMC1302_T038x0200 -DAKTIV=1 -DINAKTIV=0 -DTRUE=1 -DFALSE=0 -DNC=0xFF -DGND=0 -I"D:\Software Infineon\Demo" -I"D:\Software Infineon\Demo\DevDrivers\XMCLib\inc" -I"D:\Software Infineon\Demo\DevDrivers\CMSIS\Include" -I"D:\Software Infineon\Demo\DevDrivers\CMSIS\Infineon\XMC1300_series\Include" -I"D:\Software Infineon\Demo\RTOS\include" -I"D:\Software Infineon\Demo\RTOS\portable\GCC\ARM_CM0" -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -std=gnu99 -Wa,-adhlns="$@.lst" -pipe -c -fmessage-length=0 -mcpu=cortex-m0 -mthumb -g3 -gdwarf-2
They are the same as for gcc4.9.
I extracted the section from the listing from my compilation.
Can you please post your listing and if possible your compiler / linker log?
In addition here are my compiler options for gcc7:
-DXMC1302_T038x0200 -DAKTIV=1 -DINAKTIV=0 -DTRUE=1 -DFALSE=0 -DNC=0xFF -DGND=0 -I"D:\Software Infineon\Demo" -I"D:\Software Infineon\Demo\DevDrivers\XMCLib\inc" -I"D:\Software Infineon\Demo\DevDrivers\CMSIS\Include" -I"D:\Software Infineon\Demo\DevDrivers\CMSIS\Infineon\XMC1300_series\Include" -I"D:\Software Infineon\Demo\RTOS\include" -I"D:\Software Infineon\Demo\RTOS\portable\GCC\ARM_CM0" -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -std=gnu99 -Wa,-adhlns="$@.lst" -pipe -c -fmessage-length=0 -mcpu=cortex-m0 -mthumb -g3 -gdwarf-2
They are the same as for gcc4.9.
Jul 17, 2018
06:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2018
06:03 AM
Hi,
I have tested using your settings. The difference in size you see is due to the usage of fpack-struct.
In my case
Bear in mind the warning in the description of the -fpack-struct switch in the manual of GCC
You can find also other reports about using -fpack-struct, http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
Regards,
Jesus
I have tested using your settings. The difference in size you see is due to the usage of fpack-struct.
In my case
GCC49(-Os)
text data bss dec hex filename
1016 0 1048 2064 810 XMCLIB_GPIO_XMC13.elf
GCC49(-Os -fpack-struct -fshort-enums)
text data bss dec hex filename
1068 0 1048 2116 844 XMCLIB_GPIO_XMC13.elf
GCC7(-Os)
text data bss dec hex filename
1000 0 1040 2040 7f8 XMCLIB_GPIO_XMC13.elf
GCC7(-Os -fpack-struct -fshort-enums)
text data bss dec hex filename
1384 0 1040 2424 978 XMCLIB_GPIO_XMC13.elf
Bear in mind the warning in the description of the -fpack-struct switch in the manual of GCC
-fpack-struct[=n]
Without a value specified, pack all structure members together without holes.
When a value is specified (which must be a small power of two), pack structure
members according to this value, representing the maximum alignment (that
is, objects with default alignment requirements larger than this are output
potentially unaligned at the next fitting location.
Warning: the ‘-fpack-struct’ switch causes GCC to generate code that is
not binary compatible with code generated without that switch. Additionally,
it makes the code suboptimal. Use it to conform to a non-default application
binary interface.
You can find also other reports about using -fpack-struct, http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
Regards,
Jesus
Jul 17, 2018
06:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2018
06:41 AM
Thank a lot.
This solved my problem.
This solved my problem.