mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
NX: Use a consistent allocator in all configurations
This commit is contained in:
@@ -6345,5 +6345,7 @@
|
|||||||
* Moved configs/stm3240g-eval/src/up_cxxinitialize.c to
|
* Moved configs/stm3240g-eval/src/up_cxxinitialize.c to
|
||||||
apps/platform/stm3240g-eval/up_cxxinitialize.c: Now it is available
|
apps/platform/stm3240g-eval/up_cxxinitialize.c: Now it is available
|
||||||
in user-space in the kernel mode build (2013-12-29).
|
in user-space in the kernel mode build (2013-12-29).
|
||||||
|
* graphics/nxbe, nxsu, libnx/nxmu, and nxtk: Need to be consistent with
|
||||||
|
which allocator is used in the different configurations. Always uses
|
||||||
|
the user-space allocator because that one is required in certain
|
||||||
|
configurations (2013-12-30).
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ GNU Toolchain Options
|
|||||||
|
|
||||||
Most testing has been conducted using the CodeSourcery toolchain for Windows and
|
Most testing has been conducted using the CodeSourcery toolchain for Windows and
|
||||||
that is the default toolchain in most configurations (FPU-related testing has
|
that is the default toolchain in most configurations (FPU-related testing has
|
||||||
been performed with the Atolloc toolchain for windows. To use the Atollic,
|
been performed with the Atollic toolchain for windows. To use the Atollic,
|
||||||
devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
|
devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
|
||||||
add one of the following configuration options to your .config (or defconfig)
|
add one of the following configuration options to your .config (or defconfig)
|
||||||
file:
|
file:
|
||||||
@@ -115,7 +115,7 @@ GNU Toolchain Options
|
|||||||
The Atollic "Lite" Toolchain
|
The Atollic "Lite" Toolchain
|
||||||
----------------------------
|
----------------------------
|
||||||
The free, "Lite" version of the Atollic toolchain does not support C++ nor
|
The free, "Lite" version of the Atollic toolchain does not support C++ nor
|
||||||
does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
|
does it support ar, nm, objdump, or objcopy. If you use the Atollic "Lite"
|
||||||
toolchain, you will have to set:
|
toolchain, you will have to set:
|
||||||
|
|
||||||
CONFIG_HAVE_CXX=n
|
CONFIG_HAVE_CXX=n
|
||||||
@@ -162,7 +162,7 @@ IDEs
|
|||||||
2) Start the NuttX build at least one time from the Cygwin command line
|
2) Start the NuttX build at least one time from the Cygwin command line
|
||||||
before trying to create your project. This is necessary to create
|
before trying to create your project. This is necessary to create
|
||||||
certain auto-generated files and directories that will be needed.
|
certain auto-generated files and directories that will be needed.
|
||||||
3) Set up include pathes: You will need include/, arch/arm/src/stm32,
|
3) Set up include paths: You will need include/, arch/arm/src/stm32,
|
||||||
arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
|
arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
|
||||||
4) All assembly files need to have the definition option -D __ASSEMBLY__
|
4) All assembly files need to have the definition option -D __ASSEMBLY__
|
||||||
on the command line.
|
on the command line.
|
||||||
@@ -304,7 +304,7 @@ events as follows:
|
|||||||
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
|
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
|
||||||
and these LEDs will give you some indication of where the failure was
|
and these LEDs will give you some indication of where the failure was
|
||||||
** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
|
** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
|
||||||
is because of timer interupts that result in the LED being illuminated
|
is because of timer interrupts that result in the LED being illuminated
|
||||||
on a small proportion of the time.
|
on a small proportion of the time.
|
||||||
*** LED2 may also flicker normally if signals are processed.
|
*** LED2 may also flicker normally if signals are processed.
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ STM3240G-EVAL-specific Configuration Options
|
|||||||
|
|
||||||
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
||||||
cause a 100 second delay during boot-up. This 100 second delay
|
cause a 100 second delay during boot-up. This 100 second delay
|
||||||
serves no purpose other than it allows you to calibratre
|
serves no purpose other than it allows you to calibrate
|
||||||
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
||||||
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
||||||
the delay actually is 100 seconds.
|
the delay actually is 100 seconds.
|
||||||
@@ -805,7 +805,7 @@ STM3240G-EVAL-specific Configuration Options
|
|||||||
CONFIG_STM32_MII_MCO1 - Use MCO1 to clock the MII interface
|
CONFIG_STM32_MII_MCO1 - Use MCO1 to clock the MII interface
|
||||||
CONFIG_STM32_MII_MCO2 - Use MCO2 to clock the MII interface
|
CONFIG_STM32_MII_MCO2 - Use MCO2 to clock the MII interface
|
||||||
CONFIG_STM32_RMII - Support Ethernet RMII interface
|
CONFIG_STM32_RMII - Support Ethernet RMII interface
|
||||||
CONFIG_STM32_AUTONEG - Use PHY autonegotion to determine speed and mode
|
CONFIG_STM32_AUTONEG - Use PHY autonegotiation to determine speed and mode
|
||||||
CONFIG_STM32_ETHFD - If CONFIG_STM32_AUTONEG is not defined, then this
|
CONFIG_STM32_ETHFD - If CONFIG_STM32_AUTONEG is not defined, then this
|
||||||
may be defined to select full duplex mode. Default: half-duplex
|
may be defined to select full duplex mode. Default: half-duplex
|
||||||
CONFIG_STM32_ETH100MBPS - If CONFIG_STM32_AUTONEG is not defined, then this
|
CONFIG_STM32_ETH100MBPS - If CONFIG_STM32_AUTONEG is not defined, then this
|
||||||
@@ -1067,7 +1067,7 @@ Where <subdir> is one of the following:
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
This configuration directory may be used to verify networking performance
|
This configuration directory may be used to verify networking performance
|
||||||
using the STM32's Ethernet controller. It uses apps/examples/nettest to excercise the
|
using the STM32's Ethernet controller. It uses apps/examples/nettest to exercise the
|
||||||
TCP/IP network.
|
TCP/IP network.
|
||||||
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVER=n : Target is configured as the client
|
CONFIG_EXAMPLES_NETTEST_SERVER=n : Target is configured as the client
|
||||||
@@ -1409,7 +1409,7 @@ Where <subdir> is one of the following:
|
|||||||
Here is the quick summary of the build steps (Assuming that all of
|
Here is the quick summary of the build steps (Assuming that all of
|
||||||
the required packages are available in a directory ~/nuttx-code):
|
the required packages are available in a directory ~/nuttx-code):
|
||||||
|
|
||||||
1. Intall the nxwm configuration
|
1. Install the nxwm configuration
|
||||||
|
|
||||||
$ cd ~/nuttx-code/nuttx/tools
|
$ cd ~/nuttx-code/nuttx/tools
|
||||||
$ ./configure.sh stm3240g-eval/nxwm
|
$ ./configure.sh stm3240g-eval/nxwm
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack,
|
|||||||
|
|
||||||
if ((stack->npushed + 1) > stack->mxrects)
|
if ((stack->npushed + 1) > stack->mxrects)
|
||||||
{
|
{
|
||||||
/* No then we will need to reallocate the stack to hole more */
|
/* No then we will need to reallocate the stack to hold more */
|
||||||
|
|
||||||
int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE;
|
int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE;
|
||||||
struct nxbe_cliprect_s *newstack;
|
struct nxbe_cliprect_s *newstack;
|
||||||
|
|||||||
@@ -39,11 +39,12 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
|
||||||
#include "nxbe.h"
|
#include "nxbe.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -77,7 +78,8 @@
|
|||||||
* Close an existing window
|
* Close an existing window
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* wnd - The window to be closed (and deallocated)
|
* wnd - The window to be closed (and deallocated using the user-space
|
||||||
|
* allocator)
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* None
|
* None
|
||||||
@@ -131,7 +133,9 @@ void nxbe_closewindow(struct nxbe_window_s *wnd)
|
|||||||
|
|
||||||
nxbe_redrawbelow(be, wnd->below, &wnd->bounds);
|
nxbe_redrawbelow(be, wnd->below, &wnd->bounds);
|
||||||
|
|
||||||
/* Then discard the window structure */
|
/* Then discard the window structure. Here we assume that the user-space
|
||||||
|
* allocator was used.
|
||||||
|
*/
|
||||||
|
|
||||||
free(wnd);
|
umm_free(wnd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,8 @@
|
|||||||
|
|
||||||
void nx_close(NXHANDLE handle)
|
void nx_close(NXHANDLE handle)
|
||||||
{
|
{
|
||||||
kfree(handle);
|
/* For consistency, we use the user-space allocate (if available) */
|
||||||
|
|
||||||
|
umm_free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW wnd,
|
|||||||
|
|
||||||
if (!fe || !cb)
|
if (!fe || !cb)
|
||||||
{
|
{
|
||||||
kfree(wnd);
|
umm_free(wnd);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,9 +195,11 @@ NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate the NX state structure */
|
/* Allocate the NX state structure. The user-space allocator is used
|
||||||
|
* (if available) for compatibility with the multi-user implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
fe = (FAR struct nxfe_state_s *)kzalloc(sizeof(struct nxfe_state_s));
|
fe = (FAR struct nxfe_state_s *)umm_zalloc(sizeof(struct nxfe_state_s));
|
||||||
if (!fe)
|
if (!fe)
|
||||||
{
|
{
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
|||||||
@@ -103,9 +103,11 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pre-allocate the window structure */
|
/* Pre-allocate the window structure. The user-space allocator is used (if
|
||||||
|
* available) for compatibility with the multi-user implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
wnd = (FAR struct nxbe_window_s *)kzalloc(sizeof(struct nxbe_window_s));
|
wnd = (FAR struct nxbe_window_s *)umm_zalloc(sizeof(struct nxbe_window_s));
|
||||||
if (!wnd)
|
if (!wnd)
|
||||||
{
|
{
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname)
|
|||||||
|
|
||||||
/* Allocate the NX client structure */
|
/* Allocate the NX client structure */
|
||||||
|
|
||||||
conn = (FAR struct nxfe_conn_s *)lib_zalloc(sizeof(struct nxfe_conn_s));
|
conn = (FAR struct nxfe_conn_s *)lib_uzalloc(sizeof(struct nxfe_conn_s));
|
||||||
if (!conn)
|
if (!conn)
|
||||||
{
|
{
|
||||||
set_errno(ENOMEM);
|
set_errno(ENOMEM);
|
||||||
@@ -215,7 +215,7 @@ errout_with_wmq:
|
|||||||
errout_with_rmq:
|
errout_with_rmq:
|
||||||
mq_close(conn->crdmq);
|
mq_close(conn->crdmq);
|
||||||
errout_with_conn:
|
errout_with_conn:
|
||||||
lib_free(conn);
|
lib_ufree(conn);
|
||||||
errout:
|
errout:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
|
|||||||
|
|
||||||
if (!conn || !cb)
|
if (!conn || !cb)
|
||||||
{
|
{
|
||||||
lib_free(wnd);
|
lib_ufree(wnd);
|
||||||
set_errno(EINVAL);
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ static inline void nx_disconnected(FAR struct nxfe_conn_s *conn)
|
|||||||
|
|
||||||
/* And free the client structure */
|
/* And free the client structure */
|
||||||
|
|
||||||
lib_free(conn);
|
lib_ufree(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
|
|||||||
|
|
||||||
/* Pre-allocate the window structure */
|
/* Pre-allocate the window structure */
|
||||||
|
|
||||||
wnd = (FAR struct nxbe_window_s *)lib_zalloc(sizeof(struct nxbe_window_s));
|
wnd = (FAR struct nxbe_window_s *)lib_uzalloc(sizeof(struct nxbe_window_s));
|
||||||
if (!wnd)
|
if (!wnd)
|
||||||
{
|
{
|
||||||
set_errno(ENOMEM);
|
set_errno(ENOMEM);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
|
|||||||
/* Pre-allocate the window structure */
|
/* Pre-allocate the window structure */
|
||||||
|
|
||||||
fwnd = (FAR struct nxtk_framedwindow_s *)
|
fwnd = (FAR struct nxtk_framedwindow_s *)
|
||||||
lib_zalloc(sizeof(struct nxtk_framedwindow_s));
|
lib_uzalloc(sizeof(struct nxtk_framedwindow_s));
|
||||||
|
|
||||||
if (!fwnd)
|
if (!fwnd)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user