This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 6/8] or1k: Make heap start configurable
- From: Stefan Wallentowitz <stefan dot wallentowitz at tum dot de>
- To: newlib at sourceware dot org
- Date: Sun, 17 May 2015 17:04:35 +0200
- Subject: [PATCH 6/8] or1k: Make heap start configurable
- Authentication-results: sourceware.org; auth=none
Previously the heap started right after the bss section. This can now
be configured by changing the _or1k_heap_start symbol that defaults to
the old value (&end). In board_init_early, we can now set this to
another value.
libgloss/Changelog:
* or1k/sbrk.c: Allow for different heap start
>From 3954dcb34728006e98de7c26e807c320a5037c68 Mon Sep 17 00:00:00 2001
From: Stefan Wallentowitz <stefan.wallentowitz@tum.de>
Date: Sun, 19 Apr 2015 12:53:57 +0200
Subject: [PATCH 6/8] or1k: Make heap start configurable
Previously the heap started right after the bss section. This can now
be configured by changing the _or1k_heap_start symbol that defaults to
the old value (&end). In board_init_early, we can now set this to
another value.
libgloss/Changelog:
* or1k/sbrk.c: Allow for different heap start
---
libgloss/or1k/sbrk.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libgloss/or1k/sbrk.c b/libgloss/or1k/sbrk.c
index de80663..5bd7044 100644
--- a/libgloss/or1k/sbrk.c
+++ b/libgloss/or1k/sbrk.c
@@ -19,12 +19,13 @@
#include "include/or1k-support.h"
+extern uint32_t end; /* Set by linker. */
+uint32_t _or1k_heap_start = &end;
static uint32_t _or1k_heap_end;
void *
_sbrk_r (struct _reent * reent, ptrdiff_t incr)
{
- extern uint32_t end; /* Set by linker. */
uint32_t prev_heap_end;
// This needs to be atomic
@@ -34,7 +35,7 @@ _sbrk_r (struct _reent * reent, ptrdiff_t incr)
uint32_t sr_tee = or1k_timer_disable();
// Initialize heap end to end if not initialized before
- or1k_sync_cas((void*) &_or1k_heap_end, 0, (uint32_t) &end);
+ or1k_sync_cas((void*) &_or1k_heap_end, 0, (uint32_t) _or1k_heap_start);
do {
// Read previous heap end
--
2.1.4