When the extended cache is enabled AND the base address of the flash device given to levelx is zero, _lx_nor_flash_driver_read will never return.
The nor flash's base address is set, at least in my case, in my driver as follows. This is very convenient as for writing as I need to provide a flash address which is not offset by any amount. For reading from the device, I offset as necessary.
nor_flash->lx_nor_flash_base_address = 0;
When _lx_nor_flash_driver_read checks if there is a cache entry for an address, there is a check to see if cache_entry_start is non zero. This causes the caching of the first sector to fail and when _lx_nor_flash_driver_read tries to read the first sector, it will never return as it can never see the cache entry which exists.
Specifically at the very least, this line:
if ((cache_entry_start) && (flash_address >= cache_entry_start) && (flash_address < cache_entry_end))
Should not simply check if cache_entry_start is non-zero. However, I don't think the solution is just to remove that check, but I'm not sure.
Given this error, I'm concerned there are other errors in the code regarding a flash address base of zero. I'm assuming this is just a mistake, as if it was not, the init function should check for the zeroed flash address.
When the extended cache is enabled AND the base address of the flash device given to levelx is zero, _lx_nor_flash_driver_read will never return.
The nor flash's base address is set, at least in my case, in my driver as follows. This is very convenient as for writing as I need to provide a flash address which is not offset by any amount. For reading from the device, I offset as necessary.
nor_flash->lx_nor_flash_base_address = 0;When
_lx_nor_flash_driver_readchecks if there is a cache entry for an address, there is a check to see ifcache_entry_startis non zero. This causes the caching of the first sector to fail and when_lx_nor_flash_driver_readtries to read the first sector, it will never return as it can never see the cache entry which exists.Specifically at the very least, this line:
if ((cache_entry_start) && (flash_address >= cache_entry_start) && (flash_address < cache_entry_end))Should not simply check if
cache_entry_startis non-zero. However, I don't think the solution is just to remove that check, but I'm not sure.Given this error, I'm concerned there are other errors in the code regarding a flash address base of zero. I'm assuming this is just a mistake, as if it was not, the init function should check for the zeroed flash address.