Skip to content

Commit

Permalink
SoC/evalsoc: Fix compile error when I/D cache not present
Browse files Browse the repository at this point in the history
make IC_EN=0 DC_EN=0 all

../../../SoC/evalsoc/Common/Source/system_evalsoc.c: In function '_premain_init':
../../../SoC/evalsoc/Common/Source/system_evalsoc.c:848:9: warning: implicit declaration of function 'ICachePresent' [-Wimplicit-function-declaration]
  848 |     if (ICachePresent()) { // Check whether icache real present or not
      |         ^~~~~~~~~~~~~
../../../SoC/evalsoc/Common/Source/system_evalsoc.c:863:9: warning: implicit declaration of function 'DCachePresent' [-Wimplicit-function-declaration]
  863 |     if (DCachePresent()) { // Check whether dcache real present or not

Signed-off-by: Huaqi Fang <[email protected]>
  • Loading branch information
fanghuaqi committed Jul 17, 2024
1 parent 58fad7a commit c510749
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions SoC/evalsoc/Common/Source/system_evalsoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ void _premain_init(void)
// __CCM_PRESENT is still default to 0 in evalsoc.h, since it is used in core_feature_eclic.h to register interrupt, if set to 1, it might cause exception
// but in the cpu, icache or dcache might not exist due to cpu configuration, so here
// we need to check whether icache/dcache really exist, if yes, then turn on it
#if defined(__ICACHE_PRESENT) || defined(RUNMODE_ECC_EN)
#if defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1)
if (ICachePresent()) { // Check whether icache real present or not
#if defined(RUNMODE_ECC_EN)
#if RUNMODE_ECC_EN == 0
Expand All @@ -811,13 +811,10 @@ void _premain_init(void)
__RV_CSR_SET(CSR_MCACHE_CTL, MCACHE_CTL_IC_ECC_EN | MCACHE_CTL_IC_ECC_EXCP_EN | MCACHE_CTL_IC_ECC_CHK_EN);
#endif
#endif

#if defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1)
EnableICache();
#endif
}
#endif
#if defined(__DCACHE_PRESENT) || defined(RUNMODE_ECC_EN)
#if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1)
if (DCachePresent()) { // Check whether dcache real present or not
#if defined(RUNMODE_ECC_EN)
#if RUNMODE_ECC_EN == 0
Expand All @@ -826,9 +823,7 @@ void _premain_init(void)
__RV_CSR_SET(CSR_MCACHE_CTL, MCACHE_CTL_DC_ECC_EN | MCACHE_CTL_DC_ECC_EXCP_EN | MCACHE_CTL_DC_ECC_CHK_EN);
#endif
#endif
#if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1)
EnableDCache();
#endif
}
#endif

Expand Down

0 comments on commit c510749

Please sign in to comment.