Shop OBEX P1 Docs P2 Docs Learn Events
List of GCC build and link options? — Parallax Forums

List of GCC build and link options?

RaymanRayman Posts: 14,665
edited 2013-04-11 07:08 in Propeller 1
I'd like to see a list of command line build and link options...
Couldn't find one, so I've tried to make one for myself, but I'm not 100% what some of these options do:
These are options for the propeller-elf-gcc.exe command line
Propeller Mode Options
-mcog    (runs with program and memory in cog)
-mlmm    (runs with program and memory in HUB)
-mcmm    (runs with compact program and memory in HUB)
-mxmm    (runs with program in external memory and memory in HUB)
-mxmmc   (?)
-mxmm-single  (?)
-mxmm-split  (?)
Propeller Cache Options
-mfcache  (small routines may be cached in cog for faster performance)
-mno-fcache  (no cache)
Propeller Floating Point Options
-m32bit-doubles  (can make faster by defining double as 32-bit)
-m64bit-doubles  (regular 64 bit doubles)
Propeller Other Options
-mpasm  (?)
-mspin  (?)
GCC Optimization Options
 -O0  (none)
 -O1  (mixed)
 -O2  (speed)
 -Os  (size)
GCC Compiler Options
-o a.out  (output is a.out)
-I .  (include current file folder)
-Wall  (show all warnings)
-fexceptions  (enable C++ exception handling)
-fno-exceptions  (no C++ exception handling)
-Dprintf=__simple_printf  (use smaller printf)
GCC Linker Options
-lm  (include floating point math library)
-ltiny  (inlude smaller floating point math library)
-lpthread  (multithreading?)

Does a list like this exist somewhere in the documentation?

Note: The GCC manual includes many, many options... Do they all have an affect?
PS: The manual does not yet include some of the newer Propeller options (like -cmm)...

Comments

  • ersmithersmith Posts: 6,054
    edited 2013-03-28 07:01
    Some corrections:
    -mxmmc   puts code in external memory, data in HUB
    -mxmm     puts both data and code in external memory
    
    -O1 is basic optimizations for speed
    -O2 is more advanced optimizations for speed
    -Os is like -O2, but optimizes for size instead of speed
    
    -ltiny links a tiny standard I/O (not floating point) library
    

    -mpasm outputs PASM syntax assembly language from the compiler instead of GAS, and -mspin adds a simple Spin wrapper. Both are very old options added when we first started to develop GCC, and probably do not work correctly any more.

    All of the platform independent options in the GCC manual have an effect, so the complete list of options for GCC is extremely long. Hence the very long manual :-) which is the only definitive documentation of GCC options. You've provided a nice summary of the more commonly used ones for the Propeller though. Thanks!

    Eric
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-28 07:37
    Rayman wrote: »
    I'd like to see a list of command line build and link options...
    Couldn't find one, so I've tried to make one for myself, but I'm not 100% what some of these options do:
    These are options for the propeller-elf-gcc.exe command line
    Propeller Mode Options
    -mxmm    (runs with program in external memory and memory in HUB)
    -mxmmc   (?)
    -mxmm-single  (?)
    -mxmm-split  (?)
    

    -mxmm and -mxmm-split both do the same thing: put code in external memory starting at 0x30000000 and data in external memory starting at 0x20000000. This is only really useful on the C3 at the moment where the C3 cache driver places flash at 0x30000000 and SRAM at 0x20000000.

    -mxmm-single loads both code and data to external memory at 0x20000000.

    -mxmmc puts code in external memory starting at 0x30000000 and data in hub memory.

    All memory models put the stack in hub memory.
  • ReinhardReinhard Posts: 489
    edited 2013-03-28 07:46
    always usefull

    C:\propgcc>propeller-elf-gcc --target-help
    The following options are target specific:
    -m32bit-doubles Store doubles in 32 bits for faster and smaller
    code.
    -m64bit-doubles Store doubles in 64 bits. This is the default.
    -mcmm Generate for compressed memory model (CMM) (code
    and data in hub)
    -mcog Generate code to run in internal cog space.
    -mexperimental Enable experimental optimizations which may or
    may not work correctly.
    -mfcache Enable support for loading external code into the
    cog memory fcache. This is enabled by default in
    optimization levels -O2 and higher, but may be
    disabled with an explicit -mno-fcache.
    -mlmm Generate for large memory model (LMM) (code and
    data in hub)
    -mp2 Select Propeller 2 code generation.
    -mpasm Generate assembler output that is compatible with
    the PASM assembler. The default is to generate
    GAS compatible syntax, unless -mspin is given.
    -mspin Output spin wrapper code for the assembly
    language.
    -mxmm Generate code to run in external flash/rom, with
    data in external ram.
    -mxmm-single Generate code to run in external memory, with
    data in external memory as well.
    -mxmm-split Generate code to run in external flash/rom, with
    data in external ram.
    -mxmmc Generate code to run in external memory (XMM);
    data is in hub. Implies -mlmm too.
    Assembler options
    =================
    Use "-Wa,OPTION" to pass "OPTION" to the assembler.
    Propeller options
    --lmm Enable LMM instructions.
    --cmm Enable compressed instructions.
    --p2 Enable Propeller 2 instructions.
    Linker options
    ==============
  • jazzedjazzed Posts: 11,803
    edited 2013-03-28 07:52
    Don't forget that any code marked with HUBTEXT and any data marked with HUBDATA with Propeller-GCC are put in HUB RAM regardless of mode (except -mcog). Also even XMM code can be fcached.

    That is: all heavy lifting in a program could be in HUB RAM and other less used functions could be in XMM.

    Thanks for the syntax reminder Reinhard :)
  • RaymanRayman Posts: 14,665
    edited 2013-03-28 10:36
    Ok, I think I have most of it now:
    These are options for the propeller-elf-gcc.exe command line
    (some info available using:  "propeller-elf-gcc --target-help" on the command line)
    
    Propeller Mode Options
    -mcog    (Generate code to run in internal cog space.)
    -mlmm    (Generate for large memory model (LMM) (code and data in hub))
    -mcmm    (Generate for compressed memory model (CMM) (code and data in hub))
    -mxmm    (code in external flash and data in external SRAM)
    -mxmmc   (code in external memory and data in HUB)
    -mxmm-single  (both code and data in one external memory)
    -mxmm-split  (same as -mxmm)
    -mp2  (Generate code for Propeller 2)
    
    Propeller Cache Options
    -mfcache  (small routines may be cached in cog for faster performance (even in xmm mode))
    -mno-fcache  (no cache)
    
    Propeller Floating Point Options
    -m32bit-doubles  (can make code faster by defining double as 32-bit)
    -m64bit-doubles  (regular 64 bit doubles)
    
    Propeller Other Options (old, may not work)
    -mpasm  (outputs PASM syntax assembly language from the compiler instead of GAS) 
    -mspin  (adds a simple Spin wrapper)
    
    GCC Optimization Options
     -O0  (none)
     -O1  (basic optimizations for speed)
     -O2  (advanced optimization for speed)
     -Os  (like -O2, but optimizes for size instead of speed)
    
    GCC Compiler Options
    -o a.out  (output is a.out)
    -I .  (include current file folder)
    -Wall  (show all warnings)
    -fexceptions  (enable C++ exception handling)
    -fno-exceptions  (no C++ exception handling)
    -Dprintf=__simple_printf  (use smaller printf)
    
    GCC Linker Options
    -lm  (include floating point math library)
    -ltiny  (inlude a smaller standard I/O library with no floating point)
    -lpthread  (multithreading?)
    

    still not sure about -lpthread

    Also, there's a note about a new -e option, but not sure it applies here...
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-28 11:05
    Rayman wrote: »
    still not sure about -lpthread
    That just says to link in libpthread.a, the pthreads library.
    Also, there's a note about a new -e option, but not sure it applies here...
    If you're looking at the Mercurial check-in comments you may be talking about the -e option to propeller-load which has always been there to write to EEPROM on P1 but now also is able to write to SPI flash on P2.
  • RaymanRayman Posts: 14,665
    edited 2013-03-28 11:19
    Is the pthreads library is for running multithreaded apps?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-28 11:31
    Rayman wrote: »
    Is the pthreads library is for running multithreaded apps?
    Yes it is. It's a subset of the standard Linux PThreads library. I believe it only does cooperative threading though. Since the Propeller doesn't have a clock interrupt, there is no good way to do timeslicing.
  • jazzedjazzed Posts: 11,803
    edited 2013-03-28 11:50
    Oh no. Thought I saw the I-word. LOL.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-28 12:29
    jazzed wrote: »
    Oh no. Thought I saw the I-word. LOL.
    L word? You mean Lisp? :-)
  • jazzedjazzed Posts: 11,803
    edited 2013-03-28 13:21
    Was wondering why it took you so long to reply on that lisp thread.
    I'll not repeat the eye-word here :)
  • RaymanRayman Posts: 14,665
    edited 2013-04-11 06:17
    When you do: propeller-elf-gcc --target-help
    I see in there:
    --p2 Enable Propeller 2 instructions.

    Is this automatically enabled by the -mp2 option?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-11 06:36
    Rayman wrote: »
    When you do: propeller-elf-gcc --target-help
    I see in there:
    --p2 Enable Propeller 2 instructions.

    Is this automatically enabled by the -mp2 option?
    That is an assembler option. The option to propeller-elf-gcc itself is -mp2.
  • RaymanRayman Posts: 14,665
    edited 2013-04-11 06:42
    When would one want to use the --p2 option?

    Do you need it for inline GAS assembly?
    Or, just pure GAS source files?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-11 07:08
    Rayman wrote: »
    When would one want to use the --p2 option?

    Do you need it for inline GAS assembly?
    Or, just pure GAS source files?
    You would use it if you invoke propeller-elf-as directly.
Sign In or Register to comment.