mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Now compiles without newlib. Refined the Makefile a little.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3674 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e96a085af8
commit
1dc42d1fcb
4 changed files with 135 additions and 15 deletions
24
gdb/Makefile
24
gdb/Makefile
|
@ -6,25 +6,37 @@
|
||||||
# \/ \/ \/ \/ \/
|
# \/ \/ \/ \/ \/
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
|
ifdef RECORDER
|
||||||
|
EXTRA = -DRECORDER
|
||||||
|
EXT = ajz
|
||||||
|
else
|
||||||
|
EXT = mod
|
||||||
|
endif
|
||||||
|
|
||||||
TARGET = stub
|
TARGET = stub
|
||||||
OBJS = start.o sh-stub.o
|
OBJS = start.o sh-stub.o setjmp.o
|
||||||
LIBS = -lgcc
|
LIBS = -lgcc
|
||||||
|
|
||||||
.s.o:
|
.s.o:
|
||||||
sh-elf-as -o $@ $<
|
sh-elf-as -o $@ $<
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
sh-elf-gcc -O -I../firmware/drivers -m1 -Wall -Wstrict-prototypes -c -o $@ $<
|
sh-elf-gcc -O $(EXTRA) -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
|
||||||
|
|
||||||
archos.mod: $(TARGET).elf
|
.S.o:
|
||||||
|
sh-elf-gcc -O -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
|
||||||
|
|
||||||
|
$(TARGET).$(EXT): $(TARGET).elf
|
||||||
sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
|
sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
|
||||||
../tools/scramble $(TARGET).out archos.mod
|
../tools/scramble $(TARGET).out $(TARGET).$(EXT)
|
||||||
|
|
||||||
$(TARGET).elf: $(OBJS)
|
$(TARGET).elf: $(OBJS)
|
||||||
sh-elf-gcc -nostartfiles $(OBJS) -lgcc -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg
|
sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out archos.mod
|
rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz
|
||||||
|
|
||||||
start.o: start.s
|
start.o: start.s
|
||||||
sh-stub.o: sh-stub.c
|
sh-stub.o: sh-stub.c
|
||||||
|
setjmp.o: setjmp.S
|
||||||
|
|
27
gdb/README
27
gdb/README
|
@ -23,14 +23,23 @@ To debug using the serial port on the Jukebox, you need to do the following:
|
||||||
2) Build or download a GDB SH1 cross debugger
|
2) Build or download a GDB SH1 cross debugger
|
||||||
|
|
||||||
3) Compile the GDB stub from the CVS "gdb" archive
|
3) Compile the GDB stub from the CVS "gdb" archive
|
||||||
|
For Player models, just type:
|
||||||
|
# make
|
||||||
|
|
||||||
|
For Recorder, type
|
||||||
|
#make RECORDER=1
|
||||||
|
|
||||||
4) Copy the newly built ARCHOS.MOD to the Jukebox.
|
4) Copy the newly built ARCHOS.MOD to the Jukebox.
|
||||||
|
|
||||||
5) Start the Jukebox and fire up the GDB with the elf file you want to debug
|
5) Start the Jukebox and fire up the GDB with the elf file you want to debug
|
||||||
as an argument along with the baud rate:
|
as an argument along with the baud rate:
|
||||||
|
|
||||||
|
For Player:
|
||||||
# sh-elf-gdb -b 38400 test.elf
|
# sh-elf-gdb -b 38400 test.elf
|
||||||
|
|
||||||
|
For Recorder:
|
||||||
|
# sh-elf-gdb -b 115200 test.elf
|
||||||
|
|
||||||
6) In GDB, type:
|
6) In GDB, type:
|
||||||
|
|
||||||
(gdb) target remote /dev/ttyS0
|
(gdb) target remote /dev/ttyS0
|
||||||
|
@ -58,13 +67,13 @@ To debug using the serial port on the Jukebox, you need to do the following:
|
||||||
|
|
||||||
8) You're set. Now try to set a breakpoint and run:
|
8) You're set. Now try to set a breakpoint and run:
|
||||||
|
|
||||||
(gdb) b 22
|
(gdb) b main
|
||||||
Breakpoint 1 at 0x90182c6: file led.c, line 14.
|
Breakpoint 1 at 0x9011b2a: file main.c, line 192.
|
||||||
(gdb) c
|
(gdb) c
|
||||||
Continuing.
|
Continuing.
|
||||||
|
|
||||||
Breakpoint 2, main () at led.c:15
|
Breakpoint 1, main () at main.c:192
|
||||||
15 SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
|
192 app_main();
|
||||||
(gdb)
|
(gdb)
|
||||||
|
|
||||||
Good luck!
|
Good luck!
|
||||||
|
@ -73,8 +82,14 @@ To debug using the serial port on the Jukebox, you need to do the following:
|
||||||
Technical details:
|
Technical details:
|
||||||
|
|
||||||
As for now, the GDB stub occupies the memory from 0x900000 up to
|
As for now, the GDB stub occupies the memory from 0x900000 up to
|
||||||
0x9018000. This will change.
|
0x9018000.
|
||||||
|
|
||||||
Compile and link your test program at 0x9018000 and up, and it will work.
|
Compile and link your test program at 0x9018000 and up, and it will work.
|
||||||
|
|
||||||
The baud rate is 38400, and the settings are 8N1.
|
The baud rate is 38400 for Player, 115200 for Recorder, and the settings
|
||||||
|
are 8N1.
|
||||||
|
|
||||||
|
Note that you may have to change the ATA I/O address in the ATA_CONTROL
|
||||||
|
macro in sh-stub.c. go to Menu->Debug (keep out)->View HW info to find out.
|
||||||
|
|
||||||
|
Linus Nielsen Feltzing
|
||||||
|
|
59
gdb/setjmp.S
Normal file
59
gdb/setjmp.S
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Red Hat Inc
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
.type _setjmp,@function
|
||||||
|
.global _setjmp
|
||||||
|
_setjmp:
|
||||||
|
add #(9*4),r4
|
||||||
|
|
||||||
|
sts.l pr,@-r4
|
||||||
|
|
||||||
|
mov.l r15,@-r4
|
||||||
|
mov.l r14,@-r4
|
||||||
|
mov.l r13,@-r4
|
||||||
|
mov.l r12,@-r4
|
||||||
|
|
||||||
|
mov.l r11,@-r4
|
||||||
|
mov.l r10,@-r4
|
||||||
|
mov.l r9,@-r4
|
||||||
|
mov.l r8,@-r4
|
||||||
|
|
||||||
|
rts
|
||||||
|
mov #0,r0
|
||||||
|
|
||||||
|
.type _longjmp,@function
|
||||||
|
.global _longjmp
|
||||||
|
_longjmp:
|
||||||
|
mov.l @r4+,r8
|
||||||
|
mov.l @r4+,r9
|
||||||
|
mov.l @r4+,r10
|
||||||
|
mov.l @r4+,r11
|
||||||
|
|
||||||
|
mov.l @r4+,r12
|
||||||
|
mov.l @r4+,r13
|
||||||
|
mov.l @r4+,r14
|
||||||
|
mov.l @r4+,r15
|
||||||
|
|
||||||
|
lds.l @r4+,pr
|
||||||
|
|
||||||
|
mov r5,r0
|
||||||
|
tst r0,r0
|
||||||
|
bf retr4
|
||||||
|
movt r0
|
||||||
|
retr4: rts
|
||||||
|
nop
|
|
@ -166,8 +166,11 @@
|
||||||
|
|
||||||
#include "sh7034.h"
|
#include "sh7034.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <setjmp.h>
|
|
||||||
#include <signal.h>
|
typedef int jmp_buf[20];
|
||||||
|
|
||||||
|
void longjmp(jmp_buf __jmpb, int __retval);
|
||||||
|
int setjmp(jmp_buf __jmpb);
|
||||||
|
|
||||||
/* We need to undefine this from the sh7034.h file */
|
/* We need to undefine this from the sh7034.h file */
|
||||||
#undef GBR
|
#undef GBR
|
||||||
|
@ -411,7 +414,12 @@ static char remcomOutBuffer[BUFMAX];
|
||||||
|
|
||||||
#define ATA_NSECTOR (*((volatile unsigned char*)0x06100102))
|
#define ATA_NSECTOR (*((volatile unsigned char*)0x06100102))
|
||||||
#define ATA_COMMAND (*((volatile unsigned char*)0x06100107))
|
#define ATA_COMMAND (*((volatile unsigned char*)0x06100107))
|
||||||
|
|
||||||
|
#ifdef RECORDER
|
||||||
|
#define ATA_CONTROL (*((volatile unsigned char*)0x06200206))
|
||||||
|
#else
|
||||||
#define ATA_CONTROL (*((volatile unsigned char*)0x06200306))
|
#define ATA_CONTROL (*((volatile unsigned char*)0x06200306))
|
||||||
|
#endif
|
||||||
#define ATA_ALT_STATUS ATA_CONTROL
|
#define ATA_ALT_STATUS ATA_CONTROL
|
||||||
|
|
||||||
#define STATUS_BSY 0x80
|
#define STATUS_BSY 0x80
|
||||||
|
@ -690,6 +698,12 @@ void handle_buserror (void)
|
||||||
longjmp (remcomEnv, 1);
|
longjmp (remcomEnv, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SIGINT 2 /* interrupt */
|
||||||
|
#define SIGILL 4 /* illegal instruction (not reset when caught) */
|
||||||
|
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||||
|
#define SIGEMT 7 /* EMT instruction */
|
||||||
|
#define SIGBUS 10 /* bus error */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this function takes the SH-1 exception number and attempts to
|
* this function takes the SH-1 exception number and attempts to
|
||||||
* translate this number into a unix compatible signal value
|
* translate this number into a unix compatible signal value
|
||||||
|
@ -1509,8 +1523,13 @@ void init_serial (void)
|
||||||
/* Set communication to be async, 8-bit data,
|
/* Set communication to be async, 8-bit data,
|
||||||
no parity, 1 stop bit and use internal clock */
|
no parity, 1 stop bit and use internal clock */
|
||||||
SMR1 = 0;
|
SMR1 = 0;
|
||||||
/* BRR1 = SYSCLOCK / (9600 * 32) - 1;*/
|
|
||||||
|
#ifdef RECORDER
|
||||||
|
#warning 115200
|
||||||
|
BRR1 = 2; /* 115200 */
|
||||||
|
#else
|
||||||
BRR1 = 9; /* 38400 */
|
BRR1 = 9; /* 38400 */
|
||||||
|
#endif
|
||||||
|
|
||||||
SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
|
SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
|
||||||
|
|
||||||
|
@ -1575,3 +1594,18 @@ void handleError (char theSSR)
|
||||||
/* Clear all error bits, otherwise the receiver will stop */
|
/* Clear all error bits, otherwise the receiver will stop */
|
||||||
SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
|
SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *memcpy(void *dest, const void *src0, size_t n)
|
||||||
|
{
|
||||||
|
char *dst = (char *) dest;
|
||||||
|
char *src = (char *) src0;
|
||||||
|
|
||||||
|
void *save = dest;
|
||||||
|
|
||||||
|
while(n--)
|
||||||
|
{
|
||||||
|
*dst++ = *src++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue