Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » Instruct XDC to treat enums as integer(Changing the default options of enum packing )
Instruct XDC to treat enums as integer [message #511668] Tue, 02 February 2010 13:44 Go to next message
Sujith  is currently offline Sujith Friend
Messages: 4
Registered: February 2010
Junior Member
Hi,

I am faced with a problem on packed enums, by default the enums are converted to short integers. This could potentially break my software. I want to instruct XDC to treat enums as integers.

As per XDC documentation, its possible to do so by specifying "M3.model.shortEnums = false;" where M3 is a variable of type ti.targets.arm.elf.M3 in config.bld

When built with this modification, I get following error.

"E:/Work/packages/config.bld", line 26: XDC
runtime error: ti.targets.arm.elf.M3/model: 'shortEnums' is sealed
.interfaces files complete: Tue Feb 2 19:10:24 IST 2010.


Could you please help me out with this? I am using RTSC/XDC versioned 3.16.01.27

Thanks,
Sujith
Re: Instruct XDC to treat enums as integer [message #511778 is a reply to message #511668] Tue, 02 February 2010 19:18 Go to previous messageGo to next message
Mark Grosen is currently offline Mark GrosenFriend
Messages: 4
Registered: January 2010
Junior Member
Sujith,

The basic problem with your approach is that you are trying to change the definition of an existing Target.
http://rtsc.eclipse.org/docs-tip/Glossary#Target
The shortEnums property is configured when a Target is defined and cannot be changed subsequently. Why? If you changed it, you would no longer be compiling code in a compatible fashion with the original Target. You could define a new Target that specifies shortEnums = false and then use that Target when building your code. However, you would then need to re-compile any other packages you use with this new target so they would be compatible. Probably now what you want.

There may be another way to do what you want on a per structure or enum basis without changing the Target.

Or, do you think that the way ti.targets.arm.elf.M3 is wrong and it should be using shortEnums = false?

Mark
Re: Instruct XDC to treat enums as integer [message #511884 is a reply to message #511778] Wed, 03 February 2010 10:39 Go to previous messageGo to next message
Sujith  is currently offline Sujith Friend
Messages: 4
Registered: February 2010
Junior Member
Mark,

Thanks for the response. I could create a new target and define shortEnums = false. I will have to explore methods to define a new target.

But,
M3 could be part of multi-core system hosting multiple/different OSes. (With different compiler characteristic of treating an enum could be packed/un-packed) If were to have IPC between these core (say shared memory communication), we would run into issues on the structure sizes.

I think it would be a good idea to set it false by default, for optimizations user could define a custom target and define the enum behavior among other characteristic.

Thanks,
Sujith
Re: Instruct XDC to treat enums as integer [message #512397 is a reply to message #511668] Thu, 04 February 2010 22:12 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha SlijepcevicFriend
Messages: 115
Registered: July 2009
Senior Member
The whole 'shortEnums' functionality is added because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=289018.

By default, TI's Arm compiler packs enums. That can be verified by looking into the section $build.attributes, and decoding it as specified in the section 2.3.6.2 The procedure call-related attributes, in http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045c/IH I0045C_ABI_addenda.pdf.

The TI Arm compiler has the option --enum_type=unpacked,int,packed, designate enum type (Default is packed for EABI). If we were passing that option for our M3 target, shortEnum would be false. I don't know if there is a good reason that we should, but the linker would certainly complain if the object files with different enum options were linked together. That means that the different shortEnum options require two different M3 targets.

[Updated on: Thu, 04 February 2010 22:53]

Report message to a moderator

Re: Instruct XDC to treat enums as integer [message #512444 is a reply to message #512397] Fri, 05 February 2010 07:54 Go to previous message
Sujith  is currently offline Sujith Friend
Messages: 4
Registered: February 2010
Junior Member
Thanks, I get the rational behind default enum configuration. To solve the issue that I am facing, I will define a new target and turn off this flag.

Thanks,
Sujith
Previous Topic:reuse of command line RTSC build in CCSV4.0 IDE
Next Topic:Steps required for definition of non-cacheable section
Goto Forum:
  


Current Time: Thu Mar 28 11:40:01 GMT 2024

Powered by FUDForum. Page generated in 0.03384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top