AnsweredAssumed Answered

Reserving RAM for ROM drivers

Question asked by LPCware Support on Mar 31, 2016

Some NXP MCUs have peripherals drivers built into the ROM - for example, the CAN driver for certain LPC11 parts, and the USB driver for certain LPC13 parts. On some MCUs these drivers need some internal memory that is *always* at the start of the first RAM block. This is not configurable, so if the driver is used, then the application must not use that RAM.

 

The LPCXpresso linker creates a section in the default, generated linker script that is placed first in the RAM that can be used to reserve this memory for the ROM drivers. Note that it is not initialized in any way:

 

.uninit_RESERVED : ALIGN(4) 
{
     KEEP(*(.bss.$RESERVED*))
} > RamLoc32

 

To reserve the required space, you would simply use a macro from "cr_section_macros.h" to define a buffer in that space:

 

__BSS(RESERVED) char CAN_driver_memory[256] ; // reserve 256 bytes for CAN driver

 

For more information on section macros, please see the FAQ:

 

 

Note that the NXP IAP flash programming routines typically require memory to be reserved at the top of the first bank of on-chip RAM. For details of how to reserve this memory, see the FAQ "Reserving RAM for IAP Flash Programming".

Outcomes