-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking main executable with lvgl(?) failed on Mac (M1) #127
Comments
I just tried to compile with You could try to compile https://github.com/lvgl/lv_port_pc_eclipse/tree/dev-7.0 as this is the simulator InfiniSim is based on. Be sure to use the |
v7.0 of that repo doesn't even compile right from the very beginning, something about I decided to add
Anyways, I noticed in the verbose output that all the For in the meantime I've scripted around the build process to compile a small dummy file for all those lvgl-related files (to pass the initial compiler check) and include them in |
Alright so I looked into the differences between the latest version of lv_port_pc_eclipse and what InfiniSim uses. In the main loop it simply calls So anyways, time to compile the simulator with debug information (
The truncated parts are just calls to Updating the simulator to work with the latest versions of its base components is probably still the best solution, but I wanted to get this working on a much shorter term. Here's a full diff against the current version of InfiniSim's repo (including submodules, yeah this is very dirty): Submodule InfiniTime contains modified content
diff --git a/InfiniTime/src/components/datetime/DateTimeController.cpp b/InfiniTime/src/components/datetime/DateTimeController.cpp
index 9e9fb6e4..3cd761e2 100644
--- a/InfiniTime/src/components/datetime/DateTimeController.cpp
+++ b/InfiniTime/src/components/datetime/DateTimeController.cpp
@@ -69,7 +69,7 @@ void DateTime::UpdateTime(uint32_t systickCounter) {
currentDateTime += std::chrono::seconds(correctedDelta);
uptime += std::chrono::seconds(correctedDelta);
- std::time_t currentTime = std::chrono::system_clock::to_time_t(currentDateTime);
+ std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::time_point_cast<std::chrono::system_clock::duration>(currentDateTime));
localTime = *std::localtime(¤tTime);
auto minute = Minutes();
Submodule lv_drivers contains modified content
diff --git a/lv_drivers/display/monitor.c b/lv_drivers/display/monitor.c
index 53534f4..84e1ef1 100644
--- a/lv_drivers/display/monitor.c
+++ b/lv_drivers/display/monitor.c
@@ -67,6 +67,7 @@ static void monitor_sdl_refr(lv_task_t * t);
/***********************
* GLOBAL PROTOTYPES
***********************/
+void sdl_event_handler_mainthread(void);
/**********************
* STATIC VARIABLES
@@ -95,7 +96,6 @@ static volatile bool sdl_quit_qry = false;
void monitor_init(void)
{
monitor_sdl_init();
- lv_task_create(sdl_event_handler, 10, LV_TASK_PRIO_HIGH, NULL);
}
/**
@@ -214,6 +214,14 @@ void monitor_flush2(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
}
#endif
+/**
+ * Meant for calling sdl_event_handler() from other threads (can only be used from the main thread though)
+ */
+void sdl_event_handler_mainthread(void)
+{
+ sdl_event_handler(NULL);
+}
+
/**********************
* STATIC FUNCTIONS
**********************/
@@ -226,7 +234,8 @@ void monitor_flush2(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
static void sdl_event_handler(lv_task_t * t)
{
- (void)t;
+ if(t)
+ (void)t;
/*Refresh handling*/
SDL_Event event;
diff --git a/main.cpp b/main.cpp
index 8070db7..59c7cb4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -93,6 +93,7 @@ typedef struct {
#endif
}monitor_t;
extern monitor_t monitor;
+extern void sdl_event_handler_mainthread(void);
}
void saveScreenshot()
@@ -1030,11 +1031,17 @@ int main(int argc, char **argv)
// initialize the core of our Simulator
Framework fw(fw_status_window_visible, 240,240);
+ //uint8_t sdl_tick = 0;
while(1) {
fw.handle_keys(); // key event polling
fw.handle_touch_and_button();
fw.refresh();
- usleep(LV_DISP_DEF_REFR_PERIOD * 1000);
+ usleep(1000);
+ //sdl_tick++;
+ //if(sdl_tick >= 10) {
+ sdl_event_handler_mainthread();
+ // sdl_tick = 0;
+ //}
}
return 0; So basically, remove the separate thread that was originally causing the crash and run its code directly on the main thread. The UI now actually responds to everything. I originally added the Here's a screenshot showing a different OS name, I figured that was the easiest thing to edit for verification. If we were to do a quick comparison against lv_port_pc_eclipse, then we "should" call Now, there are a few lingering minor issues but at least I can simulate the firmware.
As you can see at the very bottom, the cause is the if(sdl_quit_qry) {
monitor_sdl_clean_up();
exit(0);
} It looks like a use-after-free somehow (
My guess is something is (now) causing it to update the display multiple times simultaneously with something else. This may have something to do with restarting the program too fast, or even the fact that I'm running it through |
Awesome work! Please open a PR to update the simulator files/submodules as you've mentioned. Then it is easier for me to check on the Linux side if everything still works, and you'll get the attribution for the fix ;) |
Some changes are in third-party libs tho (like https://github.com/lvgl/lv_drivers), how would we go about that? :> Afaik you can't patch them from the parent project. Also I'll be going away for a week, leaving very early tomorrow. So whatever needs to be done, will happen after a week. =] |
I've been trying to get the simulator working on my Mac (M1), but it keeps failing when linking the main
infinisim
executable to what I assume is thelvgl
library:In the readme it says:
I verified that the submodule is indeed checked out. Also, I can build the main firmware itself without problems. For the simulator's dependencies I just ran
npm install
from the repo root, since there's apackage.json
. For building I simply used the given instructions:The text was updated successfully, but these errors were encountered: