Target Preferences - Configure model for Analog Devices processor

Library

Target Preferences in Embedded IDE Link VS

Description

Options on the block mask let you set features of code generation for your custom Blackfin, SHARC, or TigerSHARCprocessor. Adding this block to your Simulink software model provides access to the processor hardware settings you need to configure when you generate code from Real-Time Workshop software to run on the processor.

Any model that you target to custom hardware must include this block. Real-Time Workshop software returns an error message if a target preferences block is not present in your model.

You can specify the following processor and target options on this block:

Setting the options included in this dialog box results in identifying your target to Real-Time Workshop, VisualDSP++, and Simulink software, and configuring the memory map for your target. Both steps are essential for developing code for any processor that is custom or explicitly supported.

Unlike most other blocks, you cannot open the block dialog box for this block until you add the block to a model. When you try to open the block dialog, the block attempts to connect to a VisualDSP++ IDE session. It cannot make the connection when the block is in the library. If you try to open the block dialog before you add it to a model, the open process fails and returns an error message.

Generating Code from Model Subsystems

Real-Time Workshop software provides the capability to generate code from a selected subsystem in a model. To generate code for an Analog Devices processor from a subsystem, the subsystem model must include this target preferences block.

Dialog Box

This section contains the following subsections:

All target preferences block dialog boxes provide tabbed access to the following panes. You set the options for the processor from these panes:

Board Info Pane

The following options appear on the Board Info pane for the Target Preferences dialog box.

Board Type

Enter the type of board you are targeting with the model. You can enter Custom to support any board, based on one of the supported processors, or enter the name of one of the supported boards.

Processor

Select the processor on the board you select in Board type. The processor type you enter determines the contents and setting for options on the Memory and Sections panes in this dialog box.

CPU clock

Shows the clock speed of the processor. When you enter a value, you are not changing the CPU clock rate. Instead, you are reporting the actual rate. If the value you enter does not match the rate on the processor, your model's real-time code profiling results may be incorrect.

Enter the actual clock rate the board uses. The rate you enter in this field does not change the rate on the board. Setting CPU clock to the actual board rate allows the code you generate to run correctly according to the actual clock rate of the hardware.

When you generate code for targets from Simulink software models, you may encounter the software timer. The timer is invoked automatically to handle and create interrupts to drive your model if the processing rates in your model change (the model is multirate).

Correctly generating interrupts for your model depends on the clock rate of the CPU on your processor.

For the timer software to calculate the interrupts correctly, VisualDSP++ software needs to know the actual clock rate of your processor as you configured it. CPU clock speed lets you tell the timer the rate at which your processor CPU runs, which is the rate to use to match the CPU rate.

The timer uses the CPU clock rate you specify in CPU clock to calculate the time for each interrupt. For example, if your model includes a sine wave generator block running at 1 kHz feeding a signal into an FIR filter block, the timer needs to create interrupts to generate the sine wave samples at the proper rate. The timer uses the clock rate you enter, for example, 100 MHz, to calculate the sine generator interrupt period as follows for the sine block:

To create sine block interrupts at 0.001 s/sample requires:

100,000,000/1000  =  1 Sine block interrupt per 100,000 clock ticks

Thus, you must report the correct clock rate, or the interrupts come at the wrong times and the results are incorrect.

Board Custom Code

Entries in this group let you specify the locations of custom source files or libraries or other functions. The following options provide access to text areas where you enter files and file paths. The block does not check whether the functions you enter are correct or the file paths you provide exist and are correct. Entering incorrect functions or paths may cause errors during code generation.

When you enter a path to a file, library, or other custom code, use the string

$(install_dir)

to refer to the VisualDSP++ software installation directory.

Enter new paths or files (custom code items) one entry per line. Include the full path to the file for libraries and source code. Board custom code options do not support functions that use return arguments or values. Only functions of type void fname void are valid as entries in these parameters.

Session name

Contains a list of all the sessions defined in VisualDSP++ IDE. From the list of available sessions, select the one to which you are targeting your code.

Processor name

Lists the processors on the board you selected for targeting in Session name. In most cases, only one name appears because the board has one processor. In the multiprocessor case, you select the processor by name from the list.

Memory Pane

When you develop models for any processor, you need to specify the layout of the physical memory on your processor and board to determine how use it for your program. For supported boards, the board-specific target preferences blocks set the default memory map.

The Memory pane contains memory options in three areas:

Most of the information about memory segments and memory allocation is available from the online help system for the VisualDSP++ product.

Physical Memory Options

This list shows the physical memory segments available on the board and processor. By default, target preferences blocks show the memory segments found on the selected processor. In addition, the Memory pane on preconfigured target preferences blocks shows memory segments that are available on the board, but that are external to the processor (external memory). Target preferences blocks set default starting addresses, lengths, and contents of the default memory segments.

The default memory segments for each processor and board are different. For example:

Name

When you highlight an entry on the Physical memory list, the name of the entry appears in this field. To change the name of the existing memory segment, select it in the Physical memory list and then type the new name in this field.

To add a new physical memory segment to the list, click Add, replace the temporary label in Name with the one to use, and press Return. Your new segment appears on the list.

After you add the segment, you can configure the starting address, length, and contents for the new segment. New segments start with code and data as the type of content that can be stored in the segment (refer to the Contents option).

Names are case sensitive. NewSegment is not the same as newsegment or newSegment.

Address

Address reports the starting address for the memory segment showing in the Name field. Address entries are in hexadecimal format and limited only by the board or processor memory.

When you are using a processor-specific preferences block, the starting address shown is the default value. You can change the starting value by entering the new value directly in the Address field when you select the memory segment to change.

Length

From the starting address, Length sets the length of the memory allocated to the segment in the Name field. As in all memory entries, specify the length in hexadecimal format, in minimum addressable data units (MADUs).

When you are using a processor-specific preferences block, the length shown is the default value. You can change the value by entering the new value directly in this option.

Contents

Contents details the kind of program sections that you can store in the memory segment in Name. As the processor type for the target preferences block changes, the kinds of information you store in listed memory segments may change. Generally, the Contents list contains these strings:

You may add or use as many segments of each type as you need, within the limits of the memory on your processor.

Add

Click Add to add a new memory segment to the processor memory map. When you click Add, a new segment name appears, for example NEWMEM1, in Name and on the Physical memory list. In Name, change the temporary name NEWMEM1 by entering the new segment name. Entering the new name or clicking Apply updates the temporary name on the list to the name you enter in this field.

Remove

Remove a memory segment from the memory map. Select the segment to remove on the Physical memory list, and click Remove to delete the segment.

Memory bank list

Displays all available memory banks for the selected processor. When you select one of the entries on this list, the Name, Address, Length, and Contents parameters change to reflect the memory block selection. With the contents list, you can change the type of material stored in the block—data or code or both.

Create Heap

If your processor supports using a heap, as the Blackfin and SHARC processors do, selecting this option enables creating the heap, and enables the Heap size option. Create heap is not available on processors that either do not provide a heap or do not allow you to configure the heap.

Use this option to create a heap in any memory segment on the Physical memory list. Select the memory segment on the list, and then select Create heap to create a heap in the selected segment. After you create the heap, use the Heap size and Define label options to configure the heap.

The location of the heap in the memory segment is not under your control. The only way to control the location of the heap in a segment is to make the segment and the heap the same size. Otherwise, the compiler determines the location of the heap in the segment.

Heap Size

After you select Create heap, this option lets you specify the size of the heap in words. Enter the number of words in decimal format. When you enter the heap size in decimal words, the system converts the decimal value to hexadecimal format. You can enter the value directly in hexadecimal format as well. Processors may support different maximum heap sizes.

Define Label

Selecting Create heap enables this option that allows you to name the heap. Enter your label for the heap in the Heap label option.

Heap Label

Use this option which you enable by selecting Define label, to provide the label for the heap. Any combination of characters is accepted for the label, except reserved characters in ANSI C/C++ compilers.

The block does not verify that the label you enter is valid. Invalid labels can cause errors during code generation.

Cache level

Blackfin, SHARC, and TigerSHARC processors support different cache arrangements. For Blackfin processors, you can select one of the following options from the list:

On SHARC processors, the cache is always Instruction_CACHE. Set the cache size in Configuration.

On TigerSHARC processors, the cache is always CACHE, used for both data and code, and you can only enable the cache. You cannot choose the size or configuration. Use the Configuration option to enable the cache.

Configuration

Select the size of the cache from the list to determine the size of the cache allocated. SHARC processors support 1536 bits or 0 bits (no cache). Blackfin processors support 0 bits or 16 bits. For TigerSHARC processors, your choices are disable or enable only.

Sections Pane

Options on this pane let you specify where various program sections should go in memory. Program sections are distinct from memory segments—sections are portions of the executable code stored in contiguous memory locations. Commonly used sections include .program, .bsz, .data1, and .stack.

For more information about program sections and objects, refer to the Analog Devices VisualDSP++ product online help.

Within this pane, you allocate the memory needed for the Default sections and Custom sections.

The following table provides brief definitions of the sections in the Default sections, and Custom sections lists in the pane. All sections do not appear for all processors.

String

Description of the Section Contents

bsz

Global zero initialized data

bsz_init

Run-time initialization data

constdata

Constant data, usually defined with the ANSI C qualifier and string constants

cplb_code

CPLB management routines

cplb_data

CPLB configuration tables

data1

Global program data for execution

heap

System heap allocation

L1_Data_A

L1 band A SRAM data

L1_Data_B

L1 band B SRAM data

noncache_codeCode not assigned to the cache
programProgram code
seg_argvCommand line arguments that PGO uses
seg_dmdaGlobal data
seg_heapSystem heap
seg_initStack and heap location and size info
seg_int_codeInterrupt latch register modifier code
seg_pmcoProgram code
seg_pmdaGlobal program data qualified with pm keyword
seg_rthInterrupt vector table
seg_stakSystem stack

stack

Global system stack

voldataVolatile data

You can learn more about memory sections and objects in your Analog Devices VisualDSP++ product online help.

Default sections

During program compilation, the compiler produces both uninitialized and initialized blocks of data and code. These blocks get allocated into memory as required by the configuration of your system. On the Default sections list you find both initialized sections that contain data or executable code and uninitialized sections that reserve space in memory.

The following sections are initialized:

The following sections are not initialized:

The following sections appear on the list as well:

When you highlight a section on the list, Section description shows a brief description of the section. Also, Placement shows you where the section is presently allocated in memory.

Section description

Describes the contents of the selected entry on the Default sections list.

Placement

Shows you where the selected Default sections list entry is allocated in memory. You change the memory allocation by selecting a different location from the Placement list. The list contains the memory segments as defined in the physical memory map on the Memory pane. Select one of the listed memory segments to allocate the highlighted compiler section to the segment.

Custom sections list

When your program uses code or data sections that are not included in the Default sections list, add the new sections to this list. Initially, the Custom sections list parameter contains no fixed entries. Only a placeholder for a section for you to define.

Name

Enter the name for your new section in this field. To add a new section, click Add. Then, replace the temporary name with the name to use. Although the temporary name includes a period at the beginning you do not need to include a period in your new name. Names are case sensitive. NewSection is not the same as newsection, or newSection.

Contents

Select the kind of data to assign to the new section. Choose from one of the following list entries:

Attributes

Not used.

Placement

After you have added the new section to the Name list, select the memory segment to which to add your new section. Limited only by the restrictions imposed by the hardware and compiler, you can select any segment that appears on the list.

Add

Click Add to add a new entry on the list of custom sections. When you click Add, a new temporary name, for example NEWMEM1 appears in the Name field. Enter the new custom section name to add the section to the Custom sections list. After you enter the new name, click Apply to add the new section to the list. You can also click OK to add the section to the list and close the dialog box.

Remove

Remove a section from the Custom sections list. To remove a section, select the section, and click Remove.

New Processor Dialog Box

Clicking Add new on the General paneopens this dialog box to add a new processor to the list of supported processors. The new processor must be a member of one of the supported families of processors.

The first time you click Save to add a new processor definition to the list of supported processors, a dialog box opens that directs you to select a destination folder for the saved processor definitions file customChipInfo.dat. You must select a directory to which you have write access. The location you specify becomes part of your MATLAB software preferences. Future processors that you add become entries in the file customChipInfo.dat.

To add a new processor, enter values for the following parameters:

Name

Provide a name to identify your new processor. You can use any valid ANSI C string value in this field. The name you enter in this field appears on the list of processors after you add the new processor.

Processor Class

Identifies the class of the new processor. Your new processor must be a member of a family of processors that Embedded IDE Link VS software supports. For example, you can add a new Blackfin processor because the product supports the Blackfin processor family.

CPU clock

Provide a name to identify your new processor. You can use any valid ANSI C string value in this field. The name you enter in this field appears on the list of processors after you add the new processor.

Enter the clock speed of the processor in MHz. When you enter a value, you are not setting the CPU clock rate on the processor. You are reporting the rate. If the value you enter does not match the rate on the processor, your model's real-time results may be wrong, and code profiling results are not correct.

Setting CPU clock to the actual board rate allows the generated code to run correctly according to the actual clock rate of the hardware.

Compiler switch

This string ensures that the compile operation works successfully.

Code generation hook

This string provides the prefix that the calling code uses to call hook functions during code generation.

Define internal memory banks (one or more memory banks)

Parameters in this group configure the memory map for the new processor.

Define default sections (one or more default sections)

Parameters in this group configure the default sections for your new processor.

If you do not provide an entry for each of these parameters, Embedded IDE Link VS software returns an error message and does not create the new processor entry.

General

Name

Provide a name to identify your new processor. You can use any valid ANSI C string in this field. The name you enter appears on the list of processors after you add the new processor.

CPU clock

Enter the clock speed of the processor in MHz. When you enter a value, you are not setting the CPU clock rate on the processor. You are reporting the rate. If the value you enter does not match the rate on the processor, your model's real-time results and code profiling results may not be correct.

Setting CPU clock to the actual board rate allows the code you generate to run correctly according to the actual clock rate of the hardware.

Processor class

This represents the class for the new processor. New processors must be members of processor families that Embedded IDE Link VS software supports, such as a new Blackfin or TigerSHARC processor.

You cannot add a new processor class to support your new processor.

Generally, processors in a family share common design elements such as interrupt architecture and clock. They may have different memory maps. By selecting the processor class, you identify the common features of the processor family. The parameters in Define internal memory banks and Define default sections enable you to specify the memory mapping for your new processor.

For example, to add a new Blackfin processor, enter the string BFxxx where xxx is the processor number.

The following table shows the strings for the supported processor families.

Processor FamilyProcessor Class String
BlackfinBFxxx where xxx is the numerical designation of the processor, such as BF532
SHARCxxxxx where xxxxx is the numerical designation for the processor, such as 21366
TigerSHARCxxx where xxx is the numerical designation for the processor, such as 202

Here is an example of using the code generation hook when you begin to generate a project from a model intended for the BF532 processor. At the start of the code generation process, the process calls BFxxx_validateModelEntry.m to validate the model settings for the processor. The BFxxx prefix is the code generation hook.

Compiler switch

Identifies the processor family of the new processor to the compiler. Successful compilation requires this switch. The string depends on the processor family or class. The software does not use this string.

Code generation hook

This string represents a prefix to add when the code generation process call certain hook functions. The hook allows the code to call into handling functions that are specific to the processor selected.

The code generation hook strings for the supported processors appear in the following table.

Processor Class or FamilyCode Generation Hook String
Blackfinblackfin
SHARCsharc
TigerSHARCtigersharc

Define internal memory banks

Name

To add a new physical memory segment to the internal memory banks list, click Add, replace the temporary label in Name with the one to use, and press Return. Your new segment appears on the list.

After you add the segment, you can configure the starting address, length, and contents for the new segment. New segments start with code and data as the type of content that can be stored in the segment (refer to the Contents option).

Names are case sensitive. NewSegment is not the same as newsegment or newSegment.

Address

Address reports the starting address in hexadecimal format for the memory segment showing in Name. Address entries are limited only by the board or processor memory.

When you are using a processor-specific preferences block, the starting address shown is the default value. You can change the starting value by entering the new value directly in Address when you select the memory segment to change.

Length

From the starting address, Length sets the length of the memory allocated to the segment in Name. As in all memory entries, specify the length in hexadecimal format, in minimum addressable data units (MADUs). For the Analog Devices processor families, for example, the MADU is 8 bytes, 1 word.

Contents

Contents specifies the kind of program sections that you can store in the memory segment in Name. When you change the processor type, the kinds of information you can store in listed memory segments may change. Generally, the Contents list contains these strings:

You may add or use as many segments of each type as you need, within the limits of the memory on your processor.

Add

Click Add to add a new memory segment to the processor memory map. When you click Add, a new segment name appears, for example NEWMEM1, in Name and on the list. In Name, change the temporary name NEWMEM1 by entering the new segment name. Entering the new name, or clicking OK updates the temporary name on the list to the name you enter.

Remove

Remove a memory segment from the memory map. Select the segment to remove from the list, and click Remove to delete the segment.

Define cache configuration

Options

Enter the label for each option of the selected cache configuration, one label on each line, such as 0kb, 16kb, 32kb and so on.

Add

Click Add to add a new cache configuration to the list. When you click Add, the new cache label appears on the list.

Remove

Remove a cache configuration from the cache list. Select the configuration to remove from the list, and click Remove to delete the cache.

Cache configurations and related options are defined as symbols to the project generator component. Cache options for new processors are not labeled until you add the labels.

Label

Enter your label for the heap in the Label field. Entering the label updates the label of the selected configuration.

Define Default Sections

Options in this region let you specify where various program sections go in memory and the contents and label for each section. You can add text to describe each section. Program sections are distinct from memory segments—sections are portions of the executable code stored in contiguous memory locations. Commonly used sections include .text, .bss, .data, and .stack. Some sections relate to the compiler, and some can be custom sections as you require.

Label

The name of the section corresponds to the symbolic name recognized by the linker program used with the respective processor.

Contents

Contents provides the information about the native of the program section. As the processor type for the target preferences block changes, the kinds of information you store in listed sections may change. Generally, the Contents list contains these strings:

You may add or use as many sections of each type as you need, within the limits of the memory on your processor.

Add

Click Add to add a new section to the list. When you click Add, the new section appears on the list.

Remove

This option lets you remove a section from the section list. Select the section to remove from the list, and click Remove to delete the section.

Sections and related options are defined as symbols to the project generator component. Section options for new processors are not labeled until you add the labels.

Processor Custom Code

The list on the left side of the pane shows the kinds of custom code you can specify for your processor. Each time you use your custom processor as defined in this dialog box, the custom code you enter in this field applies. You can enter custom code in the categories in the following table.

Custom Code EntryDescription
Source files

Enter the full paths to source code files to use with this processor. By default there are no entries in this parameter. Enter each source file on a new line.

Include paths

If you require additional header files on your path, add them by typing the path into the text area, one file per line. The default setting does not include additional paths.

Libraries (Little Endian)These entries identify specific little endian libraries that the processor requires. Add more as you require by entering the full path to the library with the library file in the text area. Enter one library per line. No additional libraries appear in the default configuration.
Libraries (Big Endian)These entries identify specific big endian libraries that the processor requires. Add more as you require by entering the full path to the library with the library file in the text area. No additional libraries appear in the default configuration. Enter one library per line.
Preprocessor symbolsEnter any preprocessor symbols that the new processor requires for operation and compilation. No preprocessor symbols appear in the default configuration. Add the required symbols one symbol per line.

You can use two types of tokens when you specify custom code paths:

  


 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS