Skip to content

Commit

Permalink
Added enterbkpt option to assist with debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tangrs committed Apr 15, 2013
1 parent 83945d5 commit bd369a5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include libfdt/Makefile.libfdt

GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -nostdlib -Wall -W -marm -Ilibfdt/
GCCFLAGS = -mcpu=arm926ej-s -Os -nostdlib -Wall -W -marm -Ilibfdt/
# Feel free to comment the following lines out if you're
# not using git or you don't want the build date included
BUILDFLAGS = -DBUILD_DATE="\"$(shell date --rfc-2822)\""
Expand Down
1 change: 1 addition & 0 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ int process_cmd(char * cmd) {
DEFINE_COMMAND(probemem, force_guess_memory);
DEFINE_COMMAND(poke, poke);
DEFINE_COMMAND(peek, peek);
DEFINE_COMMAND(enterbkpt, break_on_entry);
/*
End command list. Do not add any more after here
*/
Expand Down
5 changes: 5 additions & 0 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ void poke(char *arg) {
peek(arg);
}

void break_on_entry(char *arg) {
settings.break_on_entry = 1;
}

void dump_settings(char * ignored __attribute__((unused))) {
HEADER_LEVEL0(kernel);
DUMP_LEVEL1(settings.kernel, addr);
Expand Down Expand Up @@ -131,6 +135,7 @@ void dump_settings(char * ignored __attribute__((unused))) {
DUMP_LEVEL0(settings, initrd_loaded);
DUMP_LEVEL0(settings, kernel_loaded);
DUMP_LEVEL0(settings, dtb_loaded);
DUMP_LEVEL0(settings, break_on_entry);

printl("kernel_cmdline = \"%s\"" NEWLINE, settings.kernel_cmdline);
printl("serialnr = 0x%x%x" NEWLINE, settings.serialnr[1], settings.serialnr[0]);
Expand Down
3 changes: 3 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct params {
unsigned initrd_loaded:1;
unsigned kernel_loaded:1;
unsigned dtb_loaded:1;
unsigned break_on_entry:1;
};

extern struct params settings;
Expand All @@ -72,4 +73,6 @@ void setget_rdisksize(char * arg);
void poke(char *arg);
void peek(char *arg);

void break_on_entry(char *arg);

#endif
4 changes: 4 additions & 0 deletions kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ void kernel_boot(char * ignored __attribute__((unused))) {
"mcr p15, 0, r0, c1, c0, 0 \n"
: : : "r0" );
/* Bye bye */
if (settings.break_on_entry) {
asm volatile("bkpt #0");
}

entry(0, settings.machine_id, settings.boot_param.start);
__builtin_unreachable();
}

0 comments on commit bd369a5

Please sign in to comment.