Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd369a5

Browse files
committed
Added enterbkpt option to assist with debugging
1 parent 83945d5 commit bd369a5

5 files changed

Lines changed: 14 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include libfdt/Makefile.libfdt
22

33
GCC = nspire-gcc
44
LD = nspire-ld
5-
GCCFLAGS = -Os -nostdlib -Wall -W -marm -Ilibfdt/
5+
GCCFLAGS = -mcpu=arm926ej-s -Os -nostdlib -Wall -W -marm -Ilibfdt/
66
# Feel free to comment the following lines out if you're
77
# not using git or you don't want the build date included
88
BUILDFLAGS = -DBUILD_DATE="\"$(shell date --rfc-2822)\""

cmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ int process_cmd(char * cmd) {
8888
DEFINE_COMMAND(probemem, force_guess_memory);
8989
DEFINE_COMMAND(poke, poke);
9090
DEFINE_COMMAND(peek, peek);
91+
DEFINE_COMMAND(enterbkpt, break_on_entry);
9192
/*
9293
End command list. Do not add any more after here
9394
*/

common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ void poke(char *arg) {
9999
peek(arg);
100100
}
101101

102+
void break_on_entry(char *arg) {
103+
settings.break_on_entry = 1;
104+
}
105+
102106
void dump_settings(char * ignored __attribute__((unused))) {
103107
HEADER_LEVEL0(kernel);
104108
DUMP_LEVEL1(settings.kernel, addr);
@@ -131,6 +135,7 @@ void dump_settings(char * ignored __attribute__((unused))) {
131135
DUMP_LEVEL0(settings, initrd_loaded);
132136
DUMP_LEVEL0(settings, kernel_loaded);
133137
DUMP_LEVEL0(settings, dtb_loaded);
138+
DUMP_LEVEL0(settings, break_on_entry);
134139

135140
printl("kernel_cmdline = \"%s\"" NEWLINE, settings.kernel_cmdline);
136141
printl("serialnr = 0x%x%x" NEWLINE, settings.serialnr[1], settings.serialnr[0]);

common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct params {
6060
unsigned initrd_loaded:1;
6161
unsigned kernel_loaded:1;
6262
unsigned dtb_loaded:1;
63+
unsigned break_on_entry:1;
6364
};
6465

6566
extern struct params settings;
@@ -72,4 +73,6 @@ void setget_rdisksize(char * arg);
7273
void poke(char *arg);
7374
void peek(char *arg);
7475

76+
void break_on_entry(char *arg);
77+
7578
#endif

kernel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ void kernel_boot(char * ignored __attribute__((unused))) {
5656
"mcr p15, 0, r0, c1, c0, 0 \n"
5757
: : : "r0" );
5858
/* Bye bye */
59+
if (settings.break_on_entry) {
60+
asm volatile("bkpt #0");
61+
}
62+
5963
entry(0, settings.machine_id, settings.boot_param.start);
6064
__builtin_unreachable();
6165
}

0 commit comments

Comments
 (0)