Jump to content

Compiling library on Raspberry Pi


kkolehma

Recommended Posts

I started to get test the library by going thru example from https://wiki.ugfx.io/index.php/Raspberry_Pi

but I ran into issue compiling the example: 

.
C Compiler Options....
gcc -c -ggdb -O0 -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm -ffunction-sections -fdata-sections -fno-common -flto -MMD -MP -MF .build/dep/fakefile.o.d -I. -I../resources/ugfx -I../resources/ugfx/3rdparty/tinygl-0.4-ugfx/include -I../resources/ugfx/boards/base/Linux-Framebuffer -I../resources/ugfx/drivers/gdisp/framebuffer -I../resources/ugfx/demos/modules/gdisp/basics -DGFX_USE_OS_LINUX=GFXON -DGFX_USE_OS_LINUX=GFXON fakefile.c -o .build/obj/fakefile.o
.
Linker Options........
gcc -pthread -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -Wl,--gc-sections -lrt .build/obj/fakefile.o -o .build/bx-gui
.
Compiling ../resources/ugfx/src/gfx.c
gcc: error: unrecognized command line option ‘-mfpu=vfp’; did you mean ‘-mcpu=’?
gcc: error: unrecognized command line option ‘-mfloat-abi=hard’
make: *** [../resources/ugfx/tools/gmake_scripts/compiler_gcc.mk:254: .build/obj/GFXLIB/src/gfx.o] 

I am trying to compile this on Raspberry Pi 4 

Any quick suggestion or idea what could be wrong? Some compiler flag missing/wring, wrong compiler/linker or something else?

Link to comment
Share on other sites

Quick reply to myself. I changed the platform specific .mk file (ugfx/tools/gmake_scripts/cpu_raspberrypi.mk) to:

# This file is subject to the terms of the GFX License. If a copy of
# the license was not distributed with this file, you can obtain one at:
#
#             http://ugfx.io/license.html
#

#
# See readme.txt for the make API
#

# Requirements:
#
# NONE
#

#SRCFLAGS += -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
#LDFLAGS  += -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
SRCFLAGS += -mcpu=cortex-a72 -mtune=cortex-a72
LDFLAGS  += -mcpu=cortex-a72 -mtune=cortex-a72

It compiles, but example does not start and complains this: GDISP Framebuffer: Failed to set video mode

 

Link to comment
Share on other sites

Just clarification: I am using 7" RPi touchscreen connected with DSI bus. I got example running by commenting out USE_SET_MODE definition and nearly all checks at board_init in board_framebuffer.h. Result is not very pleasing though... graphics are not as they should be as per attached photo

IMG_4170.jpeg

Link to comment
Share on other sites

It looks like the "failed to set video mode" was correct. When you turn off USE_SET_MODE it assumes that the video mode has been set correctly before the ugfx application starts. This is obviously not true in your situation. I am surprised it was able to display anything at all.

Whilst I haven't had a look at the code recently, from memory it tries to auto-detect the correct mode by looking for a framebuffer mode that matches the pixel format.

Some questions here that might help you find the problem:

1. The original pi project was against an early pi hardware model. What model are you using?

2. What Linux variant are you using? Is it the same as the sample project? I suspect not given the differences in compiler flags. Your compiler obviously does not support the flags required by the original pi.

3. Check if the kernel you are using even has the Linux framebuffer compiled into it and what modes it supports. This is the most likely reason it is not working for you.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...