processors. Its address range is from 0x0000000 to 0xefffffff
while the address range of both local memories is from
0xf0000000 to 0xffffffff. By default, the application will be
loaded at shared memory. The full memory map for each
processor is mapped into the shared memory object except for
a small section of local memory for each stack. So, the
icmLoadProcessorMemory() function is used once for one of
processors. By this way, the application is loaded on the shared
memory from which both processors will execute the same
main code and each processor executes its tasks. Tasks can be
dependent or independent.
As the shared memory is connected at the address 0, we
should use flags for the synchronization between the different
processors. Besides, the scheduler of the OVPsim begins by the
processor having the upper identifier. So, to get the execution
order that suits our application, the flags are the solution. To
divide jobs between processors, we use the impProcessorId()
call which is an Imperas function used to identify processor.
B. Shared memory at a particular bus’s adress
Instead of connecting the shared memory at the first
address: 0x00000000, it can be connected at any address that
belongs to the bus address range provided that it is not mapped
or used by other components.
We define an architecture composed of two processors
connected to a shared memory with an address range from
0x80000000 to 0xffffffff.Each processor has its local memory
mapped from 0x00000000 to 0x7fffffff. The application is
loaded in the local memory as it is connected at the address
0x00000000. We should have two application files which are s
loaded in the local memory of each processor. The shared
address has to be visible for both processors. In order to
successfully exploit the shared memory, we use the algorithm
of Peterson for mutual exclusion. This algorithm allows two
processes to share a single-use resource without conflict based
on a shared memory for communication. Two processes can
never be in the critical section at the same time.
C. Shared memory and Linux
For the communication between different processors
booting an OS (Linux in our case), the use of the shared
memory remains a valid solution. We use the memory mapped
files which enable several processes to map the same file and
the interaction between them. The mmap() function offers this
service.
In case of a multiprocessor architecture, where processors
boot Linux, we should include the header: #include
in order to use of the mmap() function in our
application which is cross-compiled for a target,. The mapping
is from the address space of the process to the object
represented by the file descriptor as it is shown in Figure 1.
This file descriptor (fd), should be instantiated as following:
fd = open("/dev/mem", O_RDWR | O_SYNC)