How to reserve LPC11Cxx RAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to reserve LPC11Cxx RAM

849 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Feb 25 06:16:17 MST 2013
For CAN API usage and IAP functions of LPC11C14 or LPC11C24 it's necessary to reserve RAM regions.There have been several threads about this already so I'll show here again 2 LPCXpresso solutions

[B][COLOR=Red]Problem #1 Reserving CAN API RAM[/COLOR][/B][INDENT] For CAN API usage RAM from 0x1000 0050 to 0x1000 00B8. UM is warning us, but this warning can easily be overseen:

UM10398
Quote:

17.4.1 Calling the C_CAN API
...
On-chip RAM from address 0x1000 0050 to 0x1000 00B8 is used by the CAN API.

There a several solutions, but I'll describe here only 2 of them.
Note: Changing linker script is described in older threads. Since there are easier solutions nowadays and I don't want to disable 'Managed linker script' this option isn't described here.

[B][COLOR=SeaGreen]Solution #1-1 Enhanced Managed Linker Scripts[/COLOR][/B][INDENT] Enhanced Managed Linker Scripts are available since V3.6 and every new generated LPCXpresso project is adding this macros with "cr_section_macros.h".

So a simple:
//reserve CAN ROM-RAM 0x1000 0050 - 0x1000 00B9
__BSS(RESERVED) char CAN_driver_memory[0xC0];
is reserving 0xC0 bytes as shown in MAP file:

Quote:

.uninit_RESERVED
                0x10000000       0xc0
*(.bss.$RESERVED*)
.bss.$RESERVED
                0x10000000       0xc0 ./src/main.o
                [COLOR=Magenta]0x10000000                CAN_driver_memory[/COLOR]
[COLOR=Magenta]                 0x100000c0[/COLOR]                . = ALIGN (0x4)
                0x100000c0                _end_uninit_RESERVED = .

.data           0x100000c0       0x34 load address 0x00003904

See also: http://www.support.code-red-tech.com/CodeRedWiki/EnhancedManagedLinkScripts
[/INDENT][COLOR=SeaGreen][B]Solution #1-2 Change MCU memory region[/B][/COLOR][INDENT] Of course you can also change default RAM memory region of your MCU.

See also: http://www.support.code-red-tech.com/CodeRedWiki/EnhancedManagedLinkScripts

Default Memory configuration LPC11Cxx:

Quote:

Type Name    Location   Size
RAM  RamLoc8 0x10000000 0x2000

Memory configuration LPC11Cxx without first 0xC0 bytes and reduced size (0x2000-0xC0=0x1F40):

Quote:

Type Name    Location   Size
RAM  RamLoc8 0x100000C0 0x1F40

MAP file:

Quote:

.uninit_RESERVED
                0x100000c0        0x0
*(.bss.$RESERVED*)
                [COLOR=Magenta]0x100000c0[/COLOR]                . = ALIGN (0x4)
                0x100000c0                _end_uninit_RESERVED = .

.data           0x100000c0       0x34 load address 0x00003904

[/INDENT][/INDENT][B][COLOR=Red]Problem #2 RAM used by IAP command handler[/COLOR][/B][INDENT] For IAP usage Flash programming commands use also RAM.UM is warning us, but this warning can easily be overseen:

UM10398
Quote:

26.4.9 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM.

[COLOR=SeaGreen][B]Solution #2-1 Reserving RAM for IAP Flash Programming[/B][/COLOR][INDENT] Increase Stack offset to 32 as described here: http://www.support.code-red-tech.com/CodeRedWiki/ReserveIAPRam
[/INDENT][COLOR=SeaGreen][B]Solution #2-2 Change MCU memory region[/B][/COLOR][INDENT] As mentioned in Solution #1-2 just reduce memory size
Memory configuration LPC11Cxx without first 0xC0 bytes and without last 32 bytes (0x2000-0xC0-0x20=0x1F20):

Quote:

Type Name    Location   Size
RAM  RamLoc8 0x100000C0 0x1F20

[/INDENT][/INDENT];) If you are unsure if you need this or not in your application, just add it. It doesn't hurt. My favorite solution is to add a reserved region (Solution #1-1) and increase Offset (Solution #2-1) in a reference project and then just copy this project :cool:
0 Kudos
Reply
0 Replies