[OpenWrt-Devel] Wifi to 802.15.4 router project
I'm working on a Wifi to 802.15.4 router project. 802.15.4 runs IPv6 using 6lowpan/ROLL. The hardware and software are open source, main site is http://mc1322x.devl.org/. Most users are universities doing research into sensor networks. The router is currently under development. It is based on a lpc3130 CPU with a USB socket for wifi and a 802.15.4 radio. I already have basic OpenWRT ported and working on the development hardware. The router has an optional 3.5in touch LCD which lets you control and monitor the sensor network. The LCD has a 16b interface which is only supported in Cairo version 10+. So I'm trying to get Cairo 10.2 going. I attached the patches needed to bring it and its supporting libs up to the needed versions. Turn on Cairo support in menuconf, include a font, and giflib. I'm now able to run Cairo apps written in C without problem. I'm having trouble with the lua wrapper for Cairo - http://www.dynaset.org/dogusanh/luacairo. I attached the makefile I'm using to build it. luaCario comes with some examples that generate PNG file for output (no display needed). Some of these examples are seg faulting (cairo_test5.lua). I ran remote gdb and they die in sweeplist when sweeping some corrupted objects. The examples are small, 75 lines, so the problem has to be fairly basic. Can anyone give me some clues on how to debug this? Valgrind doesn't exist for ARM. Writing this has made me think to see if luaCairo is working on x86. I'll check that next. I can also Valgrind it there. -- Jon Smirl jonsm...@gmail.com version.diff Description: Binary data Makefile Description: Binary data ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
I have verified now that the luaCairo wrapper works without issue on x86. So this is something OpenWRT or ARM specific. -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
Minimal failing test program... local cs = cairo.ImageSurface(CAIRO.FORMAT_RGB24, 320, 240) local cr = cairo.Context(cs) cr:select_font_face("Sans", CAIRO.FONT_SLANT_NORMAL, CAIRO.FONT_WEIGHT_BOLD) cr:set_font_size(8) cr:show_text("Hs") cr:select_font_face("Sans", CAIRO.FONT_SLANT_NORMAL, CAIRO.FONT_WEIGHT_NORMAL) cr:text_path("u") Failure, the object is corrupted root@OpenWrt:~/examples# lua cairo_test4oo.lua lua: cairo-hash.c: 427: _cairo_hash_table_insert: Assertion `hash_table->iterating == 0' failed. Aborted -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
I've convinced myself that this memory corruption bug was introduce in Cairo 10.x and later, not the lua wrapper. This C program hits it too. #include #include #include #include #include #include #include typedef struct _cairo_linuxfb_device { int fb_fd; char *fb_data; long fb_screensize; struct fb_var_screeninfo fb_vinfo; struct fb_fix_screeninfo fb_finfo; } cairo_linuxfb_device_t; static void cairo_linuxfb_surface_destroy(void *device) { cairo_linuxfb_device_t *dev = (cairo_linuxfb_device_t *)device; if (dev == NULL) { return; } munmap(dev->fb_data, dev->fb_screensize); close(dev->fb_fd); free(dev); } cairo_surface_t *cairo_linuxfb_surface_create(const char *fb_name) { cairo_linuxfb_device_t *device; cairo_surface_t *surface; if (fb_name == NULL) { fb_name = "/dev/fb0"; } device = malloc(sizeof(*device)); // Open the file for reading and writing device->fb_fd = open(fb_name, O_RDWR); if (device->fb_fd == -1) { perror("Error: cannot open framebuffer device"); exit(1); } // Get variable screen information if (ioctl(device->fb_fd, FBIOGET_VSCREENINFO, &device->fb_vinfo) == -1) { perror("Error reading variable information"); exit(3); } // Figure out the size of the screen in bytes device->fb_screensize = device->fb_vinfo.xres * device->fb_vinfo.yres * device->fb_vinfo.bits_per_pixel / 8; // Map the device to memory device->fb_data = (char *)mmap(0, device->fb_screensize, PROT_READ | PROT_WRITE, MAP_SHARED, device->fb_fd, 0); if ((int)device->fb_data == -1) { perror("Error: failed to map framebuffer device to memory"); exit(4); } // Get fixed screen information if (ioctl(device->fb_fd, FBIOGET_FSCREENINFO, &device->fb_finfo) == -1) { perror("Error reading fixed information"); exit(2); } surface = cairo_image_surface_create_for_data(device->fb_data, CAIRO_FORMAT_RGB16_565, device->fb_vinfo.xres, device->fb_vinfo.yres, cairo_format_stride_for_width(CAIRO_FORMAT_RGB16_565, device->fb_vinfo.xres)); cairo_surface_set_user_data(surface, NULL, device, &cairo_linuxfb_surface_destroy); return surface; } int main (int argc, char *argv[]) { cairo_surface_t *surface; cairo_t *cr; surface = cairo_linuxfb_surface_create(NULL); cr = cairo_create(surface); cairo_set_source_rgb(cr, 1, 1, 1); cairo_paint(cr); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, 320/6); cairo_set_source_rgb(cr, 0, 0, 0); cairo_move_to(cr, 0, 240/4); cairo_show_text(cr, "Hello cairo!"); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr, 320/8); cairo_set_source_rgb(cr, 0.0, 0.0, 1.0); cairo_move_to(cr, 0, 3*240/4); cairo_text_path(cr, "Lua calling..."); cairo_destroy(cr); cairo_surface_destroy(surface); return 0; } -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
I finally found the bug. One of the glyphs in the 1.04 liberation font package has a bad index. That index causes the higher layers to corrupt a few bytes of memory when they cache it. Of course corrupting a few bytes of memory may, but not always, lead to a bunch of unrelated failures later. In this cause the bytes corrupted were in the new code I was adding to the system. Updating to the current release of liberation fonts fixes it. Index: font/liberation-fonts-ttf/Makefile === --- font/liberation-fonts-ttf/Makefile (revision 29747) +++ font/liberation-fonts-ttf/Makefile (working copy) @@ -6,14 +6,13 @@ # include $(TOPDIR)/rules.mk -PKG_NAME:=liberation-fonts +PKG_NAME:=liberation-fonts-ttf PKG_RELEASE:=1 -PKG_VERSION:=1.04 +PKG_VERSION:=1.07.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR=$(BUILD_DIR)/Xorg/$(_CATEGORY)/$(PKG_NAME)-$(PKG_VERSION)/ PKG_SOURCE_URL:=http://fedorahosted.org/releases/l/i/liberation-fonts/ -PKG_MD5SUM:=4846797ef0fc70b0cbaede2514677c58 include $(INCLUDE_DIR)/package.mk -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
On 2012-01-15 4:40 PM, jonsm...@gmail.com wrote: > I finally found the bug. One of the glyphs in the 1.04 liberation font > package has a bad index. That index causes the higher layers to > corrupt a few bytes of memory when they cache it. Of course corrupting > a few bytes of memory may, but not always, lead to a bunch of > unrelated failures later. In this cause the bytes corrupted were in > the new code I was adding to the system. Updating to the current > release of liberation fonts fixes it. > > Index: font/liberation-fonts-ttf/Makefile > === > --- font/liberation-fonts-ttf/Makefile(revision 29747) > +++ font/liberation-fonts-ttf/Makefile(working copy) > @@ -6,14 +6,13 @@ > # > include $(TOPDIR)/rules.mk > > -PKG_NAME:=liberation-fonts > +PKG_NAME:=liberation-fonts-ttf > PKG_RELEASE:=1 > -PKG_VERSION:=1.04 > +PKG_VERSION:=1.07.1 > > PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz > PKG_BUILD_DIR=$(BUILD_DIR)/Xorg/$(_CATEGORY)/$(PKG_NAME)-$(PKG_VERSION)/ > PKG_SOURCE_URL:=http://fedorahosted.org/releases/l/i/liberation-fonts/ > -PKG_MD5SUM:=4846797ef0fc70b0cbaede2514677c58 > > include $(INCLUDE_DIR)/package.mk Patch looks good, but please update the md5sum instead of removing it. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
Index: font/liberation-fonts-ttf/Makefile === --- font/liberation-fonts-ttf/Makefile (revision 29747) +++ font/liberation-fonts-ttf/Makefile (working copy) @@ -6,14 +6,14 @@ # include $(TOPDIR)/rules.mk -PKG_NAME:=liberation-fonts +PKG_NAME:=liberation-fonts-ttf PKG_RELEASE:=1 -PKG_VERSION:=1.04 +PKG_VERSION:=1.07.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR=$(BUILD_DIR)/Xorg/$(_CATEGORY)/$(PKG_NAME)-$(PKG_VERSION)/ PKG_SOURCE_URL:=http://fedorahosted.org/releases/l/i/liberation-fonts/ -PKG_MD5SUM:=4846797ef0fc70b0cbaede2514677c58 +PKG_MD5SUM:=0be45d54cc5e1c2e3102e32b8c190346 include $(INCLUDE_DIR)/package.mk -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
After more testing updating the font file didn't fix the corruption, it just moved it to a different spot which makes a different test program fail. Now I really don't know what is messing up memory but it is definitely related to fonts. -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
First run builds the fontconfig cache. Second run uses the cache and seg faults. I delete it, and program runs again. The gdb data from the segfault is useless since the seg fault is caused by application data getting corrupted by some other source I have not been able to track down. I have tried varying the releases of Cairo, FontConfig and Freetype over multiple versions. Every combination I have tried fails. --- root@OpenWrt:~/examples# lua cairo_test4oo.lua root@OpenWrt:~/examples# lua cairo_test4oo.lua Segmentation fault root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache root@OpenWrt:~/examples# lua cairo_test4oo.lua root@OpenWrt:~/examples# - root@OpenWrt:~/examples# cairo jds-1 jds-2 jds-3 jds-4 jds-5 jds-6 jds-7 jds-8 jds-9 jds-10 jds-11 jds-12 jds-13 jds-14 root@OpenWrt:~/examples# cairo jds-1 jds-2 jds-3 jds-4 jds-5 jds-6 jds-7 jds-8 jds-9 jds-10 jds-11 jds-12 jds-13 Segmentation fault root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache root@OpenWrt:~/examples# cairo jds-1 jds-2 jds-3 jds-4 jds-5 jds-6 jds-7 jds-8 jds-9 jds-10 jds-11 jds-12 jds-13 jds-14 root@OpenWrt:~/examples# -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
On Sun, Jan 15, 2012 at 11:39 PM, jonsm...@gmail.com wrote: > First run builds the fontconfig cache. > Second run uses the cache and seg faults. > I delete it, and program runs again. > > The gdb data from the segfault is useless since the seg fault is > caused by application data getting corrupted by some other source I > have not been able to track down. > > I have tried varying the releases of Cairo, FontConfig and Freetype > over multiple versions. Every combination I have tried fails. > > --- > root@OpenWrt:~/examples# lua cairo_test4oo.lua > root@OpenWrt:~/examples# lua cairo_test4oo.lua > valgrind lua cairo test4oo.lua?? :) > Segmentation fault > atleast you will get some inputs by running valgrind . > root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache > root@OpenWrt:~/examples# lua cairo_test4oo.lua > root@OpenWrt:~/examples# > - > root@OpenWrt:~/examples# cairo > jds-1 > jds-2 > jds-3 > jds-4 > jds-5 > jds-6 > jds-7 > jds-8 > jds-9 > jds-10 > jds-11 > jds-12 > jds-13 > jds-14 > root@OpenWrt:~/examples# cairo > jds-1 > jds-2 > jds-3 > jds-4 > jds-5 > jds-6 > jds-7 > jds-8 > jds-9 > jds-10 > jds-11 > jds-12 > jds-13 > Segmentation fault > root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache > root@OpenWrt:~/examples# cairo > jds-1 > jds-2 > jds-3 > jds-4 > jds-5 > jds-6 > jds-7 > jds-8 > jds-9 > jds-10 > jds-11 > jds-12 > jds-13 > jds-14 > root@OpenWrt:~/examples# > > > -- > Jon Smirl > jonsm...@gmail.com > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel > devendra. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
On Mon, Jan 16, 2012 at 12:11 AM, devendra.aaru wrote: > > > On Sun, Jan 15, 2012 at 11:39 PM, jonsm...@gmail.com > wrote: > >> First run builds the fontconfig cache. >> Second run uses the cache and seg faults. >> I delete it, and program runs again. >> >> The gdb data from the segfault is useless since the seg fault is >> caused by application data getting corrupted by some other source I >> have not been able to track down. >> >> I have tried varying the releases of Cairo, FontConfig and Freetype >> over multiple versions. Every combination I have tried fails. >> >> --- >> root@OpenWrt:~/examples# lua cairo_test4oo.lua >> root@OpenWrt:~/examples# lua cairo_test4oo.lua >> > valgrind lua cairo test4oo.lua?? :) > >> Segmentation fault >> > atleast you will get some inputs by running valgrind . > >> root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache >> root@OpenWrt:~/examples# lua cairo_test4oo.lua >> root@OpenWrt:~/examples# >> - >> root@OpenWrt:~/examples# cairo >> jds-1 >> jds-2 >> jds-3 >> jds-4 >> jds-5 >> jds-6 >> jds-7 >> jds-8 >> jds-9 >> jds-10 >> jds-11 >> jds-12 >> jds-13 >> jds-14 >> root@OpenWrt:~/examples# cairo >> jds-1 >> jds-2 >> jds-3 >> jds-4 >> jds-5 >> jds-6 >> jds-7 >> jds-8 >> jds-9 >> jds-10 >> jds-11 >> jds-12 >> jds-13 >> Segmentation fault >> root@OpenWrt:~/examples# rm -rf /usr/share/fontconfig/cache >> root@OpenWrt:~/examples# cairo >> jds-1 >> jds-2 >> jds-3 >> jds-4 >> jds-5 >> jds-6 >> jds-7 >> jds-8 >> jds-9 >> jds-10 >> jds-11 >> jds-12 >> jds-13 >> jds-14 >> root@OpenWrt:~/examples# >> >> >> -- >> Jon Smirl >> jonsm...@gmail.com >> ___ >> openwrt-devel mailing list >> openwrt-devel@lists.openwrt.org >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel >> > devendra. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Wifi to 802.15.4 router project
On Sun, Jan 15, 2012 at 1:42 PM, devendra.aaru wrote: >> >> valgrind lua cairo test4oo.lua?? :) >>> >>> Segmentation fault >> >> atleast you will get some inputs by running valgrind . No Valgrind on ARM. And running same test with Valgrind on x86 doesn't find anything. I have dmalloc linked in and it fail with an internal heap corruption error. I'm catching the failures but not close enough to what is doing the corruption. This could even be a bug in the compiler code generation on ARM. -- Jon Smirl jonsm...@gmail.com ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel