Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I want to use Gnude on Win32 to develop .mod files.

I want them to be as compatible as possible with BREW and I don't want subtle binary incompatibilities to cause my programs to crash.

I noticed that the default flags that the Brew Tools put in the .mak file seem pretty good.. but I am suspicious of '-fshort-enums'. I am suspicious because in the ARM version of the makefile there is nothing telling ABB/ADS to use short enums.

I also wonder if I should make efforts to try and align all struct members to 2 byte boundaries. Should I use the __aligned__ extension in GCC to accomplish that? Whould I use it on every struct member?

What about the PACKED stuff in the BREW headers. Do I need to #define them to something?

Basically.. any tips you guys have on

- Good compatible GCC flags
- Use of PACKED and aligned extentions

Would be helpful.

Also any things to avoid would be great too.

Thanks!

Quote:Originally posted by Calin
I noticed that the default flags that the Brew Tools put in the .mak file seem pretty good.. but I am suspicious of '-fshort-enums'. I am suspicious because in the ARM version of the makefile there is nothing telling ABB/ADS to use short enums.
This is what the ADS compiler does by default.
Quote:I also wonder if I should make efforts to try and align all struct members to 2 byte boundaries. Should I use the __aligned__ extension in GCC to accomplish that? Whould I use it on every struct member?
GCC should take care of the alignment for you. You can always take a look at the assembly to make sure.
Quote:What about the PACKED stuff in the BREW headers. Do I need to #define them to something?
There are two macros for packing: PACKED, which is used by ADS, and GCCPACKED, which is used for GCC. So for GCC, PACKED should be defined as nothing. These definitions are in AEEComdef.h

Quote:Originally posted by Calin
I noticed that the default flags that the Brew Tools put in the .mak file seem pretty good.. but I am suspicious of '-fshort-enums'. I am suspicious because in the ARM version of the makefile there is nothing telling ABB/ADS to use short enums.
This is what the ADS compiler does by default.
Quote:I also wonder if I should make efforts to try and align all struct members to 2 byte boundaries. Should I use the __aligned__ extension in GCC to accomplish that? Whould I use it on every struct member?
GCC should take care of the alignment for you. You can always take a look at the assembly to make sure.
Quote:What about the PACKED stuff in the BREW headers. Do I need to #define them to something?
There are two macros for packing: PACKED, which is used by ADS, and GCCPACKED, which is used for GCC. So for GCC, PACKED should be defined as nothing. These definitions are in AEEComdef.h

Quote:GCC should take care of the alignment for you. You can always take a look at the assembly to make sure.
The compiler should take care of it, and you should be aware of NOT using some pointer arithmetics, as it would fail, like on the following example:
struct sX{
char a;
char b;

&sX->a + sizeof(char) != &sX->b
I grab this example from another ARM based architecture, not BREW, but I think it follows the same rules...

Quote:GCC should take care of the alignment for you. You can always take a look at the assembly to make sure.
The compiler should take care of it, and you should be aware of NOT using some pointer arithmetics, as it would fail, like on the following example:
struct sX{
char a;
char b;

&sX->a + sizeof(char) != &sX->b
I grab this example from another ARM based architecture, not BREW, but I think it follows the same rules...

A flag I like is "optimize for SIZE":
-Os
Shrank an -O2 compiled mod file by 30%.

A flag I like is "optimize for SIZE":
-Os
Shrank an -O2 compiled mod file by 30%.

Is "-Os" right? maybe -Os is -Ospace?

Is "-Os" right? maybe -Os is -Ospace?

xacheng,
Yep, -Os is used in my builds (GCC compiler) to shrink them hugely.
-Ospace looks like the one to use if you're using ARM's RealView compiler.
There's also -Osh** to produce a crashing all-the-time build...kidding.

xacheng,
Yep, -Os is used in my builds (GCC compiler) to shrink them hugely.
-Ospace looks like the one to use if you're using ARM's RealView compiler.
There's also -Osh** to produce a crashing all-the-time build...kidding.

I knew. may be i need use GCC to shrink the mod file's size now!

I knew. may be i need use GCC to shrink the mod file's size now!

Use ADS/RVCT for smaller binary size. GCC does fairly poor job.

Use ADS/RVCT for smaller binary size. GCC does fairly poor job.

:p :)

:p :)