m68k/mcf5235: GCC 4.9.2 generates invalid code for Init5235.

Move the vector table copy out of the Init5235 source to avoid
stipping the GCC bug.

Fixes #2204.
This commit is contained in:
Chris Johns
2014-12-01 14:55:23 +11:00
parent e37e8504f1
commit dd309b1054
3 changed files with 26 additions and 13 deletions

View File

@@ -32,7 +32,8 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsppredriverhook.c \
startup/bspgetcpuclockspeed.c ../../shared/bsppretaskinghook.c \
../../shared/bspgetworkarea.c startup/init5235.c startup/bspstart.c \
../../shared/bootcard.c ../../shared/sbrk.c ../../shared/setvec.c \
../../shared/gnatinstallhandler.c ../../shared/bspinit.c
../../shared/gnatinstallhandler.c ../../shared/bspinit.c \
startup/copyvectors.c
# clock
libbsp_a_SOURCES += clock/clock.c ../../../shared/clockdrv_shell.h
# console

View File

@@ -0,0 +1,19 @@
/*
* Move the copy out of the Init5235 file because gcc is broken.
*/
#include <stdint.h>
void CopyVectors(const uint32_t* old, uint32_t* new);
void CopyVectors(const uint32_t* old, uint32_t* new)
{
int v = 0;
while (v < 256)
{
*new = *old;
++v;
++new;
++old;
}
}

View File

@@ -9,9 +9,7 @@
#include <rtems.h>
#include <bsp.h>
#define m68k_set_cacr(_cacr) __asm__ volatile ("movec %0,%%cacr" : : "d" (_cacr))
#define m68k_set_acr0(_acr0) __asm__ volatile ("movec %0,%%acr0" : : "d" (_acr0))
#define m68k_set_acr1(_acr1) __asm__ volatile ("movec %0,%%acr1" : : "d" (_acr1))
#define MM_SDRAM_BASE (0x00000000)
/*
@@ -26,6 +24,8 @@ extern uint32_t MCF5235_BSP_START_FROM_FLASH;
extern void CopyDataClearBSSAndStart (void);
extern void INTERRUPT_VECTOR(void);
extern void CopyVectors(const uint32_t* old, uint32_t* new);
void Init5235 (void)
{
int x;
@@ -77,15 +77,7 @@ void Init5235 (void)
} /* we have finished setting up the sdram */
/* Copy the interrupt vector table to address 0x0 in SDRAM */
{
uint32_t *inttab = (uint32_t *)&INTERRUPT_VECTOR;
uint32_t *intvec = (uint32_t *)0x0;
register int i;
for (i = 0; i < 256; i++)
{
*(intvec++) = *(inttab++);
}
}
CopyVectors((const uint32_t *)&INTERRUPT_VECTOR, (uint32_t*)0);
m68k_set_vbr(0);
@@ -93,4 +85,5 @@ void Init5235 (void)
* Copy data, clear BSS and call boot_card()
*/
CopyDataClearBSSAndStart ();
}