NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

Reserving RAM for ROM drivers

lpcxpresso-support's picture

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

0
Your rating: None
feedback