Forum Discussion
Altera_Forum
Honored Contributor
21 years agoI'm not sure what your startup code does, but there are a few
things you might want to double-check: 1. If your startup code copies the kernel into SDRAM, make sure you flush the data cache, invalidate the instruction cache, sync, then flush the pipeline. There's a little routine that does such below. 2. Make sure interrupts are disabled. 3. Make sure you have your stack setup. 4. Check the kernel startup code to make sure its relocation implementation isn't broken. I haven't looked closely at it yet, but some (new) implementations don't do this too well ... especially if there is an overlap of source and destination locations ;-) Regards, --ScottC Interface:
extern void flush_cache (void *p, unsigned len);
p -pointer to base of copied code.
len -length (bytes) of copied code.
--------------------------------------------------------------------
.global flush_cache
flush_cache:
add r5, r5, r4
mov r9, r4
mov r10, r5
/* Flush data cache */
movhi r8, %hi(DCACHELINE_SIZE)
ori r8, r8, %lo(DCACHELINE_SIZE)
0: flushd 0(r4)
add r4, r4, r8
bltu r4, r5, 0b
/* Invalidateinstruction cache */
mov r4, r9
mov r5, r10
movhi r8, %hi(ICACHELINE_SIZE)
ori r8, r8, %lo(ICACHELINE_SIZE)
1: flushi r4
add r4, r4, r8
bltu r4, r5, 1b
/* sync and flush the pipeline */
sync
flushp
ret