-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This gets it inline with the other hubs, making development easier. It does not have any pbsys implementation for stdio, but it launches into the REPL and uses stdio as defined in mphalport. This allows it to be used with mpremote for the time being.
- Loading branch information
1 parent
e24e126
commit ad111f3
Showing
6 changed files
with
52 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,2 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2022 The Pybricks Authors | ||
|
||
#include "ev3api.h" | ||
#include "app.h" | ||
|
||
#include <pbsys/main.h> | ||
|
||
// For now, this file is the main entry point from EV3RT. Eventually, this | ||
// file can be dropped and main_task() can be mapped to main() in pbsys/main. | ||
// For now it enters the MicroPython REPL directly for convenient debugging. | ||
|
||
static char heap[1024 * 256]; | ||
|
||
void main_task(intptr_t unused) { | ||
|
||
// Show the Pybricks logo on the screen so we know that something is | ||
// running. This should be replaced by an appropriate driver in pbio and | ||
// called from the system hmi interface in pbsys. | ||
memfile_t memfile; | ||
image_t image; | ||
if (ev3_memfile_load("/pybricks.bmp", &memfile) == E_OK && | ||
ev3_image_load(&memfile, &image) == E_OK) { | ||
ev3_lcd_draw_image(&image, 0, 0); | ||
} | ||
|
||
while (true) { | ||
pbsys_main_program_t program = { | ||
.id = PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, | ||
.code_start = heap, | ||
.code_end = heap, | ||
.user_ram_start = heap, | ||
.user_ram_end = heap + sizeof(heap), | ||
}; | ||
pbsys_main_run_program(&program); | ||
} | ||
} | ||
// Unused, but required for EV3RT build system. | ||
// The main Pybricks entry point is in pbio/platform/ev3rt/platform.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2022 The Pybricks Authors | ||
// Copyright (c) 2024 The Pybricks Authors | ||
|
||
// This file is unused, but required for the common make file. | ||
#include "ev3api.h" | ||
#include "app.h" | ||
|
||
#include <pbsys/main.h> | ||
|
||
/** | ||
* Any device specific initialization that isn't already done by EV3RT can | ||
* be done here. This follows the pattern of the embedded hubs where there is | ||
* a bit more to do. | ||
*/ | ||
static void SystemInit(void) { | ||
// Show the Pybricks logo on the screen so we know that something is | ||
// running. This should be replaced by an appropriate driver in pbio and | ||
// called from the system hmi interface in pbsys. | ||
memfile_t memfile; | ||
image_t image; | ||
if (ev3_memfile_load("/pybricks.bmp", &memfile) == E_OK && | ||
ev3_image_load(&memfile, &image) == E_OK) { | ||
ev3_lcd_draw_image(&image, 0, 0); | ||
} | ||
} | ||
|
||
/** | ||
* This is the main user task launched by EV3RT. It initializes the system | ||
* and then runs to the main pbsys function. This is similar to how these two | ||
* subsequent calls are normally made from startup.s on the embedded hubs. | ||
*/ | ||
void main_task(intptr_t unused) { | ||
SystemInit(); | ||
extern int main(int argc, char **argv); | ||
main(0, NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters