Skip to content

[LPC4088] RAM size fix for ARM_GCC. Added possibility to reserve stack space #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern "C" {

#include <rt_misc.h>
#include <stdint.h>
#include "sys_helper.h"

extern char Image$$RW_IRAM1$$ZI$$Limit[];

Expand All @@ -22,7 +23,7 @@ extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_

struct __initial_stackheap r;
r.heap_base = zi_limit;
r.heap_limit = sp_limit;
r.heap_limit = sp_limit - __reserved_stack_size();
return r;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* mbed Microcontroller Library - stackheap
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
*
*/

#include "sys_helper.h"

/* This function specifies the amount of memory of the internal RAM to
reserve for the stack. The default implementation will reserve 0 bytes
which gives the normal behaviour where the stack and heap share all the
internal RAM.

You can override this function in your code to reserve a number of bytes
for the stack.
*/
extern "C" __attribute__((weak)) uint32_t __reserved_stack_size();
extern "C" __attribute__((weak)) uint32_t __reserved_stack_size() {
return 0; // return 0 to indicate that nothing is reserved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef SYS_HELPER_H
#define SYS_HELPER_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

uint32_t __reserved_stack_size();

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
RAM (rwx) : ORIGIN = 0x100000E8, LENGTH = (32K - 0xE8)
RAM (rwx) : ORIGIN = 0x100000E8, LENGTH = (64K - 0xE8)

USB_RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 16K
ETH_RAM(rwx) : ORIGIN = 0x20004000, LENGTH = 16K
Expand Down
2 changes: 1 addition & 1 deletion workspace_tools/export/uvision4_lpc4088.uvopt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</DaveTm>

<Target>
<TargetName>mbed NXP LPC1768</TargetName>
<TargetName>mbed NXP LPC4088</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
Expand Down