xc16_gcc.py - Configure waf for the xc16 compilerΒΆ

This was copied from waf v1.8.21 then modified for the xc16 compiler.

 
#!/usr/bin/env python

encoding: utf-8 Thomas Nagy, 2006-2010 (ita) Ralf Habacker, 2006 (rh) Yinon Ehrlich, 2009

 

gcc/llvm detection.

 
from waflib.Tools.gcc import configure
from waflib.Tools import ccroot
import xc16_ar
from waflib.Configure import conf

@conf
def find_gcc(conf):

Find the program gcc, and if present, try to detect its version number

    cc = conf.find_program(['xc16-gcc'], var='CC')
    conf.get_cc_version(cc, gcc=True)
    conf.env.CC_NAME = 'xc16-gcc'

@conf
def gcc_modifier_PIC24(conf):
    v = conf.env
    v['cprogram_PATTERN'] = '%s.elf'
    v.append_value('CFLAGS', [

Select the processor.

      '-mcpu={MCU}'.format(**v),

Create an ELF-formatted binary.

      '-omf=elf',

Generate debugging info

      '-g',

For debug, don’t optimize.

      '-O0',

Analyze printf strings to see if the integer-only variant of printf can be used. See the manual.

      '-msmart-io=1',

Turn on helpful warnings.

      '-Wall', '-Wextra', '-Wdeclaration-after-statement', '-Wlong-long',
    ])
    v.append_value('LINKFLAGS', [
      '-omf=elf',
      '-Wl,--heap=100,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--no-cpp',
    ])