Squashed commit of the following:
include/nuttx/arch.h: Add prototype for an architecture-specific up_trigger_irq function arch/, include/nuttx, sched/sched: Add the garbage collection hook so each architecture can do custom memory cleanup if necesary. arch/Kconfig: Add configureation CONFIG_ARCH_GNU_NO_WEAKFUNCTIONS to suppress use of weak functions. Some gnu derived toolchains do not support weak symbols
This commit is contained in:
parent
0df5e56e20
commit
430bf16f1e
11
arch/Kconfig
11
arch/Kconfig
@ -139,6 +139,13 @@ config ARCH_TOOLCHAIN_GNU
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config ARCH_GNU_NO_WEAKFUNCTIONS
|
||||||
|
bool
|
||||||
|
depends on ARCH_TOOLCHAIN_GNU
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Disable support for weak functions.
|
||||||
|
|
||||||
comment "Architecture Options"
|
comment "Architecture Options"
|
||||||
|
|
||||||
config ARCH_NOINTC
|
config ARCH_NOINTC
|
||||||
@ -222,6 +229,10 @@ config ARCH_HAVE_RTC_SUBSECONDS
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config ARCH_HAVE_GARBAGE
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
config ARCH_GLOBAL_IRQDISABLE
|
config ARCH_GLOBAL_IRQDISABLE
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/arch.h
|
* include/nuttx/arch.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2017 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2018 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -732,7 +732,26 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_setpicbase, up_getpicbase
|
* Name: up_sched_have_garbage and up_sched_garbage_collection
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Some architectures may soft unique memory allocators. If
|
||||||
|
* CONFIG_ARCH_HAVE_GARBAGE is defined, those architectures must provide
|
||||||
|
* both up_sched_have_garbage and up_sched_garbage_collection. These will
|
||||||
|
* be tied into the NuttX memory garbage collection logic.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_HAVE_GARBAGE
|
||||||
|
bool up_sched_have_garbage(void);
|
||||||
|
void up_sched_garbage_collection(void);
|
||||||
|
#else
|
||||||
|
# define up_sched_have_garbage() false
|
||||||
|
# define up_sched_garbage_collection()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_setpicbase and up_getpicbase
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* It NXFLAT external modules (or any other binary format that requires)
|
* It NXFLAT external modules (or any other binary format that requires)
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
* unnecessary "weak" functions can be excluded from the link.
|
* unnecessary "weak" functions can be excluded from the link.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# ifndef __CYGWIN__
|
# if !defined(__CYGWIN__) && !defined(CONFIG_ARCH_GNU_NO_WEAKFUNCTIONS)
|
||||||
# define CONFIG_HAVE_WEAKFUNCTIONS 1
|
# define CONFIG_HAVE_WEAKFUNCTIONS 1
|
||||||
# define weak_alias(name, aliasname) \
|
# define weak_alias(name, aliasname) \
|
||||||
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/kmalloc.h
|
* include/nuttx/kmalloc.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008, 2011, 2013, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2008, 2011, 2013, 2016, 2018 Gregory Nutt. All
|
||||||
|
* rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -203,6 +204,10 @@ void sched_kfree(FAR void *address);
|
|||||||
# define sched_kfree(a) sched_ufree(a)
|
# define sched_kfree(a) sched_ufree(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Signal the worker thread that is has some clean up to do */
|
||||||
|
|
||||||
|
void sched_signal_free(void);
|
||||||
|
|
||||||
/* Functions defined in sched/sched_garbage *********************************/
|
/* Functions defined in sched/sched_garbage *********************************/
|
||||||
|
|
||||||
/* Must be called periodically to clean up deallocations delayed by
|
/* Must be called periodically to clean up deallocations delayed by
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/sched/sched_free.c
|
* sched/sched/sched_free.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2012-2013, 2015-2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2012-2013, 2015-2016, 2018 Gregory Nutt. All
|
||||||
|
* rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -105,9 +106,7 @@ void sched_ufree(FAR void *address)
|
|||||||
|
|
||||||
/* Signal the worker thread that is has some clean up to do */
|
/* Signal the worker thread that is has some clean up to do */
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
sched_signal_free();
|
||||||
work_signal(LPWORK);
|
|
||||||
#endif
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -146,9 +145,7 @@ void sched_kfree(FAR void *address)
|
|||||||
|
|
||||||
/* Signal the worker thread that is has some clean up to do */
|
/* Signal the worker thread that is has some clean up to do */
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
sched_signal_free();
|
||||||
work_signal(LPWORK);
|
|
||||||
#endif
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -160,3 +157,20 @@ void sched_kfree(FAR void *address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sched_signal_free
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Signal the worker thread that is has some clean up to do.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void sched_signal_free(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||||
|
/* Signal the worker thread that is has some clean up to do */
|
||||||
|
|
||||||
|
work_signal(LPWORK);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -237,6 +237,10 @@ void sched_garbage_collection(void)
|
|||||||
/* Handle deferred deallocations for the user heap */
|
/* Handle deferred deallocations for the user heap */
|
||||||
|
|
||||||
sched_kucleanup();
|
sched_kucleanup();
|
||||||
|
|
||||||
|
/* Handle the architecure-specific garbage collection */
|
||||||
|
|
||||||
|
up_sched_garbage_collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -264,5 +268,6 @@ void sched_garbage_collection(void)
|
|||||||
|
|
||||||
bool sched_have_garbage(void)
|
bool sched_have_garbage(void)
|
||||||
{
|
{
|
||||||
return (sched_have_kgarbage() || sched_have_kugarbage());
|
return (sched_have_kgarbage() || sched_have_kugarbage() ||
|
||||||
|
up_sched_have_garbage());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user