On 18/10/18 6:38 pm, Sebastian Huber wrote: > 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. > --- > rtems.py | 30 +++++++++++++++++------------- > 1 file changed, 17 insertions(+), 13 deletions(-) > > diff --git a/rtems.py b/rtems.py > index 1b0da60..c7a1966 100644 > --- a/rtems.py > +++ b/rtems.py > @@ -259,13 +259,18 @@ def configure(conf, bsp_configure = None): > # > # Checks for various RTEMS features. > # > - conf.multicheck({ 'header_name': 'rtems/score/cpuopts.h'}, > - msg = 'Checking for RTEMS CPU options header', > - mandatory = True) > - load_cpuopts(conf, ab, rtems_path)
OK. > - conf.multicheck({ 'header_name': 'rtems.h'}, > - msg = 'Checking for RTEMS header', > - mandatory = True) Why remove the test? I see the app test below checks for the header however the test creates a nice specific error message. > + main = 'void Init(rtems_task_argument arg) { (void)arg; }%s' % > (os.linesep) > + main += '#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER > 1%s' % (os.linesep) > + main += '#define CONFIGURE_MAXIMUM_TASKS 1%s' % (os.linesep) > + main += '#define CONFIGURE_RTEMS_INIT_TASKS_TABLE%s' % (os.linesep) > + main += '#define CONFIGURE_INIT%s' % (os.linesep) > + main += '#include <rtems/confdefs.h>%s' % (os.linesep) > + code = '#include <rtems.h>%s' % (os.linesep) > + code += main I wonder if this fragment should be placed in a function called 'test_application' so it is called rather than passing 'main' about? ie .. def test_applicaiton(code = []): main = ['void Init(rtems_task_argument arg) { (void)arg; }'] main += ['#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 1'] main += ['#define CONFIGURE_MAXIMUM_TASKS 1'] main += ['#define CONFIGURE_RTEMS_INIT_TASKS_TABLE]' main += ['#define CONFIGURE_INIT'] main += ['#include <rtems/confdefs.h>'] return os.linesep.join(code + main) [ Why not include confdefs.h in the `main` code? ] then this ... > + conf.check_cc(fragment = code, > + execute = False, > + msg = 'Building a trivial RTEMS application') becomes ... code = ['#include <rtems/confdefs.h>'] conf.check_cc(fragment = test_application(code), execute = False, msg = 'Building a trivial RTEMS application') or ... conf.check_cc(fragment = test_application(), execute = False, msg = 'Building a trivial RTEMS application') if confdefs.h is part of 'main'. The opts check becomes even simpler. > + load_cpuopts(conf, main) > > # > # Add tweaks. > @@ -294,7 +299,7 @@ def build(bld): > if bld.env.LONG_COMMANDS == 'yes': > long_command_line() > > -def load_cpuopts(conf, arch_bsp, rtems_path): > +def load_cpuopts(conf, main): > options = ['RTEMS_DEBUG', > 'RTEMS_MULTIPROCESSING', > 'RTEMS_NEWLIB', > @@ -302,14 +307,14 @@ def load_cpuopts(conf, arch_bsp, rtems_path): > 'RTEMS_SMP', > 'RTEMS_NETWORKING'] > for opt in options: > - enabled = check_opt(conf, opt, 'rtems/score/cpuopts.h', arch_bsp, > rtems_path) > + enabled = check_cpuopt(conf, opt, main) > if enabled: > conf.env[opt] = 'Yes' > else: > conf.env[opt] = 'No' > > -def check_opt(conf, opt, header, arch_bsp, rtems_path): > - code = '#include <%s>%s' % (header, os.linesep) > +def check_cpuopt(conf, opt, main): > + code = '#include <rtems.h>%s' % (os.linesep) > code += '#ifndef %s%s' % (opt, os.linesep) > code += ' #error %s is not defined%s' % (opt, os.linesep) > code += '#endif%s' % (os.linesep) > @@ -318,11 +323,10 @@ def check_opt(conf, opt, header, arch_bsp, rtems_path): > code += '#else%s' % (os.linesep) > code += ' #error %s is false%s' % (opt, os.linesep) > code += '#endif%s' % (os.linesep) > - code += 'int main() { return 0; }%s' % (os.linesep) > + code += main > try: > conf.check_cc(fragment = code, > execute = False, > - define_ret = False, > msg = 'Checking for %s' % (opt)) > except conf.errors.WafError: > return False; Thanks Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel