lvgl / lv_port_pc_vscode

MIT License
217 stars 136 forks source link

Trying to use VSCode with existing project #15

Closed elgerg closed 2 years ago

elgerg commented 2 years ago

Hi,

Ive been using Eclipse to use the simulator for a while with no issues on v7.

I want to use v8 and the simulator on vscode.

I cloned the project and ran the demo no problem. However once I linked my app folder to:

lv_sim_vscode_sdl/App

Edited the main.c file to look like

include "lvgl/lvgl.h"

//#include "lvgl/examples/lv_examples.h" //#include "lv_examples/lv_demo.h"

include "lv_drivers/display/monitor.h"

include "lv_drivers/indev/mouse.h"

include "lv_drivers/indev/keyboard.h"

include "lv_drivers/indev/mousewheel.h"

include "App/App.h"

and // lv_example_flex_3(); // lv_example_label_1();

lv_loadTabs();

//lv_demo_widgets(); // lv_demo_keypad_encoder(); // lv_demo_benchmark(); // lv_demo_stress(); // lv_demo_music();

I get the following errors on buiild/run: ./App/Tasks/Tasks.h:9:16: error: unknown type name ‘lv_task_t’; did you mean ‘lv_bar_t’? 9 | void tsk_temps(lv_task_t task); | ^~~~~ | lv_bar_t In file included from main/src/main.c:23: ./App/App.h:164:1: error: unknown type name ‘lv_task_t’; did you mean ‘lv_bar_t’? 164 | lv_task_t TempsTask; | ^~~~~ | lv_bar_t make: *** [Makefile:47: build/obj/main/src/main.o] Error 1 The terminal process "bash '-c', 'make'" terminated with exit code: 2.

Is this because lv_task_t doesnt exist in v8 or do I have another issue? Am I going about it in the right way or is there a better way of linking in my app?

Thanks in advance Alex

elgerg commented 2 years ago

ok, it looks like tasks have been replaced with timers? Ive managed to get past that problem.

Now the issue I a getting is that my entry point is not defined: /usr/bin/ld: ./build/obj/main/src/main.o: in function main': /home/pi/Documents/lv_sim_vscode_sdl/main/src/main.c:99: undefined reference tolv_loadTabs' collect2: error: ld returned 1 exit status make: *** [Makefile:51: default] Error 1 The terminal process "bash '-c', 'make'" terminated with exit code: 2.

It looks like my "App" folder is not being built. I thought amending the make file like so would fix this: INC := -I./ui/simulator/inc/ -I./ -I./lvgl/ -I./App/

What do I need to alter to make it build the App subfolder?

Thanks Alex

elgerg commented 2 years ago

I did think it might be to do with this:

shell find $(SRC_DIR) -type f -name '.c' -not -path '/.*'

I assume "-type f" is folder? I have simlinked the App folder to this folder as it's used in multiple projects).

Any advice would be appreciated. Alex

microwavesafe commented 2 years ago

-type f is file (where -type d is directory). This should find all .c files in the $SRC_DIR which as default is set to "./". You can run this as a command in a shell to see which files it finds. Change directory to where the makefile is placed and run this.

find ./ -type f -name '*.c' -not -path '*/\.*'

And see what it gives you. I believe the problem is that you have symlinked the folder, you could try using the -L option of find and see if that helps?

elgerg commented 2 years ago

Ok, its deffo to so with the Symlnked folder.

If i remove the link and copy the folder in i get the expected errors due to the upgrade from 7.5 to 8.

Any ideas how to get the find to traverse the links?

Thanks Alex

microwavesafe commented 2 years ago

As mentioned above try adding -L to the find command. This should get it to traverse symlinks. Try running this from the command line.

find -L ./ -type f -name '*.c' -not -path '*/\.*'

If it works add the -L to the makefile command

elgerg commented 2 years ago

I did try:

SRCS := $(shell find $(SRC_DIR) -type f,l -L -name '.c' -not -path '/.*')

But got:

find: unknown predicate -L' cc -o ./build/bin/demo -lSDL2 -lm /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/Scrt1.o: in function_start': (.text+0x18): undefined reference to main' /usr/bin/ld: (.text+0x1c): undefined reference tomain' collect2: error: ld returned 1 exit status make: *** [Makefile:51: default] Error 1

elgerg commented 2 years ago

Running:

find $(./) -L -type f,l -name '*.c'

on the command line did work, just not in make.

elgerg commented 2 years ago

ok, that worked:

SRCS := $(shell find -L $(SRC_DIR) -type f,l -name '.c' -not -path '/.*')

seems it required the -L to be in the right place..

microwavesafe commented 2 years ago

I'm glad it worked, can I close this issue?

elgerg commented 2 years ago

Sure.