-
Notifications
You must be signed in to change notification settings - Fork 493
Segmentation fault on openwrt for ili9341 based TFT #234
Comments
Is this what you get in the kernel log?
The only reason I can see for |
Hi notro, This is weird because the size of fbtft_par is 448. this is right after the framebuffer_alloc() call. This is dmesg output: [ 237.360000] fbtft_device: SPI devices registered: [ 237.360000] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!8 sizeof(struct fbtft_par):448 I'll keep digging later ... I'm sure there is an obvious thing that at the moment is not so obvious :) |
It seems that there is something wrong with my buildtree. So in fbtft-coare.c the size of fb_info is 652 and in fbsysfs.c the size of fb_info is 596, a huge difference. Both files include <linux/fb.h> but it seems that it doesn't point to the same .h file. Regards, |
I don't know much about the build details, but the |
Hi Notro, I contacted that guy but he can't help me. I think that fb and fbtft use the same fb.h file but the modules are compiled with different defines ("-D"). struct fb_info {
atomic_t count;
int node;
int flags;
struct mutex lock; /* Lock for open/release/ioctl funcs */
struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */
struct fb_var_screeninfo var; /* Current var */
struct fb_fix_screeninfo fix; /* Current fix */
struct fb_monspecs monspecs; /* Current Monitor specs */
struct work_struct queue; /* Framebuffer event queue */
struct fb_pixmap pixmap; /* Image hardware mapper */
struct fb_pixmap sprite; /* Cursor hardware mapper */
struct fb_cmap cmap; /* Current cmap */
struct list_head modelist; /* mode list */
struct fb_videomode *mode; /* current mode */
**#ifdef CONFIG_FB_BACKLIGHT**
/* assigned backlight device */
/* set before framebuffer registration,
remove after unregister */
struct backlight_device *bl_dev;
/* Backlight level curve */
struct mutex bl_curve_mutex;
u8 bl_curve[FB_BACKLIGHT_LEVELS];
**#endif**
**#ifdef CONFIG_FB_DEFERRED_IO**
struct delayed_work deferred_work;
struct fb_deferred_io *fbdefio;
**#endif** Files from fbtft are compiled with these defines (-DCC_HAVE_ASM_GOTO -DCONFIG_FB_SYS_FILLRECT=1 -DCONFIG_FB_SYS_COPYAREA=1 -DCONFIG_FB_SYS_IMAGEBLIT=1 -DCONFIG_FB_SYS_FOPS=1 -DCONFIG_FB_TFT_FBTFT_DEVICE=1 -DCONFIG_FB_TFT=1 -DCONFIG_FB_TFT_ILI9341=1 -DCONFIG_FB_DEFERRED_IO=1): Now fbsysfs.c from fb module is not compiled with any of these flags which will cause the compiler to use a smaller fb_info structure to be used inside fb core. I'll try to fix this but in case you already know how to fix this please leave a comment. |
Why don't you just build a new kernel instead of trying to make this hack work? FBTFT relies on CONFIG_FB being set, and when CONFIG_FB_TFT is set, these are selected as well: https://github.com/notro/fbtft/blob/master/Kconfig#L1 If CONFIG_FB=y in your running kernel, then you can't change the fb_info structure, it's already set. |
This is the first time I had to deal with linux kernel and i didn't get all the tricks yet :) |
Ok, I thought you were trying to patch this on to a already built kernel. Or you can copy fbtft into the kernel tree: https://github.com/notro/fbtft/blob/master/README |
Hi Notro, I know this is no longer an issue regarding fbtft module but I'm still struggling to make linux framebuffer to compile with the right flags. I enabled FB_AUO_K190X from "make kernel_menuconfig" and I checked my .config file from build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.14.28 and I found this : It seems that deferred IO is defined but it's not used at compile time. For example I enabled FB_AUO_K190X which depends on FB_DEFERRED_IO and after compilation I looked in .auo_k190x.o.cmd and there is no trace of -DCONFIG_FB_DEFERRED_IO. All other .c files of linux framebuffer are not compiled with the right flags. Only fbtft .c files are compiled with -DCONFIG_FB_DEFERRED_IO. Any idea why this is happening ? |
I don't know much about kbuild, but if CONFIG_FB_DEFERRED_IO is set in .config, then the kernel will have support for it. You can verify that it has been built by checking that drivers/video/fbdev/core/fb_defio.o exists. Why not put the drivers in-tree as explained by the README and your out-of-tree building problems go away? |
Good thing you mentioned about kbuild. I looked it up and it seems that frame buffer files don't need any extra define flags like -DCONFIG_FB_DEFERRED_IO=1 because all defines are made in include/generated/autoconf.h which is included by all files (indirectly). If I use CS=0 all is ok the problem is that GPIO 0 is assigned for something else. |
Hi,
I'm using this repo to make fbtft to work on openwrt: https://github.com/GBert/openwrt-misc/tree/master/fbtft
All compiles ok and I execute these commands:
insmod fb_defio
insmod fb
insmod fbtft
insmod fb_ili9341
insmod fbtft_device name=tm022hdh26 busnum=32766 gpios=reset:11,led:12,dc:13 rotate=270
When I load fbtft_device I get a segmentation fault that I could trace to fbtft-core.c in fbtft_framebuffer_alloc() function at line "par->info = info;"
It seems that par was not allocated when the call to framebuffer_alloc() was made. Do you know what the problem may be ?
Thank you,
Bogdan
The text was updated successfully, but these errors were encountered: