diff options
author | Chris Johns <chrisj@rtems.org> | 2014-12-01 14:55:23 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-12-01 14:55:23 +1100 |
commit | dd309b10544bfceda968ac847ad34c3d90ca8281 (patch) | |
tree | 87460bf9b0a723359ede9eede8fcaa74aa355ab0 /c/src/lib/libbsp/m68k | |
parent | libmisc/shell: Edit history hack is corrupting memory. Remove it. (diff) | |
download | rtems-dd309b10544bfceda968ac847ad34c3d90ca8281.tar.bz2 |
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.
Diffstat (limited to 'c/src/lib/libbsp/m68k')
-rw-r--r-- | c/src/lib/libbsp/m68k/mcf5235/Makefile.am | 3 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mcf5235/startup/copyvectors.c | 19 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c | 17 |
3 files changed, 26 insertions, 13 deletions
diff --git a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am index 403b47f6b0..f24d83014e 100644 --- a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am +++ b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am @@ -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 diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/copyvectors.c b/c/src/lib/libbsp/m68k/mcf5235/startup/copyvectors.c new file mode 100644 index 0000000000..2c54c31a44 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mcf5235/startup/copyvectors.c @@ -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; + } +} diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c b/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c index 7d8ee23a00..5066941be0 100644 --- a/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c +++ b/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c @@ -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 (); + } |