bsp/arm/tms570: Add VIM vector table ECC support for 4357x variants

- introduces a variant-aware tms570_vim_t struct so the ECC version
  (on the 4357 variants) can be represented and we can set the required
  flags
- adds the required LC4357 VIM ECC initialization sequence: set
  fallback vector (FBVECADDR), enable ECC and then clear ECC error
  flags after the for loop rewrites the vector table.

See TRM section 19.5.1 Interrupt Vector Table Operation which states:
It is recommended to restore the content of the VIM before clearing the ECCSTAT.
This commit is contained in:
Avi Weiss authored and Gedare Bloom committed 2026-06-17 17:51:14 +00:00
1 parent 841954b1a5
commit 0348f79b45
1 file changed
+31
+31
View File
@@ -361,9 +361,40 @@ void bsp_interrupt_facility_initialize(void)
solution remaps that to address zero.
*/
#if TMS570_VARIANT == 4357
/* FBVECADDR value is indeterminate after reset until explicitly set. */
TMS570_VIM_ECC.FBVECADDR =
(uint32_t) (uintptr_t) _ARMV4_Exception_interrupt;
/*
* Enable ECC for the LC4357 VIM vector table (disabled by default)
*
* ECCCTL settings:
* SBE_EVT: disable to avoid sending single-bit errors to the ESM
* EDAC: detection-only mode (see TMS570LC4357 Silicon Errata VIM#28)
* TEST_DIAG: disable - we're in a normal start-up path
* ECCENA: enable ECC/SECDED feature
*/
TMS570_VIM_ECC.ECCCTL =
TMS570_VIM_ECCCTL_SBE_EVT_EN( TMS570_VIM_ECCCTL_SBE_EVT_DISABLE ) |
TMS570_VIM_ECCCTL_EDAC_MODE( TMS570_VIM_ECCCTL_EDAC_DISABLE ) |
TMS570_VIM_ECCCTL_TEST_DIAG_EN( TMS570_VIM_ECCCTL_TEST_DIAG_DISABLE ) |
TMS570_VIM_ECCCTL_ECCENA( TMS570_VIM_ECCCTL_ECC_ENABLE );
#endif
for ( i = 0; i <= 94; ++i ) {
vim_vec[i] = _ARMV4_Exception_interrupt;
}
#if TMS570_VARIANT == 4357
/*
* Clear any latched errors after the ECC bits were generated above
* to start from a clean state at start-up.
*/
TMS570_VIM_ECC.ECCSTAT =
TMS570_VIM_ECCSTAT_SBERR | TMS570_VIM_ECCSTAT_UERR;
#endif
/* Clear bit VE in SCTLR register to not use VIM IRQ exception bypass*/
asm volatile ("mrc p15, 0, %0, c1, c0, 0\n": "=r" (sctlr));
/*