Commit 318f63c8 authored by Damien George's avatar Damien George
Browse files

leon: Use leon_printf instead of mp_printf for manager tasks.

parent c6f62710
...@@ -41,6 +41,7 @@ LIBS += -lm ...@@ -41,6 +41,7 @@ LIBS += -lm
SRC_C = \ SRC_C = \
main.c \ main.c \
lib/libc/string0.c \ lib/libc/string0.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mpvmmanage.c \ $(LEON_COMMON)/mpvmmanage.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
......
...@@ -91,7 +91,7 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -91,7 +91,7 @@ rtems_task Init(rtems_task_argument ignored) {
// MicroPython manager task // MicroPython manager task
#include "py/mpstate.h" #include "py/mpstate.h"
#include "py/mpprint.h" #include "leon-common/leonprintf.h"
#include "mpvmmanage.h" #include "mpvmmanage.h"
// include the precompiled bytecode (generated by external tools) // include the precompiled bytecode (generated by external tools)
...@@ -102,7 +102,7 @@ static mp_state_ctx_t mp_state_ctx[MICROPY_RTEMS_NUM_TASKS]; ...@@ -102,7 +102,7 @@ static mp_state_ctx_t mp_state_ctx[MICROPY_RTEMS_NUM_TASKS];
static byte mp_heap[MICROPY_RTEMS_NUM_TASKS * MICROPY_RTEMS_HEAP_SIZE]; static byte mp_heap[MICROPY_RTEMS_NUM_TASKS * MICROPY_RTEMS_HEAP_SIZE];
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
rtems_name task_name[MICROPY_RTEMS_NUM_TASKS]; rtems_name task_name[MICROPY_RTEMS_NUM_TASKS];
rtems_id task_id[MICROPY_RTEMS_NUM_TASKS]; rtems_id task_id[MICROPY_RTEMS_NUM_TASKS];
...@@ -131,12 +131,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) { ...@@ -131,12 +131,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) {
// pause the script // pause the script
mp_vm_manager_pause(&mp_state_ctx[0], 10000, &line); mp_vm_manager_pause(&mp_state_ctx[0], 10000, &line);
mp_printf(&mp_plat_print, "Manager got line %u\n", (uint)line); leon_printf("Manager got line %u\n", (uint)line);
// step through the script // step through the script
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
mp_vm_manager_step(&mp_state_ctx[0], 10000, &line); mp_vm_manager_step(&mp_state_ctx[0], 10000, &line);
mp_printf(&mp_plat_print, "Manager got line %u\n", (uint)line); leon_printf("Manager got line %u\n", (uint)line);
} }
// resume the script // resume the script
......
...@@ -41,6 +41,7 @@ LIBS += -lm ...@@ -41,6 +41,7 @@ LIBS += -lm
SRC_C = \ SRC_C = \
main.c \ main.c \
lib/libc/string0.c \ lib/libc/string0.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
$(LEON_COMMON)/modtime.c \ $(LEON_COMMON)/modtime.c \
......
...@@ -86,15 +86,15 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -86,15 +86,15 @@ rtems_task Init(rtems_task_argument ignored) {
/******************************************************************************/ /******************************************************************************/
// MicroPython manager task // MicroPython manager task
#include "py/mpprint.h" #include "leon-common/leonprintf.h"
// this function is used as a hook to set a breakpoint to terminate emu // this function is used as a hook to set a breakpoint to terminate emu
void emu_terminate(void) { void emu_terminate(void) {
mp_printf(&mp_plat_print, "emu_terminate\n"); leon_printf("emu_terminate\n");
} }
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
rtems_name task_name[MICROPY_RTEMS_NUM_TASKS]; rtems_name task_name[MICROPY_RTEMS_NUM_TASKS];
rtems_id task_id[MICROPY_RTEMS_NUM_TASKS]; rtems_id task_id[MICROPY_RTEMS_NUM_TASKS];
......
...@@ -43,6 +43,7 @@ LIBS += -lm ...@@ -43,6 +43,7 @@ LIBS += -lm
SRC_C = \ SRC_C = \
main.c \ main.c \
lib/libc/string0.c \ lib/libc/string0.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
$(LEON_COMMON)/modtime.c \ $(LEON_COMMON)/modtime.c \
......
...@@ -82,15 +82,15 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -82,15 +82,15 @@ rtems_task Init(rtems_task_argument ignored) {
/******************************************************************************/ /******************************************************************************/
// MicroPython manager task // MicroPython manager task
#include "py/mpprint.h" #include "leon-common/leonprintf.h"
// this function is used as a hook to set a breakpoint to terminate emu // this function is used as a hook to set a breakpoint to terminate emu
void emu_terminate(void) { void emu_terminate(void) {
mp_printf(&mp_plat_print, "emu_terminate\n"); leon_printf("emu_terminate\n");
} }
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
rtems_name task_name[MICROPY_RTEMS_NUM_TASKS]; rtems_name task_name[MICROPY_RTEMS_NUM_TASKS];
rtems_id task_id[MICROPY_RTEMS_NUM_TASKS]; rtems_id task_id[MICROPY_RTEMS_NUM_TASKS];
......
...@@ -41,6 +41,7 @@ LIBS += -lm ...@@ -41,6 +41,7 @@ LIBS += -lm
SRC_C = \ SRC_C = \
main.c \ main.c \
lib/libc/string0.c \ lib/libc/string0.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
$(LEON_COMMON)/modtime.c \ $(LEON_COMMON)/modtime.c \
......
...@@ -85,10 +85,10 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -85,10 +85,10 @@ rtems_task Init(rtems_task_argument ignored) {
/******************************************************************************/ /******************************************************************************/
// MicroPython manager task // MicroPython manager task
#include "py/mpprint.h" #include "leon-common/leonprintf.h"
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
rtems_name task_name[MICROPY_RTEMS_NUM_TASKS]; rtems_name task_name[MICROPY_RTEMS_NUM_TASKS];
rtems_id task_id[MICROPY_RTEMS_NUM_TASKS]; rtems_id task_id[MICROPY_RTEMS_NUM_TASKS];
......
...@@ -48,6 +48,7 @@ SRC_C = \ ...@@ -48,6 +48,7 @@ SRC_C = \
lib/libc/strcmp.c \ lib/libc/strcmp.c \
lib/libc/strlen.c \ lib/libc/strlen.c \
lib/libc/strncmp.c \ lib/libc/strncmp.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/nearbyint.c \ $(LEON_COMMON)/nearbyint.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
......
...@@ -97,16 +97,16 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -97,16 +97,16 @@ rtems_task Init(rtems_task_argument ignored) {
#define MPY_MEM_BASE (0x40200000) #define MPY_MEM_BASE (0x40200000)
#define MPY_MEM_STRIDE (0x00010000) #define MPY_MEM_STRIDE (0x00010000)
#include "py/mpprint.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "leon-common/leonprintf.h"
// this function is used as a hook to set a breakpoint to terminate emu // this function is used as a hook to set a breakpoint to terminate emu
void emu_terminate(void) { void emu_terminate(void) {
mp_printf(&mp_plat_print, "emu_terminate\n"); leon_printf("emu_terminate\n");
} }
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
// detect the number of tasks needed by looking for valid scripts // detect the number of tasks needed by looking for valid scripts
int num_tasks = 0; int num_tasks = 0;
...@@ -120,7 +120,7 @@ rtems_task mp_manager_task(rtems_task_argument ignored) { ...@@ -120,7 +120,7 @@ rtems_task mp_manager_task(rtems_task_argument ignored) {
break; break;
} }
} }
mp_printf(&mp_plat_print, "Detected %u scripts\n", num_tasks); leon_printf("Detected %u scripts\n", num_tasks);
// we must use hexlified output so it isn't modified by the UART // we must use hexlified output so it isn't modified by the UART
mp_hal_stdout_enable_hexlify(); mp_hal_stdout_enable_hexlify();
...@@ -137,12 +137,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) { ...@@ -137,12 +137,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) {
MICROPY_RTEMS_TASK_ATTRIBUTES, &task_id[i] MICROPY_RTEMS_TASK_ATTRIBUTES, &task_id[i]
); );
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
mp_printf(&mp_plat_print, "Error creating task #%u: %u\n", i, status); leon_printf("Error creating task #%u: %u\n", i, status);
emu_terminate(); emu_terminate();
} }
status = rtems_task_start(task_id[i], mp_worker_task, i); status = rtems_task_start(task_id[i], mp_worker_task, i);
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
mp_printf(&mp_plat_print, "Error starting task #%u: %u\n", i, status); leon_printf("Error starting task #%u: %u\n", i, status);
emu_terminate(); emu_terminate();
} }
} }
......
...@@ -48,6 +48,7 @@ SRC_C = \ ...@@ -48,6 +48,7 @@ SRC_C = \
lib/libc/strcmp.c \ lib/libc/strcmp.c \
lib/libc/strlen.c \ lib/libc/strlen.c \
lib/libc/strncmp.c \ lib/libc/strncmp.c \
$(LEON_COMMON)/leonprintf.c \
$(LEON_COMMON)/nearbyint.c \ $(LEON_COMMON)/nearbyint.c \
$(LEON_COMMON)/mputil.c \ $(LEON_COMMON)/mputil.c \
$(LEON_COMMON)/mphalport.c \ $(LEON_COMMON)/mphalport.c \
......
...@@ -97,16 +97,16 @@ rtems_task Init(rtems_task_argument ignored) { ...@@ -97,16 +97,16 @@ rtems_task Init(rtems_task_argument ignored) {
#define MPY_MEM_BASE (0x40200000) #define MPY_MEM_BASE (0x40200000)
#define MPY_MEM_STRIDE (0x00010000) #define MPY_MEM_STRIDE (0x00010000)
#include "py/mpprint.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "leon-common/leonprintf.h"
// this function is used as a hook to set a breakpoint to terminate emu // this function is used as a hook to set a breakpoint to terminate emu
void emu_terminate(void) { void emu_terminate(void) {
mp_printf(&mp_plat_print, "emu_terminate\n"); leon_printf("emu_terminate\n");
} }
rtems_task mp_manager_task(rtems_task_argument ignored) { rtems_task mp_manager_task(rtems_task_argument ignored) {
mp_printf(&mp_plat_print, "\nMicroPython manager task started\n"); leon_printf("\nMicroPython manager task started\n");
// detect the number of tasks needed by looking for valid scripts // detect the number of tasks needed by looking for valid scripts
int num_tasks = 0; int num_tasks = 0;
...@@ -120,7 +120,7 @@ rtems_task mp_manager_task(rtems_task_argument ignored) { ...@@ -120,7 +120,7 @@ rtems_task mp_manager_task(rtems_task_argument ignored) {
break; break;
} }
} }
mp_printf(&mp_plat_print, "Detected %u scripts\n", num_tasks); leon_printf("Detected %u scripts\n", num_tasks);
// we must use hexlified output so it isn't modified by the UART // we must use hexlified output so it isn't modified by the UART
mp_hal_stdout_enable_hexlify(); mp_hal_stdout_enable_hexlify();
...@@ -137,12 +137,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) { ...@@ -137,12 +137,12 @@ rtems_task mp_manager_task(rtems_task_argument ignored) {
MICROPY_RTEMS_TASK_ATTRIBUTES, &task_id[i] MICROPY_RTEMS_TASK_ATTRIBUTES, &task_id[i]
); );
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
mp_printf(&mp_plat_print, "Error creating task #%u: %u\n", i, status); leon_printf("Error creating task #%u: %u\n", i, status);
emu_terminate(); emu_terminate();
} }
status = rtems_task_start(task_id[i], mp_worker_task, i); status = rtems_task_start(task_id[i], mp_worker_task, i);
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
mp_printf(&mp_plat_print, "Error starting task #%u: %u\n", i, status); leon_printf("Error starting task #%u: %u\n", i, status);
emu_terminate(); emu_terminate();
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment