The core number specification function enables selection of data allocation area (the local memory in a specified core or the global memory shared by all cores) or selection of the core for function execution (a specified core or any core) when a multi-core device is used.
This function is specified by a combination of the #pragma directive described below and link options.
For example, to allocate variable x (assumed to be allocated to a data section) to the local memory for core number 1, specify as follows.
Specify a pragma directive as follows before the first definition or declaration of variable x in the file: |
This makes the compiler and assembler allocate variable x to section .data.pm1.
This makes the linker allocate section .data.pm1 to the local memory for core number 1 (This example assumes 0xfe8f0000 as an address in the local memory for core number 1).
Specifying core numbers for variables or functions has the following merits.
When a core number is added to each section name, the user can manage the correspondence between cores and variables or functions; that is, which variable is allocated to the local memory of which core and which function is executed in which core. |
As core numbers are added to all section names including the default section names, the user does not need to change the section names for every core. |
The compiler can check the correspondence between core numbers and data or functions (If a function that should be executed only in core 1 calls a function that should be executed only in core 2, the compiler can detect it as an error). |
Specify a core number for a multi-core device in the following format.
This pragma directive is valid only when the -Xmulti_level option is specified. If the -Xmulti_level option is not specified, a warning is output and the core number specification is ignored.
The following table shows the available pm specification forms and the names of the corresponding allocated sections.
Only pm1 to pm255 or cmn can be written as pm specification. For a variable or a function with pm specification, a period (.) and the string used for pm specification is added at the end of the allocated section name.
Allocated to the global shared memory used in common for all cores. |
|||
A warning message is output and the core number specification is ignored. |
#pragma pmodule is applied to all static variable declarations, function declarations, and string literalsNote that appear after the #pragma pmodule declaration line. |
This directive is applied to all items allocated to the section; it is also applied to the string literals allocated to the const section. |
#The #pragma pmodule directive adds the string described above to both the default section names and user-specified section names. |
When the same variable or function declaration is specified multiple times within a single translation unit, if different #pragma pmodule specifications are written for them, the first specification is valid. |
The following shows specification examples.
These examples assume that the -Xmulti_level=1 is specified.