(Hopefully) fixed wrong calculation of BaS copy adresses

This commit is contained in:
Markus Fröschle
2012-10-15 06:14:43 +00:00
parent 017149f365
commit 553cf4cd39

View File

@@ -794,26 +794,26 @@ asm(
} }
/* copy the BaS code contained in flash to its final location */ /* copy the BaS code contained in flash to its final location */
src = copy_start; src = &copy_start;
dst = Bas_base; dst = &Bas_base;
jmp = (uint8_t *) BaS - copy_start + Bas_base; jmp = (uint8_t *) &BaS - (uint32_t) &copy_start + (uint32_t) &Bas_base;
do { do {
*src++ = *dst++; *src++ = *dst++;
*src++ = *dst++; *src++ = *dst++;
*src++ = *dst++; *src++ = *dst++;
*src++ = *dst++; *src++ = *dst++;
} while (src < (uint8_t *) copy_end); } while (src < (uint8_t *) &copy_end);
flushDataCacheRegion(Bas_base, (uint8_t *) copy_end - copy_start); flushDataCacheRegion(Bas_base, (uint8_t *) &copy_end - copy_start);
flushInstructionCacheRegion(Bas_base, (uint8_t *) copy_end - copy_start); flushInstructionCacheRegion(Bas_base, (uint8_t *) &copy_end - copy_start);
asm volatile( __asm__ __volatile__(
" .global _copy_start | \n\t" " .global _copy_start | \n\t"
" move.l %0,a3 | calculated start address\n\t" " move.l %0,a3 | calculated start address\n\t"
" jmp (a3) | go! \n\t" " jmp (a3) | go! \n\t"
"_copy_start: | \n\t" "_copy_start: | \n\t"
/* output */ : /* output */ :
/* input */ : "g" (jmp) /* input */ : "g" (jmp)
/* clobber */: "a3" /* clobber */: "a3", "memory"
); );
} }