Reserving RAM for ROM drivers

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

Reserving RAM for ROM drivers

2,163 Views
lpcware-support
Senior Contributor I

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

Labels (1)
Tags (2)
0 Kudos
0 Replies