Straighten out conditional compilation
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1896 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
fe5083b49a
commit
ab90735870
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/include/arch.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,41 @@
|
|||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* This identifies the register the is used by the processor as the PIC base
|
||||
* register. It is usually r9 or r10
|
||||
*/
|
||||
|
||||
#define PIC_REG r10
|
||||
#define PIC_REG_STRING "r10"
|
||||
|
||||
/* Macros to get and set the PIC base register. picbase is assumed to be
|
||||
* of type (void*) and that it will fit into a uint32. These must be
|
||||
* inline so that they will be compatible with the ABIs rules for
|
||||
* preserving the PIC register
|
||||
*/
|
||||
|
||||
#define up_getpicbase(ppicbase) \
|
||||
do { \
|
||||
uint32 picbase; \
|
||||
__asm__ \
|
||||
( \
|
||||
"\tmov %0, " PIC_REG_STRING "\n\t" \
|
||||
: "=r"(picbase) \
|
||||
); \
|
||||
*ppicbase = (FAR void*)picbase; \
|
||||
} while (0)
|
||||
|
||||
#define up_setpicbase(picbase) \
|
||||
do { \
|
||||
uint32 _picbase = (uint32)picbase; \
|
||||
__asm__ \
|
||||
( \
|
||||
"\tmov " PIC_REG_STRING ", %0\n\t" \
|
||||
: : "r"(_picbase) : PIC_REG_STRING \
|
||||
); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_BINFMT)
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_BINFMT) && !defined(CONFIG_BINFMT_DISABLE)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include "os_internal.h"
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -142,11 +144,13 @@ int exec_module(FAR const struct binary_s *bin, int priority)
|
|||
|
||||
/* Add the DSpace address as the PIC base address */
|
||||
|
||||
#ifdef CONFIG_PIC
|
||||
tcb->picbase = bin->dspace;
|
||||
|
||||
/* Re-initialize the task's initial state to account for the new PIC base */
|
||||
|
||||
up_initial_state(tcb);
|
||||
#endif
|
||||
|
||||
/* Get the assigned pid before we start the task */
|
||||
|
||||
|
@ -181,4 +185,5 @@ errout:
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
#include <nuttx/binfmt.h>
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -61,7 +63,10 @@ FAR struct binfmt_s *g_binfmts;
|
|||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
***********************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -136,4 +138,5 @@ int load_module(const char *filename, FAR struct binary_s *bin)
|
|||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -99,4 +101,5 @@ int register_binfmt(FAR struct binfmt_s *binfmt)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -103,3 +105,5 @@ int unload_module(FAR const struct binary_s *bin)
|
|||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#include "binfmt_internal.h"
|
||||
|
||||
#ifndef CONFIG_BINFMT_DISABLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -133,4 +135,5 @@ int unregister_binfmt(FAR struct binfmt_s *binfmt)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include <nuttx/binfmt.h>
|
||||
#include <nuttx/nxflat.h>
|
||||
|
||||
#ifdef CONFIG_NXFLAT
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -235,3 +237,5 @@ void nxflat_uninitialize(void)
|
|||
unregister_binfmt(&g_nxflatbinfmt);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NXFLAT */
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_H
|
||||
#define __ARCH_H
|
||||
#ifndef __INCLUDE_NUTTX_ARCH_H
|
||||
#define __INCLUDE_NUTTX_ARCH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
|
@ -367,15 +367,16 @@ EXTERN void up_allocate_heap(FAR void **heap_start, size_t *heap_size);
|
|||
* Name: up_setpicbase, up_getpicbase
|
||||
*
|
||||
* Description:
|
||||
* It NXFLAT external modules are supported, then these macros must
|
||||
* defined to (1) get or get the PIC base register value. These must
|
||||
* be done with in-line assembly.
|
||||
* It NXFLAT external modules (or any other binary format that requires)
|
||||
* PIC) are supported, then these macros must defined to (1) get or get
|
||||
* the PIC base register value. These must be implemented with in-line
|
||||
* assembly.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NXFLAT
|
||||
#ifndef CONFIG_PIC
|
||||
# define up_setpicbase(picbase)
|
||||
# define up_getpicbase()
|
||||
# define up_getpicbase(ppicbase)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -529,5 +530,5 @@ EXTERN int up_putc(int ch);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_H */
|
||||
#endif /* __INCLUDE_NUTTX_ARCH_H */
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ struct _TCB
|
|||
|
||||
/* External Module Support ****************************************************/
|
||||
|
||||
#ifdef CONFIG_NXFLAT
|
||||
#ifdef CONFIG_PIC
|
||||
FAR void *picbase; /* Allocated area for .bss and .data */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ int sched_releasetcb(FAR _TCB *tcb)
|
|||
|
||||
/* Delete the tasks's allocated DSpace region (external modules only) */
|
||||
|
||||
#ifdef CONFIG_NXFLAT
|
||||
#ifdef CONFIG_PIC
|
||||
if (tcb->picbase)
|
||||
{
|
||||
sched_free(tcb->picbase);
|
||||
|
|
|
@ -65,7 +65,7 @@ struct wdog_s
|
|||
{
|
||||
FAR struct wdog_s *next; /* Support for singly linked lists. */
|
||||
wdentry_t func; /* Function to execute when delay expires */
|
||||
#ifdef CONFIG_NXFLAT
|
||||
#ifdef CONFIG_PIC
|
||||
FAR void *picbase; /* PIC base address */
|
||||
#endif
|
||||
int lag; /* Timer associated with the delay */
|
||||
|
|
|
@ -158,8 +158,8 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...)
|
|||
/* Save the data in the watchdog structure */
|
||||
|
||||
wdog->func = wdentry; /* Function to execute when delay expires */
|
||||
#ifdef CONFIG_NXFLAT
|
||||
wdog->picbase = up_getpicbase();
|
||||
#ifdef CONFIG_PIC
|
||||
up_getpicbase(&wdog->picbase);
|
||||
#endif
|
||||
wdog->argc = argc;
|
||||
|
||||
|
|
|
@ -220,6 +220,19 @@ int main(int argc, char **argv, char **envp)
|
|||
printf("#if defined(__NXFLAT__) && !defined(CONFIG_NXFLAT)\n");
|
||||
printf("# error \"NXFLAT support not enabled in this configuration\"\n");
|
||||
printf("#endif\n\n");
|
||||
printf("/* NXFLAT requires PIC support in the TCBs. */\n\n");
|
||||
printf("#if defined(CONFIG_NXFLAT)\n");
|
||||
printf("# undef CONFIG_PIC\n");
|
||||
printf("# define CONFIG_PIC 1\n");
|
||||
printf("#endif\n\n");
|
||||
printf("/* Binary format support is disabled if no binary formats are\n");
|
||||
printf(" * configured (at present, NXFLAT is the only supported binary.\n");
|
||||
printf(" * format).\n");
|
||||
printf(" */\n\n");
|
||||
printf("#if !defined(CONFIG_NXFLAT)\n");
|
||||
printf("# undef CONFIG_BINFMT_DISABLE\n");
|
||||
printf("# define CONFIG_BINFMT_DISABLE 1\n");
|
||||
printf("#endif\n\n");
|
||||
printf("/* The correct way to disable RR scheduling is to set the\n");
|
||||
printf(" * timeslice to zero.\n");
|
||||
printf(" */\n\n");
|
||||
|
|
Loading…
Reference in New Issue