You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/06/17 11:22:10 UTC

[mynewt-core] 05/06: bsp/apollo2_evb: Unify sbrk

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit fa415805670807c2a7b203a08d4d5a2e850f97b2
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Jun 17 09:27:39 2021 +0200

    bsp/apollo2_evb: Unify sbrk
    
    sbrk.c is now removed
    call to _sbrkInit was missing in startup file
---
 .../apollo2_evb/src/arch/cortex_m4/gcc_startup.s   |  1 +
 hw/bsp/apollo2_evb/src/sbrk.c                      | 51 ----------------------
 2 files changed, 1 insertion(+), 51 deletions(-)

diff --git a/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s b/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s
index 4196dd2..75eb4f5 100644
--- a/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s
+++ b/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s
@@ -166,6 +166,7 @@ Reset_Handler:
 
     LDR     R0, =__HeapBase
     LDR     R1, =__HeapLimit
+    BL      _sbrkInit
 
     LDR     R0, =SystemInit
     BLX     R0
diff --git a/hw/bsp/apollo2_evb/src/sbrk.c b/hw/bsp/apollo2_evb/src/sbrk.c
deleted file mode 100644
index 804c8f9..0000000
--- a/hw/bsp/apollo2_evb/src/sbrk.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-extern char __HeapBase;
-extern char __HeapLimit;
-
-void *
-_sbrk(int incr)
-{
-    static char *brk = &__HeapBase;
-
-    void *prev_brk;
-
-    if (incr < 0) {
-        /* Returning memory to the heap. */
-        incr = -incr;
-        if (brk - incr < &__HeapBase) {
-            prev_brk = (void *)-1;
-        } else {
-            prev_brk = brk;
-            brk -= incr;
-        }
-    } else {
-        /* Allocating memory from the heap. */
-        if (&__HeapLimit - brk >= incr) {
-            prev_brk = brk;
-            brk += incr;
-        } else {
-            prev_brk = (void *)-1;
-        }
-    }
-
-    return prev_brk;
-}