Controlling code placement

 Code can be placed in specific memory segments using the Extern Definition block. This block allows you to declare data and associate it with a specific memory segment using C syntax (compiler dependent).

A common application is allocating DMA RAM. Typically, not all RAM on a target device is capable of DMA, so it is important to attach your DMA data elements to DMA-capable RAM segments. The attachment of a data item to a RAM segment is usually done via #pragma.

A second application is the need to copy Flash code to RAM to improve performance. When the code resides in a compound block, Copy Flash Function to RAM moves the compound block code to RAM prior to execution. Copy Flash Function to RAM can be activated when the compound block is configured for Enabled Execution, Local Time Step, or Execute on Interrupt.