Changeset 1b89636 in rtems_waf


Ignore:
Timestamp:
Oct 18, 2018, 7:36:17 AM (5 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Parents:
2fec1c5
git-author:
Sebastian Huber <sebastian.huber@…> (10/18/18 07:36:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/22/18 05:45:43)
Message:

Avoid default RTEMS application configuration

Use a test body with a proper RTEMS application configuration to avoid a
dependency on the default configuration. Do not include
<rtems/score/cpuopts.h> directly since this header file is an
implementation detail.

Update #3551.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtems.py

    r2fec1c5 r1b89636  
    144144        bsp_init(ctx, env, contexts)
    145145
     146def test_application(more = []):
     147    code =  ['#include <rtems.h>']
     148    code += more
     149    code += ['void Init(rtems_task_argument arg) { (void)arg; }']
     150    code += ['#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER']
     151    code += ['#define CONFIGURE_MAXIMUM_TASKS 1']
     152    code += ['#define CONFIGURE_RTEMS_INIT_TASKS_TABLE']
     153    code += ['#define CONFIGURE_INIT']
     154    code += ['#include <rtems/confdefs.h>']
     155    return os.linesep.join(code)
     156
    146157def configure(conf, bsp_configure = None):
    147158    #
     
    189200        conf.setenv(ab, env)
    190201
    191         conf.msg('Board Support Package', ab, 'YELLOW')
     202        conf.msg('Board Support Package (BSP)', ab, 'YELLOW')
    192203
    193204        #
     
    260271        # Checks for various RTEMS features.
    261272        #
    262         conf.multicheck({ 'header_name': 'rtems/score/cpuopts.h'},
    263                         msg = 'Checking for RTEMS CPU options header',
    264                         mandatory = True)
    265         load_cpuopts(conf, ab, rtems_path)
    266         conf.multicheck({ 'header_name': 'rtems.h'},
    267                         msg = 'Checking for RTEMS header',
    268                         mandatory = True)
     273        conf.check_cc(fragment = test_application(),
     274                      execute = False,
     275                      msg = 'Checking for a valid RTEMS BSP installation')
     276        load_cpuopts(conf)
    269277
    270278        #
     
    295303        long_command_line()
    296304
    297 def load_cpuopts(conf, arch_bsp, rtems_path):
     305def load_cpuopts(conf):
    298306    options = ['RTEMS_DEBUG',
    299307               'RTEMS_MULTIPROCESSING',
     
    303311               'RTEMS_NETWORKING']
    304312    for opt in options:
    305         enabled = check_opt(conf, opt, 'rtems/score/cpuopts.h', arch_bsp, rtems_path)
     313        enabled = check_cpuopt(conf, opt)
    306314        if enabled:
    307315            conf.env[opt] = 'Yes'
     
    309317            conf.env[opt] = 'No'
    310318
    311 def check_opt(conf, opt, header, arch_bsp, rtems_path):
    312     code  = '#include <%s>%s' % (header, os.linesep)
    313     code += '#ifndef %s%s' % (opt, os.linesep)
    314     code += ' #error %s is not defined%s' % (opt, os.linesep)
    315     code += '#endif%s' % (os.linesep)
    316     code += '#if %s%s' % (opt, os.linesep)
    317     code += ' /* %s is true */%s' % (opt, os.linesep)
    318     code += '#else%s' % (os.linesep)
    319     code += ' #error %s is false%s' % (opt, os.linesep)
    320     code += '#endif%s' % (os.linesep)
    321     code += 'int main() { return 0; }%s' % (os.linesep)
     319def check_cpuopt(conf, opt):
     320    code =  ['#ifndef %s' % (opt)]
     321    code += ['  #error %s is not defined' % (opt)]
     322    code += ['#endif']
     323    code += ['#if %s' % (opt)]
     324    code += ['  /* %s is true */' % (opt)]
     325    code += ['#else']
     326    code += ['  #error %s is false' % (opt)]
     327    code += ['#endif']
    322328    try:
    323         conf.check_cc(fragment = code,
     329        conf.check_cc(fragment = test_application(code),
    324330                      execute = False,
    325                       define_ret = False,
    326331                      msg = 'Checking for %s' % (opt))
    327332    except conf.errors.WafError:
Note: See TracChangeset for help on using the changeset viewer.