1 /***********************************************************************************************************************
\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
\r
4 * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
\r
5 * applicable laws, including copyright laws.
\r
6 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
\r
7 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
\r
8 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
\r
9 * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
\r
10 * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
\r
11 * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\r
12 * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
\r
13 * this software. By using this software, you agree to the additional terms and conditions found by accessing the
\r
15 * http://www.renesas.com/disclaimer
\r
17 * Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
\r
18 ***********************************************************************************************************************/
\r
19 /***********************************************************************************************************************
\r
20 * File Name : sbrk.c
\r
22 * Description : Configures the MCU heap memory. The size of the heap is defined by the macro HEAPSIZE below.
\r
23 ***********************************************************************************************************************/
\r
24 /***********************************************************************************************************************
\r
25 * History : DD.MM.YYYY Version Description
\r
26 * : 26.10.2011 1.00 First Release
\r
27 * : 12.03.2012 1.10 Heap size is now defined in r_bsp_config.h, not sbrk.h.
\r
28 ***********************************************************************************************************************/
\r
29 /***********************************************************************************************************************
\r
30 Includes <System Includes> , "Project Includes"
\r
31 ***********************************************************************************************************************/
\r
32 /* Provides standard definitions used in this file */
34 /* Defines standard input/output functions used in this file */
36 /* Defines standard variable types used in this file */
38 /* Used for getting HEAP_BYTES macro. */
\r
41 /***********************************************************************************************************************
\r
43 ***********************************************************************************************************************/
\r
45 /***********************************************************************************************************************
47 ***********************************************************************************************************************/
48 /* Memory allocation function prototype declaration */
49 int8_t *sbrk(size_t size);
51 /***********************************************************************************************************************
53 ***********************************************************************************************************************/
54 //const size_t _sbrk_size= /* Specifies the minimum unit of */
55 /* the defined heap area */
56 extern int8_t *_s1ptr;
60 int32_t dummy; /* Dummy for 4-byte boundary */
61 int8_t heap[HEAP_BYTES]; /* Declaration of the area managed by sbrk*/
63 /* Declare memory heap area */
64 static union HEAP_TYPE heap_area;
65 /* End address allocated by sbrk */
66 static int8_t *brk=(int8_t *)&heap_area;
68 /***********************************************************************************************************************
\r
69 * Function name: sbrk
\r
70 * Description : This function configures MCU memory area allocation.
\r
71 * Arguments : size -
\r
72 * assigned area size
\r
73 * Return value : Start address of allocated area (pass)
\r
75 ***********************************************************************************************************************/
\r
76 int8_t *sbrk(size_t size)
80 if (brk+size > heap_area.heap+HEAP_BYTES)
90 /* End address update */