BSPACM  20150113
Board Support Package for ARM Cortex-M Microcontrollers
Functions
system.h File Reference

Prototypes for BSPACM system enhancements to newlib. More...

#include <bspacm/core.h>
#include <unistd.h>

Go to the source code of this file.

Functions

void * _sbrk (intptr_t increment)
 
void * _bspacm_sbrk_error (void *brk, ptrdiff_t current, ptrdiff_t increment)
 

Detailed Description

Prototypes for BSPACM system enhancements to newlib.

Homepage
http://github.com/pabigot/bspacm

Function Documentation

void* _bspacm_sbrk_error ( void *  brk,
ptrdiff_t  current,
ptrdiff_t  increment 
)

This function is invoked whenever _sbrk() runs out of memory.

libbspacm.a provides a weak definition is that disables interrupts and enters an infinite loop, allowing diagnosis through a debugger. The application may provide an alternative implementation that is more diagnostic or that returns the responsibility of handling out-of-memory to the application (i.e. requires the application to check allocation return values).

Parameters
brkthe current program break
currenttotal number of bytes allocated by previous successful invocations of _sbrk() (i.e., allocated bytes preceding brk)
incrementthe number of bytes in the request that _sbrk() cannot satisfy
Returns
This implementation does not return. If superseded, an implementation that does return must set errno to ENOMEM and return (void*)-1.
void* _sbrk ( intptr_t  increment)

The system function used to allocate memory for use by libc heap memory management.

Heap Management documents how to select a specific _sbrk() implementation from among the available policies by which allocation is done, and how to supply your own implementation.

Note
All BSPACM policies invoke _bspacm_sbrk_error() if allocation fails, allowing an application to control response to the failure.
Parameters
incrementthe number of bytes of additional memory that libc needs in order to perform additional allocations.
Returns
a pointer to the new end-of-memory, or (void*)-1 if no allocation can be performed.