**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Reducing Code Size when CRP enabled

Many of NXP's MCUs support a mechanism called Code Read Protect (CRP) to prevent code in flash being deleted/read. This mechanism uses one of a number of known values being placed in a specific memory location to provide a number of levels of protection. This location is at 0x2FC for Cortex based systems and 0x1FC for ARM7 based systems.

Code Red introduced direct support for reserving the CRP word in generated application image in version 3.6 of its tools (version 3.8 for LPCXpresso for Linux).

However one of the consequences of this support is that the memory between the processor vector table and the CRP word is by default left largely unused. This typically increases the size of the application image by around 400 bytes (depending upon the MCU being used).

However this ~400 bytes of space can easily be reclaimed by choosing one or more functions to be placed into this "spare" memory. To do this, you simply need to decorate their definitions with the macro __AFTER_VECTORS.

Obviously in order to do this effectively, you need to identify functions which will occupy as much of the "spare" memory as possible. The best way to do this is to look at the linker map file, as detailed in the FAQ Application Flash / RAM size.

For more information on CRP, support for CRP in the Code Red tools and using __AFTER_VECTORS, please see the FAQ Enhanced Managed Linker Scripts.

CodeSizeCRP (last edited 2011-04-26 13:16:57 by CrSupportAb)