summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-05-01 22:15:36 +0000
committerJens Arnold <amiconn@rockbox.org>2006-05-01 22:15:36 +0000
commit9e3da0d6d5bc9d02b939dedd62e05f8893940c1a (patch)
treecb22ade843ac9118affd9e09604b7c2151eee5c0
parent442b58cc3d09e0651e1b64f318b86462d0042440 (diff)
downloadrockbox-9e3da0d6d5bc9d02b939dedd62e05f8893940c1a.tar.gz
rockbox-9e3da0d6d5bc9d02b939dedd62e05f8893940c1a.zip
Fix red bootbox builds with gcc 4.x and -Os. Save a bit of code by not including the never called UIE0..UIE3.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9857 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/system.c135
1 files changed, 66 insertions, 69 deletions
diff --git a/firmware/system.c b/firmware/system.c
index fe2446e1c3..81d5ee9202 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -688,11 +688,13 @@ static const char* const irqname[] = {
"\n\t.set\t_" #name ",_UIE" #number \
"\n\t.long\t_" #name "\n"
+asm (
+
/* Vector table.
* Handled in asm because gcc 4.x doesn't allow weak aliases to symbols
* defined in an asm block -- silly.
* Reset vectors (0..3) are handled in crt0.S */
-asm (
+
".section\t.vectors,\"aw\",@progbits\n"
DEFAULT_INTERRUPT (GII, 4)
RESERVE_INTERRUPT ( 5)
@@ -800,76 +802,11 @@ asm (
DEFAULT_INTERRUPT (TEI1, 107)
RESERVE_INTERRUPT ( 108)
DEFAULT_INTERRUPT (ADITI, 109)
- "\t.text\n"
-);
-
-extern void UIE0(void); /* needed for calculating the UIE number */
-
-void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
-{
-#if CONFIG_LED == LED_REAL
- bool state = true;
-#endif
- unsigned int n;
- char str[32];
-
- asm volatile ("sts\tpr,%0" : "=r"(n));
-
- /* clear screen */
- lcd_clear_display ();
-#ifdef HAVE_LCD_BITMAP
- lcd_setfont(FONT_SYSFIXED);
-#endif
- /* output exception */
- n = (n - (unsigned)UIE0 - 4)>>2; /* get exception or interrupt number */
- snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]);
- lcd_puts(0,0,str);
- snprintf(str,sizeof(str),"at %08x",pc);
- lcd_puts(0,1,str);
-
-#ifdef HAVE_LCD_BITMAP
- lcd_update ();
-#endif
-
- while (1)
- {
-#if CONFIG_LED == LED_REAL
- volatile int i;
- led (state);
- state = !state;
-
- for (i = 0; i < 240000; ++i);
-#endif
-
- /* try to restart firmware if ON is pressed */
-#if CONFIG_KEYPAD == PLAYER_PAD
- if (!(PADRL & 0x20))
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#ifdef HAVE_FMADC
- if (!(PCDR & 0x0008))
-#else
- if (!(PBDRH & 0x01))
-#endif
-#elif CONFIG_KEYPAD == ONDIO_PAD
- if (!(PCDR & 0x0008))
-#endif
- {
- /* enable the watchguard timer, but don't service it */
- RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
- TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
- }
- }
-}
/* UIE# block.
- * Keep directly after UIE() to let it go into the same section as UIE().
- * Otherwise there will be displacement overflows with sectioned compilation
- * (bootbox) */
-asm (
- "_UIE0:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
- "_UIE1:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
- "_UIE2:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
- "_UIE3:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
+ * Must go into the same section as the UIE() handler */
+
+ "\t.text\n"
"_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
"_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
"_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
@@ -976,8 +913,68 @@ asm (
"_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
"_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
"_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
+
);
+extern void UIE4(void); /* needed for calculating the UIE number */
+
+void UIE (unsigned int pc) __attribute__((section(".text")));
+void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
+{
+#if CONFIG_LED == LED_REAL
+ bool state = true;
+#endif
+ unsigned int n;
+ char str[32];
+
+ asm volatile ("sts\tpr,%0" : "=r"(n));
+
+ /* clear screen */
+ lcd_clear_display ();
+#ifdef HAVE_LCD_BITMAP
+ lcd_setfont(FONT_SYSFIXED);
+#endif
+ /* output exception */
+ n = (n - (unsigned)UIE4 - 20)>>2; /* get exception or interrupt number */
+ snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]);
+ lcd_puts(0,0,str);
+ snprintf(str,sizeof(str),"at %08x",pc);
+ lcd_puts(0,1,str);
+
+#ifdef HAVE_LCD_BITMAP
+ lcd_update ();
+#endif
+
+ while (1)
+ {
+#if CONFIG_LED == LED_REAL
+ volatile int i;
+ led (state);
+ state = !state;
+
+ for (i = 0; i < 240000; ++i);
+#endif
+
+ /* try to restart firmware if ON is pressed */
+#if CONFIG_KEYPAD == PLAYER_PAD
+ if (!(PADRL & 0x20))
+#elif CONFIG_KEYPAD == RECORDER_PAD
+#ifdef HAVE_FMADC
+ if (!(PCDR & 0x0008))
+#else
+ if (!(PBDRH & 0x01))
+#endif
+#elif CONFIG_KEYPAD == ONDIO_PAD
+ if (!(PCDR & 0x0008))
+#endif
+ {
+ /* enable the watchguard timer, but don't service it */
+ RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
+ TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
+ }
+ }
+}
+
void system_init(void)
{
/* Disable all interrupts */