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:
UM10398Quote:
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".
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:
.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:
UM10398Quote:
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: