Skip to content

Commit

Permalink
or1k: Make heap start configurable
Browse files Browse the repository at this point in the history
- 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.

    * or1k/sbrk.c: Allow for different heap start
  • Loading branch information
jjohnstn authored and github-cygwin committed May 27, 2015
1 parent aa26b78 commit 58efeed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libgloss/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-05-26 Stefan Wallentowitz <[email protected]>

* or1k/sbrk.c: Allow for different heap start

2015-05-26 Stefan Wallentowitz <[email protected]>

* or1k/or1k_uart.c: Fix interrupts
Expand Down
5 changes: 3 additions & 2 deletions libgloss/or1k/sbrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 58efeed

Please sign in to comment.