Unlike NAND flash, which has spare area
for storing ECC of main area
, NOR flash do not have such provision. NOR flash in AM26x devices are also being used to perform XIP as well.
This Page goes over how safety can be enabled on external NOR flash in AM26x devices which also use NOR flash for XIP.
The following is an example of a config file (conf.json)
There can be at most 4 different ECC regions that can be configured. The above shows 1 region. For example, in am263px, there are 4 different core and each core can have its own region configured. Make sure that each region is not overlaping each other.
In the above, region start address is 0x60100000 and size 4MB.
The example Memory Benchmark with Smart Placement uses XIP and for the sake of demostration, it is being used.
While compiling the application, pass in the argument oeconfig=conf.json
.
For example, if current working directory is /nightlybuilds/mcupsdk_internal/jenkins/release_area/mcu_plus_sdk
, the following command will process the flash contents for ECC.
for Linux machine, gmake
will be replaced by make
.
The following diagram shows
As can be seen, it sits just before the Flash controller
and operates between the data that is coming from the flash and then process it on the fly.
ECCM module works on the bases on inlining of ECC Bytes of data. As per the datasheet of ECCM, it expects 4B of ECC data after every 32B of actual data (As per the below iamge)
Here the requestor, R5F with cache enabled for the external flash, sends request for the data from the flash. R5F sends a request to get 32B of data from the external flash and this request goes via the ECCM, which then ask flash controller
to get 36B of data. When the flash controller
sends back the request 36B of data, ECCM module,
If computed ECC and saved ECC matches, ECCM forwards the data to the requestor, otherwise, it sends 0 and puts up an interrupt to the requestor, indicating that data fault has been detected.
Normal & Cached
in the MPU.bypass region
).To see if the processing has been done correctly, use the command
tiarmreadelf --headers app_name.mcelf_xip
For the processed code, output will be the following:
Without processing, it looks like the following:
on comparing the original program, the segment's address (VirtAddr and PhysAddr) have changed. Earlier, they were 0x60300000, 0x60480000, 0x60600000. Because for every 32B, 4B of ECC has been added, each segment size has been increased from 1MB to 1.125MB and same has happen to address.