# HG changeset patch # User Mychaela Falconia # Date 1580673682 0 # Node ID cef70d53fc5ef26d8d4e5ffae49c69db4055f0fb # Parent aba969153d2059eb146668d6a9a0c626bd51d45b loadtools: new -P boot control mechanism implemented diff -r aba969153d20 -r cef70d53fc5e libpwon/forkoff.c --- a/libpwon/forkoff.c Sun Feb 02 19:37:50 2020 +0000 +++ b/libpwon/forkoff.c Sun Feb 02 20:01:22 2020 +0000 @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -23,3 +24,12 @@ perror(shell_pathname); _exit(1); } + +pwon_if_needed() +{ + if (!bootctrl_pwon_cmd[0]) + return(0); + signal(SIGCHLD, SIG_IGN); + fork_exec_pwon_cmd(); + return(1); +} diff -r aba969153d20 -r cef70d53fc5e loadtools/Makefile --- a/loadtools/Makefile Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/Makefile Sun Feb 02 20:01:22 2020 +0000 @@ -33,6 +33,7 @@ labaud.o ltexit.o romdump.o romload.o srecreader.o tpinterf.o \ tpinterf2.o +LIBPWON= ../libpwon/libpwon.a LIBSERIAL= ../libserial/libserial.a all: ${PROGS} @@ -40,20 +41,20 @@ fc-compalram: ${COMPALRAM_OBJS} ${LIBSERIAL} ${CC} ${CFLAGS} -o $@ ${COMPALRAM_OBJS} ${LIBSERIAL} -fc-iram: ${IRAM_OBJS} ${LIBSERIAL} - ${CC} ${CFLAGS} -o $@ ${IRAM_OBJS} ${LIBSERIAL} +fc-iram: ${IRAM_OBJS} ${LIBPWON} ${LIBSERIAL} + ${CC} ${CFLAGS} -o $@ ${IRAM_OBJS} ${LIBPWON} ${LIBSERIAL} -fc-loadtool: ${LOADTOOL_OBJS} ${LIBSERIAL} - ${CC} ${CFLAGS} -o $@ ${LOADTOOL_OBJS} ${LIBSERIAL} +fc-loadtool: ${LOADTOOL_OBJS} ${LIBPWON} ${LIBSERIAL} + ${CC} ${CFLAGS} -o $@ ${LOADTOOL_OBJS} ${LIBPWON} ${LIBSERIAL} -fc-xram: ${XRAM_OBJS} ${LIBSERIAL} - ${CC} ${CFLAGS} -o $@ ${XRAM_OBJS} ${LIBSERIAL} +fc-xram: ${XRAM_OBJS} ${LIBPWON} ${LIBSERIAL} + ${CC} ${CFLAGS} -o $@ ${XRAM_OBJS} ${LIBPWON} ${LIBSERIAL} -fc-buzplay: ${BUZPLAY_OBJS} ${LIBSERIAL} - ${CC} ${CFLAGS} -o $@ ${BUZPLAY_OBJS} ${LIBSERIAL} +fc-buzplay: ${BUZPLAY_OBJS} ${LIBPWON} ${LIBSERIAL} + ${CC} ${CFLAGS} -o $@ ${BUZPLAY_OBJS} ${LIBPWON} ${LIBSERIAL} -fc-dspromdump: ${ROMDUMP_OBJS} ${LIBSERIAL} - ${CC} ${CFLAGS} -o $@ ${ROMDUMP_OBJS} ${LIBSERIAL} +fc-dspromdump: ${ROMDUMP_OBJS} ${LIBPWON} ${LIBSERIAL} + ${CC} ${CFLAGS} -o $@ ${ROMDUMP_OBJS} ${LIBPWON} ${LIBSERIAL} install: mkdir -p ${INSTBIN} diff -r aba969153d20 -r cef70d53fc5e loadtools/bpmain.c --- a/loadtools/bpmain.c Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/bpmain.c Sun Feb 02 20:01:22 2020 +0000 @@ -27,7 +27,7 @@ int c; char command[512]; - while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:r:")) != EOF) + while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:P:r:")) != EOF) switch (c) { case 'a': iramimage.filename = optarg; @@ -50,6 +50,10 @@ case 'i': set_beacon_interval(optarg); continue; + case 'P': + if (find_bootctrl_entry(optarg) < 0) + exit(1); /* error msg already printed */ + continue; case 'r': reattach = find_baudrate_by_name(optarg); if (!reattach) @@ -71,6 +75,7 @@ if (reattach) set_serial_baudrate(reattach); else { + pwon_if_needed(); perform_compal_stage(); perform_romload(); putchar('\n'); diff -r aba969153d20 -r cef70d53fc5e loadtools/clmain.c --- a/loadtools/clmain.c Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/clmain.c Sun Feb 02 20:01:22 2020 +0000 @@ -37,7 +37,7 @@ int c; struct baudrate *br; - while ((c = getopt(argc, argv, "+a:b:B:c:C:h:H:i:jr:")) != EOF) + while ((c = getopt(argc, argv, "+a:b:B:c:C:h:H:i:jP:r:")) != EOF) switch (c) { case 'a': iramimage.filename = optarg; @@ -69,6 +69,10 @@ case 'j': xram_jtag_mode = 1; continue; + case 'P': + if (find_bootctrl_entry(optarg) < 0) + exit(1); /* error msg already printed */ + continue; case 'r': br = find_baudrate_by_name(optarg); if (!br) @@ -93,6 +97,7 @@ } open_serial_port(target_ttydev); + pwon_if_needed(); perform_compal_stage(); perform_romload(); /* loadagent should be running now */ diff -r aba969153d20 -r cef70d53fc5e loadtools/ltmain.c --- a/loadtools/ltmain.c Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/ltmain.c Sun Feb 02 20:01:22 2020 +0000 @@ -28,7 +28,7 @@ int c; char command[512]; - while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:r:")) != EOF) + while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:P:r:")) != EOF) switch (c) { case 'a': iramimage.filename = optarg; @@ -56,6 +56,10 @@ case 'i': set_beacon_interval(optarg); continue; + case 'P': + if (find_bootctrl_entry(optarg) < 0) + exit(1); /* error msg already printed */ + continue; case 'r': reattach = find_baudrate_by_name(optarg); if (!reattach) @@ -77,6 +81,7 @@ if (reattach) set_serial_baudrate(reattach); else { + pwon_if_needed(); perform_compal_stage(); perform_romload(); putchar('\n'); diff -r aba969153d20 -r cef70d53fc5e loadtools/romdump.c --- a/loadtools/romdump.c Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/romdump.c Sun Feb 02 20:01:22 2020 +0000 @@ -44,7 +44,7 @@ struct baudrate *br; char *targv[2]; - while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:")) != EOF) + while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:P:")) != EOF) switch (c) { case 'a': iramimage.filename = optarg; @@ -73,6 +73,10 @@ case 'i': set_beacon_interval(optarg); continue; + case 'P': + if (find_bootctrl_entry(optarg) < 0) + exit(1); /* error msg already printed */ + continue; case '?': default: usage: fprintf(stderr, @@ -87,6 +91,7 @@ iramimage.filename = default_dspdump_image; open_serial_port(target_ttydev); + pwon_if_needed(); perform_compal_stage(); perform_romload(); /* dspdump target program should be running now */ diff -r aba969153d20 -r cef70d53fc5e loadtools/sertool.c --- a/loadtools/sertool.c Sun Feb 02 19:37:50 2020 +0000 +++ b/loadtools/sertool.c Sun Feb 02 20:01:22 2020 +0000 @@ -26,7 +26,7 @@ extern int optind; int c; - while ((c = getopt(argc, argv, "b:c:C:h:H:i:")) != EOF) + while ((c = getopt(argc, argv, "b:c:C:h:H:i:P:")) != EOF) switch (c) { case 'b': set_romload_baudrate(optarg); @@ -46,6 +46,10 @@ case 'i': set_beacon_interval(optarg); continue; + case 'P': + if (find_bootctrl_entry(optarg) < 0) + exit(1); /* error msg already printed */ + continue; case '?': default: usage: fprintf(stderr, @@ -62,6 +66,7 @@ } open_serial_port(target_ttydev); + pwon_if_needed(); perform_compal_stage(); perform_romload(); if (passon_argv)