]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/cg_src/r_cg_sbrk.c
Baseline new GCC and Renesas compiler projects for RX71M and RX113 before adding...
[freertos] / FreeRTOS / Demo / RX700_RX71M_RSK_Renesas_e2studio / src / cg_src / r_cg_sbrk.c
diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/cg_src/r_cg_sbrk.c b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/cg_src/r_cg_sbrk.c
new file mode 100644 (file)
index 0000000..c972d5f
--- /dev/null
@@ -0,0 +1,86 @@
+/***********************************************************************************************************************\r
+* DISCLAIMER\r
+* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.\r
+* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all\r
+* applicable laws, including copyright laws. \r
+* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED\r
+* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+* NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY\r
+* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,\r
+* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR\r
+* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability \r
+* of this software. By using this software, you agree to the additional terms and conditions found by accessing the \r
+* following link:\r
+* http://www.renesas.com/disclaimer\r
+*\r
+* Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+* File Name    : r_cg_sbrk.c\r
+* Version      : Code Generator for RX71M V1.00.02.02 [28 May 2015]\r
+* Device(s)    : R5F571MLCxFC\r
+* Tool-Chain   : CCRX\r
+* Description  : Program of sbrk.\r
+* Creation Date: 20/09/2015\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+Pragma directive\r
+***********************************************************************************************************************/\r
+/* Start user code for pragma. Do not edit comment generated here */\r
+/* End user code. Do not edit comment generated here */\r
+\r
+/***********************************************************************************************************************\r
+Includes\r
+***********************************************************************************************************************/\r
+#include "r_cg_macrodriver.h"\r
+#include <stddef.h>\r
+#include <stdio.h>\r
+#include "r_cg_sbrk.h"\r
+#include "r_cg_userdefine.h"\r
+\r
+/***********************************************************************************************************************\r
+Global variables and functions\r
+***********************************************************************************************************************/\r
+\r
+int8_t  *sbrk(size_t size);\r
+\r
+extern int8_t *_s1ptr;\r
+\r
+union HEAP_TYPE\r
+{\r
+    int16_t  dummy ;            /* Dummy for 4-byte boundary */\r
+    int8_t heap[HEAPSIZE];      /* Declaration of the area managed by sbrk */\r
+};\r
+\r
+static union HEAP_TYPE heap_area ;\r
+\r
+/* End address allocated by sbrk    */\r
+static int8_t *brk = (int8_t *) &heap_area;\r
+\r
+/**************************************************************************/\r
+/*      sbrk:Memory area allocation                                       */\r
+/*      Return value:Start address of allocated area    (Pass)            */\r
+/*                       -1                             (Failure)         */\r
+/**************************************************************************/\r
+int8_t *sbrk(size_t size)                       /* Assigned area size   */\r
+{\r
+    int8_t  *p;\r
+\r
+    if (brk+size > heap_area.heap + HEAPSIZE)   /* Empty area size      */\r
+    {\r
+        p = (int8_t *)-1;\r
+    }\r
+    else\r
+    {\r
+        p = brk;                                /* Area assignment      */\r
+        brk += size;                            /* End address update   */\r
+    }\r
+\r
+    return p;\r
+}\r
+\r
+/* Start user code for adding. Do not edit comment generated here */\r
+/* End user code. Do not edit comment generated here */\r