NX: Use a consistent allocator in all configurations

This commit is contained in:
Gregory Nutt 2013-12-30 12:42:18 -06:00
parent 4c3b605c19
commit f51f85db37
13 changed files with 40 additions and 28 deletions

View File

@ -6345,5 +6345,7 @@
* Moved configs/stm3240g-eval/src/up_cxxinitialize.c to
apps/platform/stm3240g-eval/up_cxxinitialize.c: Now it is available
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).

View File

@ -49,7 +49,7 @@ GNU Toolchain Options
Most testing has been conducted using the CodeSourcery toolchain for Windows and
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
add one of the following configuration options to your .config (or defconfig)
file:
@ -115,7 +115,7 @@ GNU Toolchain Options
The Atollic "Lite" Toolchain
----------------------------
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:
CONFIG_HAVE_CXX=n
@ -162,7 +162,7 @@ IDEs
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
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/.
4) All assembly files need to have the definition option -D __ASSEMBLY__
on the command line.
@ -304,7 +304,7 @@ events as follows:
* 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
** 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.
*** LED2 may also flicker normally if signals are processed.
@ -331,7 +331,7 @@ the LCD).
ACCESS:
Daughterboard Extension Connector, CN3, pin 32
Daughter board Extension Connector, CN3, pin 32
Ground is available on CN3, pin1
NOTE: TIM4 hardware will not support pulse counting.
@ -670,7 +670,7 @@ STM3240G-EVAL-specific Configuration Options
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
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
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
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_MCO2 - Use MCO2 to clock the MII 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
may be defined to select full duplex mode. Default: half-duplex
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
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.
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
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
$ ./configure.sh stm3240g-eval/nxwm

View File

@ -110,7 +110,7 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack,
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;
struct nxbe_cliprect_s *newstack;

View File

@ -39,11 +39,12 @@
#include <nuttx/config.h>
#include <stdlib.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/nx/nxglib.h>
#include "nxbe.h"
/****************************************************************************
@ -77,7 +78,8 @@
* Close an existing window
*
* Input Parameters:
* wnd - The window to be closed (and deallocated)
* wnd - The window to be closed (and deallocated using the user-space
* allocator)
*
* Return:
* None
@ -131,7 +133,9 @@ void nxbe_closewindow(struct nxbe_window_s *wnd)
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);
}

View File

@ -88,6 +88,8 @@
void nx_close(NXHANDLE handle)
{
kfree(handle);
/* For consistency, we use the user-space allocate (if available) */
umm_free(handle);
}

View File

@ -116,7 +116,7 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW wnd,
if (!fe || !cb)
{
kfree(wnd);
umm_free(wnd);
errno = EINVAL;
return ERROR;
}

View File

@ -195,9 +195,11 @@ NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev)
}
#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)
{
errno = ENOMEM;

View File

@ -103,9 +103,11 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
}
#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)
{
errno = ENOMEM;

View File

@ -132,7 +132,7 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname)
/* 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)
{
set_errno(ENOMEM);
@ -215,7 +215,7 @@ errout_with_wmq:
errout_with_rmq:
mq_close(conn->crdmq);
errout_with_conn:
lib_free(conn);
lib_ufree(conn);
errout:
return NULL;
}

View File

@ -117,7 +117,7 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
if (!conn || !cb)
{
lib_free(wnd);
lib_ufree(wnd);
set_errno(EINVAL);
return ERROR;
}

View File

@ -99,7 +99,7 @@ static inline void nx_disconnected(FAR struct nxfe_conn_s *conn)
/* And free the client structure */
lib_free(conn);
lib_ufree(conn);
}
/****************************************************************************

View File

@ -105,7 +105,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
/* 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)
{
set_errno(ENOMEM);

View File

@ -131,7 +131,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
/* Pre-allocate the window structure */
fwnd = (FAR struct nxtk_framedwindow_s *)
lib_zalloc(sizeof(struct nxtk_framedwindow_s));
lib_uzalloc(sizeof(struct nxtk_framedwindow_s));
if (!fwnd)
{