Index: c/src/lib/libbsp/arm/lpc176x/Makefile.am
===================================================================
--- c/src/lib/libbsp/arm/lpc176x/Makefile.am	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/arm/lpc176x/Makefile.am	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -95,4 +95,5 @@
 libbsp_a_SOURCES += ../../shared/bsplibc.c
 libbsp_a_SOURCES += ../../shared/bsppost.c
+libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
 libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
 libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
Index: c/src/lib/libbsp/arm/lpc176x/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/arm/lpc176x/startup/bspstart.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/arm/lpc176x/startup/bspstart.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -43,5 +43,5 @@
 #endif
 
-void bsp_pretasking_hook( void )
+static void heap_extend( void )
 {
 #ifdef LPC176X_HEAP_EXTEND
@@ -87,3 +87,5 @@
   /* DMA */
   lpc176x_dma_initialize();
+
+  heap_extend();
 }
Index: c/src/lib/libbsp/arm/lpc24xx/Makefile.am
===================================================================
--- c/src/lib/libbsp/arm/lpc24xx/Makefile.am	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/arm/lpc24xx/Makefile.am	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -97,4 +97,5 @@
 	../../shared/bsplibc.c \
 	../../shared/bsppost.c \
+	../../shared/bsppretaskinghook.c \
 	../../shared/bsppredriverhook.c \
 	../../shared/gnatinstallhandler.c \
Index: c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -44,5 +44,5 @@
 #endif
 
-void bsp_pretasking_hook(void)
+static void heap_extend(void)
 {
   #ifdef LPC24XX_HEAP_EXTEND
@@ -92,3 +92,5 @@
   /* DMA */
   lpc24xx_dma_initialize();
+
+  heap_extend();
 }
Index: c/src/lib/libbsp/i386/pc386/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i386/pc386/include/bsp.h	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/i386/pc386/include/bsp.h	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -188,6 +188,4 @@
 void rtems_irq_mngt_init(void);          /* from 'irq_init.c' */
 
-void bsp_size_memory(void);              /* from 'bspstart.c' */
-
 #if (BSP_IS_EDISON == 0)
   void Clock_driver_install_handler(void);             /* from 'ckinit.c'  */
Index: c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c
===================================================================
--- c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -53,5 +53,5 @@
 extern uint32_t _stack_size;
 
-void bsp_size_memory(void)
+static void bsp_size_memory(void)
 {
   uintptr_t topAddr;
@@ -127,7 +127,14 @@
 void bsp_work_area_initialize(void)
 {
-  void *area_start = (void *) rtemsWorkAreaStart;
-  uintptr_t area_size  = (uintptr_t) bsp_mem_size - (uintptr_t) rtemsWorkAreaStart;
+  void *area_start;
+  uintptr_t area_size;
 
+  /*
+   *  We need to determine how much memory there is in the system.
+   */
+  bsp_size_memory();
+
+  area_start = (void *) rtemsWorkAreaStart;
+  area_size  = (uintptr_t) bsp_mem_size - (uintptr_t) rtemsWorkAreaStart;
   bsp_work_area_initialize_default( area_start, area_size );
 }
Index: c/src/lib/libbsp/i386/pc386/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/pc386/startup/bspstart.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/i386/pc386/startup/bspstart.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -59,9 +59,4 @@
 {
   /*
-   *  We need to determine how much memory there is in the system.
-   */
-  bsp_size_memory();
-
-  /*
    * Turn off watchdog
    */
Index: c/src/lib/libbsp/shared/bootcard.c
===================================================================
--- c/src/lib/libbsp/shared/bootcard.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/shared/bootcard.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -76,12 +76,12 @@
 
   /*
+   *  Initialize the RTEMS Workspace and the C Program Heap.
+   */
+  bsp_work_area_initialize();
+
+  /*
    * Invoke Board Support Package initialization routine written in C.
    */
   bsp_start();
-
-  /*
-   *  Initialize the RTEMS Workspace and the C Program Heap.
-   */
-  bsp_work_area_initialize();
 
   /*
Index: c/src/lib/libbsp/shared/include/bootcard.h
===================================================================
--- c/src/lib/libbsp/shared/include/bootcard.h	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/shared/include/bootcard.h	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -79,7 +79,7 @@
  * - disable interrupts, interrupts will be enabled during the first context
  *   switch
- * - bsp_start() - more advanced initialization
  * - bsp_work_area_initialize() - initialize the RTEMS Workspace and the C
  *   Program Heap
+ * - bsp_start() - more advanced initialization
  * - rtems_initialize_data_structures()
  * - initialize C Library
Index: c/src/lib/libbsp/sparc/erc32/Makefile.am
===================================================================
--- c/src/lib/libbsp/sparc/erc32/Makefile.am	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/erc32/Makefile.am	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -44,5 +44,4 @@
 libbsp_a_SOURCES += startup/bspidle.c
 libbsp_a_SOURCES += startup/bspdelay.c
-libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
 libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_exit.c
 libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_halt.c
Index: c/src/lib/libbsp/sparc/erc32/include/bsp.h
===================================================================
--- c/src/lib/libbsp/sparc/erc32/include/bsp.h	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/erc32/include/bsp.h	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -93,11 +93,4 @@
 
 void bsp_spurious_initialize( void );
-
-/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
- * can be called at any time. The work-area will shrink when called before
- * bsp_work_area_initialize(). malloc() is called to get memory when this
- * function is called after bsp_work_area_initialize().
- */
-void *bsp_early_malloc(int size);
 
 /* Interrupt Service Routine (ISR) pointer */
Index: c/src/lib/libbsp/sparc/leon2/Makefile.am
===================================================================
--- c/src/lib/libbsp/sparc/leon2/Makefile.am	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/leon2/Makefile.am	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -43,5 +43,4 @@
 libbsp_a_SOURCES += startup/bspidle.c
 libbsp_a_SOURCES += startup/bspdelay.c
-libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
 libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_exit.c
 libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_halt.c
Index: c/src/lib/libbsp/sparc/leon2/include/bsp.h
===================================================================
--- c/src/lib/libbsp/sparc/leon2/include/bsp.h	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/leon2/include/bsp.h	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -118,11 +118,4 @@
 void bsp_spurious_initialize( void );
 
-/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
- * can be called at any time. The work-area will shrink when called before
- * bsp_work_area_initialize(). malloc() is called to get memory when this
- * function is called after bsp_work_area_initialize().
- */
-void *bsp_early_malloc(int size);
-
 /* Interrupt Service Routine (ISR) pointer */
 typedef void (*bsp_shared_isr)(void *arg);
Index: c/src/lib/libbsp/sparc/leon3/Makefile.am
===================================================================
--- c/src/lib/libbsp/sparc/leon3/Makefile.am	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/leon3/Makefile.am	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -39,6 +39,5 @@
     ../../sparc/shared/startup/bspgetworkarea.c ../../shared/sbrk.c \
     startup/setvec.c \
-    startup/spurious.c startup/bspidle.S startup/bspdelay.c \
-    ../../sparc/shared/startup/early_malloc.c
+    startup/spurious.c startup/bspidle.S startup/bspdelay.c
 libbsp_a_SOURCES += startup/cpucounter.c
 libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_exit.c
Index: c/src/lib/libbsp/sparc/leon3/include/bsp.h
===================================================================
--- c/src/lib/libbsp/sparc/leon3/include/bsp.h	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/leon3/include/bsp.h	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -140,11 +140,4 @@
  */
 void rtems_bsp_delay(int usecs);
-
-/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
- * can be called at any time. The work-area will shrink when called before
- * bsp_work_area_initialize(). malloc() is called to get memory when this
- * function is called after bsp_work_area_initialize().
- */
-void *bsp_early_malloc(int size);
 
 /* Interrupt Service Routine (ISR) pointer */
Index: c/src/lib/libbsp/sparc/shared/amba/ambapp.c
===================================================================
--- c/src/lib/libbsp/sparc/shared/amba/ambapp.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/shared/amba/ambapp.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -24,6 +24,6 @@
 static struct ambapp_dev *ambapp_alloc_dev_struct(int dev_type)
 {
-  int size = sizeof(struct ambapp_dev);
   struct ambapp_dev *dev;
+  size_t size = sizeof(*dev);
 
   if (dev_type == DEV_APB_SLV)
@@ -31,9 +31,7 @@
   else
     size += sizeof(struct ambapp_ahb_info); /* AHB */
-  dev = (struct ambapp_dev *)bsp_early_malloc(size);
-  if (dev == NULL)
-    return NULL;
-  memset(dev, 0 , size);
-  dev->dev_type = dev_type;
+  dev = (struct ambapp_dev *)calloc(1, size);
+  if (dev != NULL)
+    dev->dev_type = dev_type;
   return dev;
 }
Index: c/src/lib/libbsp/sparc/shared/startup/bspgetworkarea.c
===================================================================
--- c/src/lib/libbsp/sparc/shared/startup/bspgetworkarea.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ c/src/lib/libbsp/sparc/shared/startup/bspgetworkarea.c	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -21,7 +21,4 @@
 extern uint32_t rdb_start;
 
-/* Must be aligned to 8, _end is aligned to 8 */
-unsigned int early_mem = (unsigned int)&end;
-
 /*
  *  This method returns the base address and size of the area which
@@ -35,8 +32,7 @@
 
   /* Early dynamic memory allocator is placed just above _end  */
-  void *work_area_start = (void *)early_mem;
+  void *work_area_start = (void *)&end;
   uintptr_t work_area_size  =
-    (uintptr_t)rdb_start - (uintptr_t)early_mem - STACK_SIZE;
-  early_mem        = ~0; /* Signal bsp_early_malloc not to be used anymore */
+    (uintptr_t)rdb_start - (uintptr_t)&end - STACK_SIZE;
 
   /*
Index: src/lib/libbsp/sparc/shared/startup/early_malloc.c
===================================================================
--- c/src/lib/libbsp/sparc/shared/startup/early_malloc.c	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- *  Early dynamic memory allocation (not freeable) for BSP
- *  boot routines. Minimum alignment 8 bytes. Memory is
- *  allocated after _end, it will shrink the workspace.
- *
- *  COPYRIGHT (c) 2011.
- *  Aeroflex Gaisler AB
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <stdlib.h>
-
-/* Tells us where to put the workspace in case remote debugger is present. */
-extern uint32_t rdb_start;
-
-/* Must be aligned to 8 */
-extern unsigned int early_mem;
-
-/* must be identical to STACK_SIZE in start.S */
-#define STACK_SIZE (16 * 1024)
-
-/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
- * can be called at any time. The work-area will shrink when called before
- * bsp_work_area_initialize(). malloc() is called to get memory when this function
- * is called after bsp_work_area_initialize().
- */
-void *bsp_early_malloc(int size)
-{
-	void *start;
-
-	/* Not early anymore? */
-	if (early_mem == ~0)
-		return malloc(size);
-
-	size = (size + 7) & ~0x7;
-	if (rdb_start - STACK_SIZE - early_mem < size)
-		return NULL;
-
-	start = (void *)early_mem;
-	early_mem += size;
-
-	return start;
-}
Index: doc/bsp_howto/init.t
===================================================================
--- doc/bsp_howto/init.t	(revision 938ef78cc4c6fa2afe55426b603a3767de3262b5)
+++ doc/bsp_howto/init.t	(revision 37030e38c61c0d0a8b0742af75f115bda779c46d)
@@ -149,8 +149,4 @@
 for later use by the application.
 
-@item It invokes the BSP specific routine @code{bsp_start()} which is
-written in C and thus able to perform more advanced initialization.
-Often MMU and bus initialization occurs here.
-
 @item It invokes the BSP specific routine @code{bsp_work_area_initialize()}
 which is supposed to initialize the RTEMS Workspace and the C Program Heap.
@@ -161,4 +157,10 @@
 @code{#include <bsp/bootcard.h>}.
 
+@item It invokes the BSP specific routine @code{bsp_start()} which is
+written in C and thus able to perform more advanced initialization.
+Often MMU, bus and interrupt controller initialization occurs here.  Since the
+RTEMS Workspace and the C Program Heap was already initialized by
+@code{bsp_work_area_initialize()}, this routine may use @code{malloc()}, etc.
+
 @item It invokes the RTEMS directive
 @code{rtems_initialize_data_structures()} to initialize the RTEMS
@@ -215,28 +217,31 @@
 That's it.  We just went through the entire sequence. 
 
+@subsection bsp_work_area_initialize() - BSP Specific Work Area Initialization
+
+This is the first BSP specific C routine to execute during system
+initialization.  It must initialize the support for allocating memory from the
+C Program Heap and RTEMS Workspace commonly referred to as the work areas.
+Many BSPs place the work areas at the end of RAM although this is certainly not
+a requirement.  Usually the default implementation in
+@file{c/src/lib/libbsp/shared/bspgetworkarea.c} should be sufficient.  Custom
+implementations can use @code{bsp_work_area_initialize_default()} or
+@code{bsp_work_area_initialize_with_table()} available as inline functions from
+@code{#include <bsp/bootcard.h>}.
+
 @subsection bsp_start() - BSP Specific Initialization
 
-This is the first BSP specific C routine to execute during system
-initialization.  This routine often performs required fundamental
-hardware initialization such as setting bus controller registers
-that do not have a direct impact on whether or not C code can execute.
-The source code for this routine is usually found in the following
-file:
-
-@example
-c/src/lib/libbsp/CPU/BSP/startup/bspstart.c
-@end example
-
-On older BSPs not using @code{boot_card()}'s support for allocating memory
-to the C Program Heap and RTEMS Workspace, one of the most important
-functions performed by this routine is determining where the RTEMS
-Workspace is to be located in memory.  All RTEMS objects and task stacks
-will be allocated from this Workspace.  The RTEMS Workspace is distinct
-from the application heap used for @code{malloc()}.  Many BSPs place
-the RTEMS Workspace area at the end of RAM although this is certainly
-not a requirement.
+This is the second BSP specific C routine to execute during system
+initialization.  It is called right after @code{bsp_work_area_initialize()}.
+The @code{bsp_start()} routine often performs required fundamental hardware
+initialization such as setting bus controller registers that do not have a
+direct impact on whether or not C code can execute.  The interrupt controllers
+are usually initialized here.  The source code for this routine is usually
+found in the file @file{c/src/lib/libbsp/$@{CPU@}/$@{BSP@}/startup/bspstart.c}.
+It is not allowed to create any operating system objects, e.g. RTEMS
+semaphores.
 
 After completing execution, this routine returns to the @code{boot_card()}
-routine.
+routine.  In case of errors, the initialization should be terminated via
+@code{bsp_fatal()}.
 
 @subsection RTEMS Pretasking Callback
