diff --git a/demos/SPC5/NIL-SPC560D-EVB/main.c b/demos/SPC5/NIL-SPC560D-EVB/main.c index 2c63168c4..0e3ad525e 100644 --- a/demos/SPC5/NIL-SPC560D-EVB/main.c +++ b/demos/SPC5/NIL-SPC560D-EVB/main.c @@ -18,74 +18,6 @@ #include "hal.h" //#include "test.h" -#if 0 -#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(1024) -#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256) - -static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { - size_t n, size; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: mem\r\n"); - return; - } - n = chHeapStatus(NULL, &size); - chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus()); - chprintf(chp, "heap fragments : %u\r\n", n); - chprintf(chp, "heap free total : %u bytes\r\n", size); -} - -static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { - static const char *states[] = {CH_STATE_NAMES}; - thread_t *tp; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: threads\r\n"); - return; - } - chprintf(chp, " addr stack prio refs state time\r\n"); - tp = chRegFirstThread(); - do { - chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s\r\n", - (uint32_t)tp, (uint32_t)tp->p_ctx.sp, - (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), - states[tp->p_state]); - tp = chRegNextThread(tp); - } while (tp != NULL); -} - -static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { - thread_t *tp; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: test\r\n"); - return; - } - tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(), - TestThread, chp); - if (tp == NULL) { - chprintf(chp, "out of memory\r\n"); - return; - } - chThdWait(tp); -} - -static const ShellCommand commands[] = { - {"mem", cmd_mem}, - {"threads", cmd_threads}, - {"test", cmd_test}, - {NULL, NULL} -}; - -static const ShellConfig shell_cfg1 = { - (BaseSequentialStream *)&SD1, - commands -}; -#endif - /* * LEDs blinker thread, times are in milliseconds. */ @@ -174,7 +106,7 @@ int main(void) { * - Kernel initialization, the main() function becomes a thread and the * RTOS is active. */ -// halInit(); + halInit(); chSysInit(); /* This is now the idle thread loop, you may perform here a low priority diff --git a/demos/SPC5/NIL-SPC560D-EVB/nilconf.h b/demos/SPC5/NIL-SPC560D-EVB/nilconf.h index ff54fbe41..ad25ddc22 100644 --- a/demos/SPC5/NIL-SPC560D-EVB/nilconf.h +++ b/demos/SPC5/NIL-SPC560D-EVB/nilconf.h @@ -40,7 +40,7 @@ * @note This number is not inclusive of the idle thread which is * Implicitly handled. */ -#define NIL_CFG_NUM_THREADS 3 +#define NIL_CFG_NUM_THREADS 1 /** @} */ diff --git a/os/nil/ports/e200/nilcore.c b/os/nil/ports/e200/nilcore.c index 5ca3e40c0..1f6e62fe1 100644 --- a/os/nil/ports/e200/nilcore.c +++ b/os/nil/ports/e200/nilcore.c @@ -73,8 +73,8 @@ void port_dummy1(void) { asm ("stw %r0, 0(%sp)"); /* CR. */ asm ("stmw %r14, 4(%sp)"); /* GPR14...GPR31. */ - asm ("stw %sp, 12(%r4)"); /* Store swapped-out stack. */ - asm ("lwz %sp, 12(%r3)"); /* Load swapped-in stack. */ + asm ("stw %sp, 0(%r4)"); /* Store swapped-out stack. */ + asm ("lwz %sp, 0(%r3)"); /* Load swapped-in stack. */ asm ("lmw %r14, 4(%sp)"); /* GPR14...GPR31. */ asm ("lwz %r0, 0(%sp)"); /* CR. */