From 304fefdb085815205dd0c8810ded0509cb19705b Mon Sep 17 00:00:00 2001 From: Mark Vousden Date: Thu, 26 Aug 2021 14:45:38 +0100 Subject: [PATCH 1/3] Support boot in hostlink without starting the cores. --- hostlink/HostLink.cpp | 7 ++++--- hostlink/HostLink.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hostlink/HostLink.cpp b/hostlink/HostLink.cpp index e6a18e28..8d241dc3 100644 --- a/hostlink/HostLink.cpp +++ b/hostlink/HostLink.cpp @@ -402,7 +402,8 @@ bool HostLink::canRecv() } // Load application code and data onto the mesh -void HostLink::boot(const char* codeFilename, const char* dataFilename) +void HostLink::boot(const char* codeFilename, const char* dataFilename, + bool start) { MemFileReader code(codeFilename); MemFileReader data(dataFilename); @@ -473,8 +474,8 @@ void HostLink::boot(const char* codeFilename, const char* dataFilename) // Step 3: start cores // ------------------- - // Send start command - startAll(); + // Send start command, if desired + if (start) startAll(); } // Trigger to start application execution diff --git a/hostlink/HostLink.h b/hostlink/HostLink.h index b5cbc616..d75f86ea 100644 --- a/hostlink/HostLink.h +++ b/hostlink/HostLink.h @@ -133,7 +133,8 @@ class HostLink { // (Only thread 0 on each core is active when the boot loader is running) // Load application code and data onto the mesh - void boot(const char* codeFilename, const char* dataFilename); + void boot(const char* codeFilename, const char* dataFilename, + bool start=true); // Trigger to start application execution void go(); From 2506a6e673c2025ddb20e4b31aa93bbf29e53335 Mon Sep 17 00:00:00 2001 From: Mark Vousden Date: Fri, 27 Aug 2021 12:09:07 +0100 Subject: [PATCH 2/3] HostLink::boot delegates loading responsibilities to HostLink::loadAll. --- hostlink/HostLink.cpp | 14 +++++++------- hostlink/HostLink.h | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hostlink/HostLink.cpp b/hostlink/HostLink.cpp index 8d241dc3..86e37115 100644 --- a/hostlink/HostLink.cpp +++ b/hostlink/HostLink.cpp @@ -402,8 +402,7 @@ bool HostLink::canRecv() } // Load application code and data onto the mesh -void HostLink::boot(const char* codeFilename, const char* dataFilename, - bool start) +void HostLink::loadAll(const char* codeFilename, const char* dataFilename) { MemFileReader code(codeFilename); MemFileReader data(dataFilename); @@ -470,12 +469,13 @@ void HostLink::boot(const char* codeFilename, const char* dataFilename, } addrReg = addr + 4; } +} - // Step 3: start cores - // ------------------- - - // Send start command, if desired - if (start) startAll(); +// Load application code and data onto the mesh, and start the cores +void HostLink::boot(const char* codeFilename, const char* dataFilename) +{ + loadAll(codeFilename, dataFilename); + start(); } // Trigger to start application execution diff --git a/hostlink/HostLink.h b/hostlink/HostLink.h index d75f86ea..9f5548d8 100644 --- a/hostlink/HostLink.h +++ b/hostlink/HostLink.h @@ -133,8 +133,10 @@ class HostLink { // (Only thread 0 on each core is active when the boot loader is running) // Load application code and data onto the mesh - void boot(const char* codeFilename, const char* dataFilename, - bool start=true); + void loadAll(const char* codeFilename, const char* dataFilename); + + // ... and start + void boot(const char* codeFilename, const char* dataFilename); // Trigger to start application execution void go(); From dc400c7e28b12cd6611f9ca0b56fd3eb152a80b8 Mon Sep 17 00:00:00 2001 From: Mark Vousden Date: Fri, 27 Aug 2021 18:53:43 +0100 Subject: [PATCH 3/3] start -> startAll (what is wrong with me...) --- hostlink/HostLink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hostlink/HostLink.cpp b/hostlink/HostLink.cpp index 86e37115..2e31c284 100644 --- a/hostlink/HostLink.cpp +++ b/hostlink/HostLink.cpp @@ -475,7 +475,7 @@ void HostLink::loadAll(const char* codeFilename, const char* dataFilename) void HostLink::boot(const char* codeFilename, const char* dataFilename) { loadAll(codeFilename, dataFilename); - start(); + startAll(); } // Trigger to start application execution