0:11
welcome to the second video of mpu
0:15
this video will cover the memory types
0:18
and attribute types in cortex
0:20
m7 processors we will also see some
0:23
examples for the mpu configuration
0:26
let's start with the memory types the
0:30
cortex m7 memory is mainly divided into
0:34
normal type device type and the strongly
0:39
in the normal memory region the
0:41
processor can reorder the transactions
0:44
to perform the speculative reads
0:47
normal memory is mainly used for code
0:51
and it allows the speculative access
0:54
all the rams are normal memory types
0:57
in the device memory type or the
0:59
strongly ordered memory type
1:01
the order of transactions are intact
1:04
which means the cpu can't reorder the
1:08
the device memory is bufferable and that
1:11
the right to memory can be buffered the
1:14
instruction execution may continue
1:16
and the right to memory can be done
1:20
microcontroller registers a typical
1:22
example of device type
1:23
memory regions on the other hand
1:27
in the strongly ordered memory type the
1:29
write is not bufferable
1:31
so the next instruction can only execute
1:33
once the previous instruction have
1:35
finished writing the data
1:38
external nand memories are typical
1:40
example of strongly ordered memory types
1:42
since they're each right needs to be
1:44
visible to the memory
1:46
here you can see the default memory
1:48
types in cortex m7 processors
1:52
you can pause the video and read about
1:56
or i will leave the link to this
1:57
presentation in the description below
2:01
basically the ram region is normal
2:05
the peripherals and the external devices
2:08
are the device memory types
2:10
and the system specific controls like
2:14
and timers are strongly ordered memory
2:18
even though the memory regions have
2:20
these properties by default
2:22
we can modify them according to our
2:26
and this is where the m p u comes into
2:30
we will see more about them in a while
2:33
there are mainly 4 attributes in the
2:38
shareable cachable bufferable and
2:42
a shareable region must be used when the
2:45
multiple masters are accessing a memory
2:49
example dma and processor core trying to
2:53
access the same region
2:55
or maybe 2 dma are using the same region
2:59
strongly ordered memory types are always
3:03
also if the region is both shareable and
3:07
then the data cache can't be used in
3:10
and only the instruction cache can be
3:14
a typical example for shareable region
3:16
usage is in the ethernet
3:19
here the transmit and receive dma
3:21
descriptors are going to share the
3:25
so this is how we set the 256 bytes of
3:30
we will see more about this in the
3:35
next we have is the cachable attribute
3:38
this is the region where the instruction
3:40
and data cache can be used
3:43
using cache improves the performance by
3:46
but the problem occurs when multiple
3:48
masters access the same region
3:51
here the data synchronization cannot be
3:54
done with cache enabled
3:56
we have already covered this in previous
3:58
video that when multiple masters access
4:00
some common region the cache must be
4:04
or we can also try some software
4:06
solution where we invalidate the cache
4:09
or clean the cache anyway i will go with
4:12
disabling the cachable region
4:14
and here is an example for the same
4:18
suppose the rx buffer is at this
4:21
dma is trying to copy the data from the
4:23
peripheral to this rx buffer
4:26
in this case we must disable the cache
4:30
and we can do that in the mpu i will
4:33
cover the reason for this in the next
4:35
where we will just focus on cache
4:39
next is the bufferable attribute in the
4:43
the right to the memory can be buffered
4:46
this means that the instruction may
4:49
while the write can be performed later
4:52
device memory regions are bufferable
4:55
like the microcontroller registers
4:58
next is the execute never attribute
5:01
this is again a very important attribute
5:05
where we don't want the instructions to
5:09
the instructions are stored and executed
5:12
which is typically a normal memory
5:16
so the device memory region and the
5:18
strongly ordered memory regions should
5:20
be set as execute never attribute
5:23
we can again take a look at the default
5:26
and here you can see everything other
5:28
than normal memory region
5:30
is set to execute never this is an
5:34
where the flash have been relocated to
5:39
you might have heard of booting from the
5:42
and this is what's going on here the
5:45
qspi by default is set to external ram
5:49
as a normal memory type this means that
5:52
the instructions can execute from this
5:55
and this would make the processor to
5:57
perform speculative instruction fetch in
6:00
but since we are using it as a flash
6:02
memory we must prevent the instruction
6:06
region and that's why we would set it as
6:10
here are some important thing that
6:12
should be kept in mind
6:14
these are the instructions from one of
6:19
for any address that is not safe to
6:22
speculative access must be prevented
6:26
to do that we can set the region as
6:29
or strongly ordered memory along with
6:33
and finally here is the list of
6:36
attributes set up for the different
6:39
for example if we want to set the memory
6:43
we have to set the tech zero
6:45
non-cachable but bufferable and
6:49
this way we can set the desired memory
6:52
using the attributes in the mpu
6:55
this is it for this video we saw the
6:58
memory types and attribute types in
7:01
m7 processors and also some examples of
7:05
attributes the next video will cover the
7:10
and the cache policy you can download
7:13
the presentation below keep watching
7:17
and have a nice day ahead