Page 3 of 4
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:02 pm
by Abhishek
Hello,
I was thinking about it sir. But it'd be time before I could put it in code.
@Badger, Yeah, even I was thinking of the microchip library And I've seen it being used on an STM32 - a blatant violation of the licensing. The ST lib is usable but microchip's better. I'll study their lib and see.
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:05 pm
by Badger
Giovanni wrote:I need to deploy another idea in this thread. The library is probably going to be stack-intensive. You should consider to implement it as a GUI-thread serving messages from the clients much like the FatFs wrapper thread created by Mabl:
viewtopic.php?f=8&t=466
That would be a good way of handling it. By the way, what is the status of the simulator? that would be an ideal platform to use for developing the GUI. I tried to compile on Ubuntu 12.04 64bit and got:
Code: Select all
tom@Z77A-GD65:~/projects/rc/src/chibios/demos/Posix-GCC$ make
gcc -c -ggdb -O2 -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm -DSIMULATOR -DSHELL_USE_IPRINTF=FALSE -Wa,-alms=../../os/ports/GCC/SIMIA32/chcore.lst -MD -MP -MF .dep/chcore.o.d -I . -I../../os/ports/GCC/SIMIA32 -I../../os/kernel/include -I../../test -I../../os/hal/include -I../../os/hal/platforms/Posix -I../../boards/simulator -I../../os/various ../../os/ports/GCC/SIMIA32/chcore.c -o ../../os/ports/GCC/SIMIA32/chcore.o
In file included from ../../os/kernel/include/ch.h:106:0,
from ../../os/ports/GCC/SIMIA32/chcore.c:28:
../../os/ports/GCC/SIMIA32/chcore.h:232:3: warning: ‘fastcall’ attribute ignored [-Wattributes]
../../os/ports/GCC/SIMIA32/chcore.h:233:3: warning: ‘fastcall’ attribute ignored [-Wattributes]
../../os/ports/GCC/SIMIA32/chcore.h:235:60: warning: ‘cdecl’ attribute ignored [-Wattributes]
../../os/ports/GCC/SIMIA32/chcore.c:68:1: warning: ‘fastcall’ attribute ignored [-Wattributes]
../../os/ports/GCC/SIMIA32/chcore.c:79:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
../../os/ports/GCC/SIMIA32/chcore.c: Assembler messages:
../../os/ports/GCC/SIMIA32/chcore.c:41: Error: operand type mismatch for `push'
../../os/ports/GCC/SIMIA32/chcore.c:42: Error: operand type mismatch for `push'
../../os/ports/GCC/SIMIA32/chcore.c:43: Error: operand type mismatch for `push'
../../os/ports/GCC/SIMIA32/chcore.c:44: Error: operand type mismatch for `push'
../../os/ports/GCC/SIMIA32/chcore.c:47: Error: operand type mismatch for `pop'
../../os/ports/GCC/SIMIA32/chcore.c:48: Error: operand type mismatch for `pop'
../../os/ports/GCC/SIMIA32/chcore.c:49: Error: operand type mismatch for `pop'
../../os/ports/GCC/SIMIA32/chcore.c:50: Error: operand type mismatch for `pop'
make: *** [../../os/ports/GCC/SIMIA32/chcore.o] Error 1
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:11 pm
by Badger
Ok it appears those problems are caused because the 64bit push instruction is different. If I force the compile to be 32 bit I get further:
Code: Select all
# Generate dependency information
CPFLAGS += -MD -m32 -MP -MF .dep/$(@F).d
error:
Code: Select all
tom@Z77A-GD65:~/projects/rc/src/chibios/demos/Posix-GCC$ make
gcc -c -ggdb -O2 -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm -DSIMULATOR -DSHELL_USE_IPRINTF=FALSE -Wa,-alms=main.lst -MD -m32 -MP -MF .dep/main.o.d -I . -I../../os/ports/GCC/SIMIA32 -I../../os/kernel/include -I../../test -I../../os/hal/include -I../../os/hal/platforms/Posix -I../../boards/simulator -I../../os/various main.c -o main.o
main.c: In function ‘cmd_mem’:
main.c:44:5: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:48:3: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:49:3: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:50:3: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c: In function ‘cmd_threads’:
main.c:59:5: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:62:3: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:68:13: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c: In function ‘cmd_test’:
main.c:78:5: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c:84:5: warning: passing argument 1 of ‘chprintf’ from incompatible pointer type [enabled by default]
../../os/various/chprintf.h:42:8: note: expected ‘struct BaseSequentialStream *’ but argument is of type ‘struct BaseChannel *’
main.c: At top level:
main.c:91:3: warning: initialization from incompatible pointer type [enabled by default]
main.c:91:3: warning: (near initialization for ‘commands[0].sc_function’) [enabled by default]
main.c:92:3: warning: initialization from incompatible pointer type [enabled by default]
main.c:92:3: warning: (near initialization for ‘commands[1].sc_function’) [enabled by default]
main.c:93:3: warning: initialization from incompatible pointer type [enabled by default]
main.c:93:3: warning: (near initialization for ‘commands[2].sc_function’) [enabled by default]
main.c:98:3: warning: initialization from incompatible pointer type [enabled by default]
main.c:98:3: warning: (near initialization for ‘shell_cfg1.sc_channel’) [enabled by default]
main.c:103:3: warning: initialization from incompatible pointer type [enabled by default]
main.c:103:3: warning: (near initialization for ‘shell_cfg2.sc_channel’) [enabled by default]
main.c: In function ‘sd1_handler’:
main.c:158:3: error: unknown type name ‘ioflags_t’
main.c:161:3: warning: implicit declaration of function ‘chIOGetAndClearFlags’ [-Wimplicit-function-declaration]
main.c:162:16: error: ‘IO_CONNECTED’ undeclared (first use in this function)
main.c:162:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:166:15: error: ‘IO_DISCONNECTED’ undeclared (first use in this function)
main.c: In function ‘sd2_handler’:
main.c:180:3: error: unknown type name ‘ioflags_t’
main.c:184:16: error: ‘IO_CONNECTED’ undeclared (first use in this function)
main.c:188:15: error: ‘IO_DISCONNECTED’ undeclared (first use in this function)
main.c: In function ‘main’:
main.c:242:3: warning: implicit declaration of function ‘chIOGetEventSource’ [-Wimplicit-function-declaration]
main.c:242:3: warning: passing argument 1 of ‘chEvtRegisterMask’ makes pointer from integer without a cast [enabled by default]
../../os/kernel/include/chevents.h:163:8: note: expected ‘struct EventSource *’ but argument is of type ‘int’
main.c:245:3: warning: passing argument 1 of ‘chEvtRegisterMask’ makes pointer from integer without a cast [enabled by default]
../../os/kernel/include/chevents.h:163:8: note: expected ‘struct EventSource *’ but argument is of type ‘int’
main.c:256:3: warning: passing argument 1 of ‘chEvtUnregister’ makes pointer from integer without a cast [enabled by default]
../../os/kernel/include/chevents.h:166:8: note: expected ‘struct EventSource *’ but argument is of type ‘int’
main.c:257:3: warning: passing argument 1 of ‘chEvtUnregister’ makes pointer from integer without a cast [enabled by default]
../../os/kernel/include/chevents.h:166:8: note: expected ‘struct EventSource *’ but argument is of type ‘int’
make: *** [main.o] Error 1
it looks like the demo is out of date?
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:14 pm
by Giovanni
Yes, it is because the recent changes, I will update it ASAP.
Giovanni
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:21 pm
by Badger
thanks, do you have a 32bit machine you could test it on? we could see if it is safe to leave -m32 in for all architectures. I can test on 64bit Mac OS X as well as ubuntu.
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:22 pm
by Tectu
Giovanni wrote:I need to deploy another idea in this thread. The library is probably going to be stack-intensive. You should consider to implement it as a GUI-thread serving messages from the clients much like the FatFs wrapper thread created by Mabl:
viewtopic.php?f=8&t=466Giovanni
I see what problem you mean, Giovanni, but I don't understand the second part of your post. What exactly is the GUI thread supposed to do and how does this keep the memory usage low?
~ Tectu
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:23 pm
by Giovanni
Yes, I have Ubuntu 32 bits on my notebook.
Giovanni
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:26 pm
by Giovanni
Tectu wrote:I see what problem you mean, Giovanni, but I don't understand the second part of your post. What exactly is the GUI thread supposed to do and how does this keep the memory usage low?
There would be a dedicated thread doing all the drawing on the LCD, other threads would sent it encoded messages in order to "request" drawing or other services.
The server thread would be the only one touching the LCD and its code. The advantages are:
- Reduced stack usage.
- Intrinsically thread safe code.
- Modularity.
It is not even a novel concept, many graphic frameworks are "servers", see X11.
Giovanni
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:27 pm
by Badger
Tectu wrote:I see what problem you mean, Giovanni, but I don't understand the second part of your post. What exactly is the GUI thread supposed to do and how does this keep the memory usage low?
The benefit is that only one thread needs a large stack size, so that you can have lots of threads interacting with the GUI which don't need a large stack. Instead interacting with the GUI directly, the GUI functions will wrap a message and pass it to the GUI thread which does all the interaction.
Re: GUI abstraction
Posted: Tue Jul 10, 2012 6:27 pm
by Badger
I'm having a go at implementing a simulator but I'm having problems because the touch screen code relies on macros being defined (I have the same problems on my test board, as I do not yet use the touch screen). Basically, even with no TOUCHPAD_USE_ set, the code still tries to call TP_ macros. So that it something that needs to be fixed.